aboutsummaryrefslogtreecommitdiffstats
path: root/ice40/pack_tests/locals.v
diff options
context:
space:
mode:
Diffstat (limited to 'ice40/pack_tests/locals.v')
-rw-r--r--ice40/pack_tests/locals.v27
1 files changed, 27 insertions, 0 deletions
diff --git a/ice40/pack_tests/locals.v b/ice40/pack_tests/locals.v
new file mode 100644
index 00000000..a1c5ea9f
--- /dev/null
+++ b/ice40/pack_tests/locals.v
@@ -0,0 +1,27 @@
+module top(input clk, cen, rst, ina, inb, output outa, outb, outc, outd);
+
+reg [31:0] temp = 0;
+
+integer i;
+
+always @(posedge clk)
+begin
+ if (cen) begin
+ if (rst) begin
+ temp <= 0;
+ end else begin
+ temp[0] <= ina;
+ temp[1] <= inb;
+ for (i = 2; i < 32; i++) begin
+ temp[i] <= temp[(i + 3) % 32] ^ temp[(i + 30) % 32] ^ temp[(i + 4) % 16] ^ temp[(i + 2) % 32];
+ end
+ end
+ end
+end
+
+assign outa = temp[3];
+assign outb = temp[5];
+assign outc = temp[9];
+assign outd = temp[15];
+
+endmodule