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