From 4a4a3fc3377243d85100b829a0f6b785376cce9f Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Wed, 4 Dec 2013 21:06:54 +0100 Subject: Various improvements in support for generate statements --- tests/simple/generate.v | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'tests/simple/generate.v') 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 -- cgit v1.2.3