Skip to content

Commit 2666b50

Browse files
committed
ast_code_generator/template/identifierscopelabel.txt: bug fix for generate-if statement
1 parent a8766a5 commit 2666b50

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{{ name }}{%- if loop != '' %}[{{ loop }}].{%- endif %}
1+
{{ name }}{%- if loop != '' %}[{{ loop }}]{%- endif %}.

testcode/generate.v

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,19 @@ module SUB(CLK, RST_X, subin, subout);
6767
output [WD-1:0] subout;
6868

6969
genvar j;
70-
generate for(j=0; j<WD; j=j+1) begin
71-
assign subout[j] = ~subin[j];
70+
generate for(j=0; j<WD; j=j+1) begin: loop
71+
if(j == 0) begin: _t
72+
wire tmp;
73+
assign subout[j] = subin[j];
74+
assign tmp = ~subin[j];
75+
end else begin: _f
76+
wire tmp;
77+
if(j == 1) begin
78+
assign subout[j] = loop[j-1]._t.tmp ^ subin[j];
79+
end else begin
80+
assign subout[j] = loop[j-1]._f.tmp ^ subin[j];
81+
end
82+
end
7283
end endgenerate
7384

7485
endmodule

0 commit comments

Comments
 (0)