diff options
Diffstat (limited to 'tests/simple/generate.v')
-rw-r--r-- | tests/simple/generate.v | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/simple/generate.v b/tests/simple/generate.v index d458c076d..39e573a73 100644 --- a/tests/simple/generate.v +++ b/tests/simple/generate.v @@ -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 |