Recognize an expression that is OK for a SystemVerilog-2012
(vl-expr-variable-lvalue-p x) → bool
Here's the original grammar for
variable_lvalue ::= [ implicit_class_handle '.' | package_scope ] hierarchical_variable_identifier select | '{' variable_lvalue { ',' variable_lvalue } '}' | [ assignment_pattern_expression_type ] assignment_pattern_variable_lvalue | streaming_concatenation
Footnote 46 applies. In a
Footnote 47 also applies. The streaming_concatenation
expression here shall not be nested within another
The first production essentially corresponds to our notion of an
index expression, the second to concatenation. The third production
is quite similar to
assignment_pattern_expression ::= [ assignment_pattern_expression_type ] assignment_pattern
Except that here we have an
assignment_pattern_variable_lvalue ::= QUOTE '{' variable_lvalue { ',' variable_lvalue } '}' assignment_pattern ::= QUOTE '{' expression { ',' expression } '}' | QUOTE '{' structure_pattern_key ... | QUOTE '{' array_pattern_key ... | QUOTE '{' constant_expression '{' ...
So essentially the grammar is just trying to (1) rule out the
fancier structure/array/replication assignment patterns while still
allowing basic positional assignment patterns, and (2) ensure that all
of the expressions within the assignment pattern here happen to be
good
Finally, the last production just corresponds to our usual notion of streaming concatenation, modulo the nesting restriction, so that's about it.
Comparing all of the above to the story for
Function:
(defun vl-expr-variable-lvalue-p (x) (declare (xargs :guard (vl-expr-p x))) (let ((__function__ 'vl-expr-variable-lvalue-p)) (declare (ignorable __function__)) (let ((x (vl-expr-fix x))) (or (vl-expr-net-lvalue-p x) (vl-expr-case x :vl-stream)))))
Theorem:
(defthm vl-expr-variable-lvalue-p-of-vl-expr-fix-x (equal (vl-expr-variable-lvalue-p (vl-expr-fix x)) (vl-expr-variable-lvalue-p x)))
Theorem:
(defthm vl-expr-variable-lvalue-p-vl-expr-equiv-congruence-on-x (implies (vl-expr-equiv x x-equiv) (equal (vl-expr-variable-lvalue-p x) (vl-expr-variable-lvalue-p x-equiv))) :rule-classes :congruence)