User guide

22-13
SystemVerilog Design Constructs
myreg1=u1.r2[2];
end
Structure Expressions
You can use braces and commas to specify an expression to assign
values to the members of a structure. For example:
typedef struct{
bit bt0;
bit bt11;
} struct0;
struct0 s0 = {0,1};
In this example, in the declaration of struct0 structure s0, bt0 is
initialized to 0 and bt11 is initialized to 1, because they are listed that
way in the declaration of structure struct0.
You can use the names of the members in a structure expression so
that you do not have to assign values in the order of the members in
the declaration. For example:
typedef struct{
bit bt1;
bit bt2;
} struct1;
struct1 s1 = {bt2:0, bt1:1};
You can use the default keyword to assign values to unspecified
members. You can also use a structure expression in a procedural
assignment statement. For example:
typedef struct{
logic l1;
bit bt3;
}struct2;
struct2 s2;