-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMEM_Stage.v
68 lines (56 loc) · 2.31 KB
/
MEM_Stage.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
`include "Defines.v"
module MEM_Stage(
input clk, rst,
input wb_en_in, mem_r_en_in, mem_w_en_in,
input [`REGISTER_LEN - 1:0] alu_res_in, val_Rm,
input [`REG_ADDRESS_LEN - 1:0] dest_in,
output wb_en_out, mem_r_en_out,
output [`REGISTER_LEN - 1:0] mem_out, alu_res_out,
output [`REG_ADDRESS_LEN - 1:0] dest_out,
output ready,
//////////////////////// SRAM Interface ////////////////////////
inout [15:0] SRAM_DQ, // SRAM Data bus 16 Bits
output [17:0] SRAM_ADDR, // SRAM Address bus 18 Bits
output SRAM_UB_N, // SRAM High-byte Data Mask
output SRAM_LB_N, // SRAM Low-byte Data Mask
output SRAM_WE_N, // SRAM Write Enable
output SRAM_CE_N, // SRAM Chip Enable
output SRAM_OE_N // SRAM Output Enable
);
assign wb_en_out = wb_en_in;
assign mem_r_en_out = mem_r_en_in;
assign alu_res_out = alu_res_in;
assign dest_out = dest_in;
SRAM_Controller SRAM_Controller(
.clk(clk), .rst(rst),
// Input from Memory .Stage(Stag)
.write_enable(mem_w_en_in), .read_enable(mem_r_en_in),
.address(alu_res_in),
.write_data(val_Rm),
// To WB Stage
.read_data(mem_out),
// To Freeze other Stages
.ready(ready),
//////////////////////// SRAM Interface ////////////////////////
.SRAM_DQ(SRAM_DQ), // SRAM Data bus 16 Bits
.SRAM_ADDR(SRAM_ADDR), // SRAM Address bus 18 Bits
// Active Low Signals
.SRAM_UB_N(SRAM_UB_N), // SRAM High-byte Data Mask
.SRAM_LB_N(SRAM_LB_N), // SRAM Low-byte Data Mask
.SRAM_WE_N(SRAM_WE_N), // SRAM Write Enable
.SRAM_CE_N(SRAM_CE_N), // SRAM Chip Enable
.SRAM_OE_N(SRAM_OE_N) // SRAM Output Enable
);
// assign SRAM_DQ = 16'bz;
// assign SRAM_ADDR = 18'b0;
// assign SRAM_UB_N = 1'b1;
// assign SRAM_LB_N = 1'b1;
// assign SRAM_WE_N = 1'b1;
// assign SRAM_CE_N = 1'b1;
// assign SRAM_OE_N = 1'b1;
// Memory memory(.clk(clk), .rst(rst), .address(alu_res_in),
// .WriteData(val_Rm), .MemRead(mem_r_en_in), .MemWrite(mem_w_en_in),
// .ReadData(mem_out),
// .ready(ready)
// );
endmodule