blob: be068fc5b424884cda32f3779d67298f916dc361 [file] [log] [blame]
agorararmard6c766a82020-12-10 18:13:12 +02001// SPDX-FileCopyrightText: 2020 Efabless Corporation
agorararmarde5780bf2020-12-09 21:27:56 +00002//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
agorararmardafa96ea2020-12-09 23:37:31 +020014// SPDX-License-Identifier: Apache-2.0
agorararmarde5780bf2020-12-09 21:27:56 +000015
Matt Venn08cd6eb2020-11-16 12:01:14 +010016`default_nettype none
shalanfd13eb52020-08-21 16:48:07 +020017module dummy_slave(
18 input wb_clk_i,
19 input wb_rst_i,
20
21 input wb_stb_i,
22 input wb_cyc_i,
23 input wb_we_i,
24 input [3:0] wb_sel_i,
25 input [31:0] wb_adr_i,
26 input [31:0] wb_dat_i,
27
28 output reg [31:0] wb_dat_o,
29 output reg wb_ack_o
30);
31 reg [31:0] store;
32
33 wire valid = wb_cyc_i & wb_stb_i;
34
35 always @(posedge wb_clk_i) begin
36 if (wb_rst_i == 1'b 1) begin
37 wb_ack_o <= 1'b 0;
38 end else begin
39 if (wb_we_i == 1'b 1) begin
40 if (wb_sel_i[0]) store[7:0] <= wb_dat_i[7:0];
41 if (wb_sel_i[1]) store[15:8] <= wb_dat_i[15:8];
42 if (wb_sel_i[2]) store[23:16] <= wb_dat_i[23:16];
43 if (wb_sel_i[3]) store[31:24] <= wb_dat_i[31:24];
44 end
45 wb_dat_o <= store;
46 wb_ack_o <= valid & !wb_ack_o;
47 end
48 end
49endmodule