blob: 857ce0e8f02ca47c4966d7d6b56a418c2ff8eaea [file] [log] [blame]
shalanfd13eb52020-08-21 16:48:07 +02001module dummy_slave(
2 input wb_clk_i,
3 input wb_rst_i,
4
5 input wb_stb_i,
6 input wb_cyc_i,
7 input wb_we_i,
8 input [3:0] wb_sel_i,
9 input [31:0] wb_adr_i,
10 input [31:0] wb_dat_i,
11
12 output reg [31:0] wb_dat_o,
13 output reg wb_ack_o
14);
15 reg [31:0] store;
16
17 wire valid = wb_cyc_i & wb_stb_i;
18
19 always @(posedge wb_clk_i) begin
20 if (wb_rst_i == 1'b 1) begin
21 wb_ack_o <= 1'b 0;
22 end else begin
23 if (wb_we_i == 1'b 1) begin
24 if (wb_sel_i[0]) store[7:0] <= wb_dat_i[7:0];
25 if (wb_sel_i[1]) store[15:8] <= wb_dat_i[15:8];
26 if (wb_sel_i[2]) store[23:16] <= wb_dat_i[23:16];
27 if (wb_sel_i[3]) store[31:24] <= wb_dat_i[31:24];
28 end
29 wb_dat_o <= store;
30 wb_ack_o <= valid & !wb_ack_o;
31 end
32 end
33endmodule