aboutsummaryrefslogtreecommitdiffstats
path: root/tests/various/dynamic_part_select/original.v
blob: 41310a21563ce881b3d912828d04f489fd36fedd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
`default_nettype none
module original #(parameter WIDTH=32, SELW=1, CTRLW=$clog2(WIDTH), DINW=2**SELW)
   (input wire             clk,
    input wire [CTRLW-1:0] ctrl,
    input wire [DINW-1:0]  din,
    input wire [SELW-1:0]  sel,
    output reg [WIDTH-1:0] dout);
   localparam SLICE = WIDTH/(SELW**2);
   always @(posedge clk)
     begin
        dout[ctrl*sel+:SLICE] <= din ;
     end
endmodule