3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-08-06 19:21:23 +00:00

Various improvements in support for generate statements

This commit is contained in:
Clifford Wolf 2013-12-04 21:06:54 +01:00
parent f4b46ed31e
commit 4a4a3fc337
7 changed files with 161 additions and 7 deletions

View file

@ -65,3 +65,30 @@ end
endmodule
// ------------------------------------------
module test3(a, b, sel, y, z);
input [3:0] a, b;
input sel;
output [3:0] y, z;
genvar i;
generate
for (i=0; i < 2; i=i+1)
assign y[i] = sel ? a[i] : b[i], z[i] = sel ? b[i] : a[i];
for (i=0; i < 2; i=i+1) begin
if (i == 0)
assign y[2] = sel ? a[2] : b[2];
else
assign z[2] = sel ? a[2] : b[2];
case (i)
default:
assign z[3] = sel ? a[3] : b[3];
0:
assign y[3] = sel ? a[3] : b[3];
endcase
end
endgenerate
endmodule