summaryrefslogtreecommitdiff
path: root/tests/simple/generate.v
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2013-12-04 21:06:54 +0100
committerClifford Wolf <clifford@clifford.at>2013-12-04 21:06:54 +0100
commit4a4a3fc3377243d85100b829a0f6b785376cce9f (patch)
tree689dda333df9ac7012ce460e8f7e801b631c0882 /tests/simple/generate.v
parentf4b46ed31e5f5c41bbd4ee1fdf996ecdc2010174 (diff)
Various improvements in support for generate statements
Diffstat (limited to 'tests/simple/generate.v')
-rw-r--r--tests/simple/generate.v27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/simple/generate.v b/tests/simple/generate.v
index d458c076..39e573a7 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