-
Notifications
You must be signed in to change notification settings - Fork 0
/
RAM_Slave.v
84 lines (75 loc) · 1.87 KB
/
RAM_Slave.v
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 2022/06/17 15:23:36
// Design Name:
// Module Name: RAM_Slave
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
//////////////////////////////////////////////////////////////////////////////////
module RAM_Slave #(
parameter [6:0] DATA_WIDTH = 32,
parameter [6:0] ADDR_WIDTH = 32
)
(
input clk,
input rst_n,
input [ADDR_WIDTH-1:0] BUS_addr,
input [DATA_WIDTH-1:0] BUS_wdata,
output [DATA_WIDTH-1:0] BUS_rdata,
input BUS_valid,
output BUS_wready,
input BUS_rready,
output BUS_rvalid,
input BUS_mode
);
wire [ADDR_WIDTH-1:0] addr;
wire [DATA_WIDTH-1:0] wdata;
wire [DATA_WIDTH-1:0] rdata;
wire write_en;
wire read_en;
wire read_valid;
assign read_valid = read_en;
blk_mem_gen_0 my_ram (
.clka(clk), // input wire clka
.wea(write_en), // input wire [0 : 0] wea
.addra(addr >> 2), // input wire [9 : 0] addra
.dina(wdata), // input wire [31 : 0] dina
.douta(rdata) // output wire [31 : 0] douta
);
BUS_slave #(
.START_ADDR('h0000_0000),
.END_ADDR('h0000_FFFF)
)
my_slave
(
.clk(clk),
.rst_n(rst_n),
.write_en(write_en),
.read_en(read_en),
.write_ready(1'b1),
.read_valid(read_valid),
.addr(addr),
.wdata(wdata),
.rdata(rdata),
.BUS_addr(BUS_addr),
.BUS_wdata(BUS_wdata),
.BUS_rdata(BUS_rdata),
.BUS_valid(BUS_valid),
.BUS_wready(BUS_wready),
.BUS_rready(BUS_rready),
.BUS_rvalid(BUS_rvalid),
.BUS_mode(BUS_mode)
);
endmodule