aboutsummaryrefslogtreecommitdiffstats
path: root/ice40/pack_tests/locals.v
blob: a1c5ea9f3877ef7fc04f7862aee455b261f77db2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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