logic_struct_select.v 314 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
module example(sel, out);
    parameter W = 8;

    reg [7:0] arr [3:0];
    initial begin
        arr[0] = 8'b01000011;
        arr[1] = 8'b00010110;
        arr[2] = 8'b10001111;
        arr[3] = 8'b01100110;
    end

    input [1:0] sel;
    output [7:0] out;

    assign out = sel ? arr[sel] : 8'b0;
endmodule