|
|
1 module struct_expr_operator();
2
3 typedef struct {
4 int x;
5 int y;
6 } myStruct;
7
8 myStruct s1;
9 int k = 1;
10
11 initial begin
12 #1 s1 = '{1, 2+k};
13 // by position
14 #1 $display("Value of x = %g y = %g by position", s1.x, s1.y);
15 #1 s1 = '{x:2, y:3+k};
16 // by name
17 #1 $display("Value of s1 ", s1, " by name");
18 #1 $finish;
19 end
20
21 endmodule
You could download file struct_expr_operator.sv here
|