Added tests/simple/repwhile.v
authorClifford Wolf <clifford@clifford.at>
Fri, 6 Jun 2014 15:47:20 +0000 (17:47 +0200)
committerClifford Wolf <clifford@clifford.at>
Fri, 6 Jun 2014 15:47:20 +0000 (17:47 +0200)
tests/simple/repwhile.v [new file with mode: 0644]

diff --git a/tests/simple/repwhile.v b/tests/simple/repwhile.v
new file mode 100644 (file)
index 0000000..8c5b4b3
--- /dev/null
@@ -0,0 +1,20 @@
+module test001(output [63:0] y);
+       function [7:0] mylog2;
+               input [31:0] value;
+               begin
+                       mylog2 = 0;
+                       while (value > 0) begin
+                               value = value >> 1;
+                               mylog2 = mylog2 + 1;
+                       end
+               end
+       endfunction
+
+       genvar i;
+       generate
+               for (i = 0; i < 64; i = i+1) begin
+                       localparam tmp = mylog2(i);
+                       assign y[i] = tmp;
+               end
+       endgenerate
+endmodule