mirror of
https://github.com/YosysHQ/yosys
synced 2025-10-07 08:21:57 +00:00
Merge pull request #2529 from zachjs/unnamed-genblk
verilog: significant block scoping improvements
This commit is contained in:
commit
baf1875307
33 changed files with 783 additions and 262 deletions
|
@ -260,3 +260,66 @@ module gen_test8;
|
|||
`ASSERT(gen_test8.A.C.x == 1)
|
||||
`ASSERT(gen_test8.A.B.x == 0)
|
||||
endmodule
|
||||
|
||||
// ------------------------------------------
|
||||
|
||||
module gen_test9;
|
||||
|
||||
// `define VERIFY
|
||||
`ifdef VERIFY
|
||||
`define ASSERT(expr) assert property (expr);
|
||||
`else
|
||||
`define ASSERT(expr)
|
||||
`endif
|
||||
|
||||
wire [1:0] w = 2'b11;
|
||||
generate
|
||||
begin : A
|
||||
wire [1:0] x;
|
||||
begin : B
|
||||
wire [1:0] y = 2'b00;
|
||||
`ASSERT(w == 3)
|
||||
`ASSERT(x == 2)
|
||||
`ASSERT(y == 0)
|
||||
`ASSERT(A.x == 2)
|
||||
`ASSERT(A.C.z == 1)
|
||||
`ASSERT(A.B.y == 0)
|
||||
`ASSERT(gen_test9.w == 3)
|
||||
`ASSERT(gen_test9.A.x == 2)
|
||||
`ASSERT(gen_test9.A.C.z == 1)
|
||||
`ASSERT(gen_test9.A.B.y == 0)
|
||||
end
|
||||
begin : C
|
||||
wire [1:0] z = 2'b01;
|
||||
`ASSERT(w == 3)
|
||||
`ASSERT(x == 2)
|
||||
`ASSERT(z == 1)
|
||||
`ASSERT(A.x == 2)
|
||||
`ASSERT(A.C.z == 1)
|
||||
`ASSERT(A.B.y == 0)
|
||||
`ASSERT(gen_test9.w == 3)
|
||||
`ASSERT(gen_test9.A.x == 2)
|
||||
`ASSERT(gen_test9.A.C.z == 1)
|
||||
`ASSERT(gen_test9.A.B.y == 0)
|
||||
end
|
||||
assign x = B.y ^ 2'b11 ^ C.z;
|
||||
`ASSERT(x == 2)
|
||||
`ASSERT(A.x == 2)
|
||||
`ASSERT(A.C.z == 1)
|
||||
`ASSERT(A.B.y == 0)
|
||||
`ASSERT(gen_test9.w == 3)
|
||||
`ASSERT(gen_test9.A.x == 2)
|
||||
`ASSERT(gen_test9.A.C.z == 1)
|
||||
`ASSERT(gen_test9.A.B.y == 0)
|
||||
end
|
||||
endgenerate
|
||||
|
||||
`ASSERT(w == 3)
|
||||
`ASSERT(A.x == 2)
|
||||
`ASSERT(A.C.z == 1)
|
||||
`ASSERT(A.B.y == 0)
|
||||
`ASSERT(gen_test9.w == 3)
|
||||
`ASSERT(gen_test9.A.x == 2)
|
||||
`ASSERT(gen_test9.A.C.z == 1)
|
||||
`ASSERT(gen_test9.A.B.y == 0)
|
||||
endmodule
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue