Merge pull request #2436 from dalance/fix_generate

Fix begin/end in generate
This commit is contained in:
whitequark 2021-02-03 09:43:23 +00:00 committed by GitHub
commit 4bc6995b9a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 7 deletions

View File

@ -21,9 +21,6 @@ module top;
end end
end end
generate generate
begin : unconditional_block
initial `CONSTANT_CHECK
end
if (WIDTH == 32) begin : conditional_block if (WIDTH == 32) begin : conditional_block
initial `CONSTANT_CHECK initial `CONSTANT_CHECK
end end

View File

@ -167,7 +167,7 @@ module gen_test7;
reg [2:0] out2; reg [2:0] out2;
wire [2:0] out3; wire [2:0] out3;
generate generate
begin : cond if (1) begin : cond
reg [2:0] sub_out1; reg [2:0] sub_out1;
reg [2:0] sub_out2; reg [2:0] sub_out2;
wire [2:0] sub_out3; wire [2:0] sub_out3;
@ -215,9 +215,9 @@ module gen_test8;
wire [1:0] x = 2'b11; wire [1:0] x = 2'b11;
generate generate
begin : A if (1) begin : A
wire [1:0] x; wire [1:0] x;
begin : B if (1) begin : B
wire [1:0] x = 2'b00; wire [1:0] x = 2'b00;
`ASSERT(x == 0) `ASSERT(x == 0)
`ASSERT(A.x == 2) `ASSERT(A.x == 2)
@ -228,7 +228,7 @@ module gen_test8;
`ASSERT(gen_test8.A.C.x == 1) `ASSERT(gen_test8.A.C.x == 1)
`ASSERT(gen_test8.A.B.x == 0) `ASSERT(gen_test8.A.B.x == 0)
end end
begin : C if (1) begin : C
wire [1:0] x = 2'b01; wire [1:0] x = 2'b01;
`ASSERT(x == 1) `ASSERT(x == 1)
`ASSERT(A.x == 2) `ASSERT(A.x == 2)