aboutsummaryrefslogtreecommitdiffstats
path: root/tests/simple/mem2reg_bounds_tern.v
blob: 0e6852fe764a1f8af94a82d128338191dce27b0d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
module mem2reg_bounds_term_top(
    input clk,
    input wire [1:0] sel,
    input wire [7:0] base,
    output reg [7:0] line
);
    reg [0:7] mem [0:2];

    generate
        genvar i;
        for (i = 0; i < 4; i = i + 1) begin : gen
            always @(posedge clk)
                mem[i] <= i == 0 ? base : mem[i - 1] + 1;
        end
    endgenerate

    always @(posedge clk)
        line = mem[sel];
endmodule