multipack_expr_in_lhs.v 354 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12
module top;
    reg [31:0] arr;
    wire [7:0] idx;
    assign idx = { 2'b01, 2'b11, 2'b00, 2'b10 };
    initial begin
        arr[idx[0 * 2 +: 2] * 8 +: 8] = 8'hDE;
        arr[idx[1 * 2 +: 2] * 8 +: 8] = 8'hAD;
        arr[idx[2 * 2 +: 2] * 8 +: 8] = 8'hBE;
        arr[idx[3 * 2 +: 2] * 8 +: 8] = 8'hEF;
        $display("%h", arr);
    end
endmodule