Vl-structmember
A single member of a struct or union.
This is a product type introduced by defprod.
Fields
- type — vl-datatype
- Type of the struct member, including any unpacked dimensions (even
though they normally come after the name.)
- name — stringp
- rhs — vl-maybe-expr
- Right-hand side expression that gives the default value to this
member, if applicable.
- rand — vl-randomqualifier-p
- Indicates whether a rand or randc keyword was used.
- atts — vl-atts
- Any (* foo = bar, baz *) style attributes.
Currently our structure members are very limited. In the long
run we may want to support more of the SystemVerilog grammar. It
allows a list of variable declaration assignments, which can have
fancy dimensions and different kinds of new operators.
Notes for the future:
variable_decl_assignment ::=
variable_identifier { variable_dimension } [ '=' expression ]
| dynamic_array_variable_identifier unsized_dimension { variable_dimension } [ '=' dynamic_array_new ]
| class_variable_identifier [ '=' class_new ]
These fancy _identifiers are all just identifiers. So
really this is:
variable_decl_assignment ::=
identifier { variable_dimension } [ '=' expression ]
| identifier unsized_dimension { variable_dimension } [ '=' dynamic_array_new ]
| identifier [ '=' class_new ]
The new keyword can occur in a variety of places. One of
these is related to defining constructors for classes, e.g., in
class constructor prototypes/declarations we can have things
like
function ... new (...) ...
And super.new(...) and so on. But for now let's think of
these as separate cases; that is, our approach to new in other
contexts doesn't necessarily need to have anything to do with these
constructors, which we might instead handle more explicitly.
The other places where new can occur are in:
dynamic_array_new ::= new '[' expression ']' [ '(' expression ')' ]
class_new ::= [ class_scope ] 'new' [ '(' list_of_arguments ')' ]
| 'new' expression
Which in turn can occur in blocking assignments:
[some fancy lhs] = dynamic_array_new
or [some other fancy lhs] = class_new
or other things not involving new
(Which is interesting because we also have to support a lot of
other new kinds of assignments like += and *=, so maybe
this could become a new= kind of assignment or something.)
And they can also occur in variable decl assignments:
simple id [ = expression ]
or some fancy lhs with some various dimensions [= dynamic_array_new]
or some simple lhs [= class_new]
Which can occur in:
- SVA assertion variable declarations
- Data declarations (e.g., top-level const suchandso = new ...
- Structure members in structs and unions.
So maybe we don't so much need these to be expressions. Maybe we
can get away with them as alternate kinds of assignments.
Subtopics
- Vl-structmember-equiv
- Basic equivalence relation for vl-structmember structures.
- Make-vl-structmember
- Basic constructor macro for vl-structmember structures.
- Vl-structmember->type
- Get the type field from a vl-structmember.
- Vl-structmember->rand
- Get the rand field from a vl-structmember.
- Vl-structmember-p
- Recognizer for vl-structmember structures.
- Change-vl-structmember
- Modifying constructor for vl-structmember structures.
- Vl-structmember->rhs
- Get the rhs field from a vl-structmember.
- Vl-structmember->name
- Get the name field from a vl-structmember.
- Vl-structmember->atts
- Get the atts field from a vl-structmember.
- Vl-randomqualifier-p
- Random qualifiers that can be put on struct or union members.
- Vl-structmemberlist
- A list of vl-structmember-p objects.
- Vl-structmember-fix
- Fixing function for vl-structmember structures.
- Vl-structmember-count
- Measure for recurring over vl-structmember structures.