Skip to content

Commit 77d6aeb

Browse files
author
Parham Farrokhi
committed
Remove Stall signal & SRAMOE, Refactor state machine sram controller
1 parent 1265700 commit 77d6aeb

File tree

13 files changed

+3330
-3303
lines changed

13 files changed

+3330
-3303
lines changed

Sec_8/EXE_Reg.v

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ module EXE_Stage_reg
33
(
44
clk,
55
rst,
6-
stall,
76
superStall,
87
PC_in,
98
WB_En_in,
@@ -28,7 +27,6 @@ module EXE_Stage_reg
2827
// input and output ports
2928
input clk;
3029
input rst;
31-
input stall;
3230
input superStall;
3331
input WB_En_in;
3432
input MEM_R_En_in;

Sec_8/MEM.v

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ module MEM_Stage
1010
SRAM_NOT_READY,
1111
SRAMaddress,
1212
SRAMWEn,
13-
SRAMOE,
1413
readdata,
1514
wbData,
1615
SRAMdata,
@@ -22,7 +21,6 @@ module MEM_Stage
2221
input read;
2322
input write;
2423
output SRAMWEn;
25-
output SRAMOE;
2624
input [31:0] aluResult;
2725
input [31:0] writedata;
2826
output [17:0] SRAMaddress;
@@ -54,16 +52,15 @@ module MEM_Stage
5452
.rst(rst),
5553
.SRAMaddress(SRAMaddress),
5654
.SRAMWEn(SRAMWEn),
57-
.SRAMOE(SRAMOE),
5855
.SRAMdata(SRAMdata),
5956
.SRAM_NOT_READY(SRAM_NOT_READY),
6057
.writeData(writedata),
6158
.address(realaddress),
62-
.readData(readData)
59+
.readData(readdata)
6360
);
6461

6562
// assign SRAM_NOT_READY = 1'b0;
66-
// assign readdata = (read) ? registers[realaddress[7:0]] : 32'b0;
63+
//assign readdata = (read) ? registers[realaddress[7:0]] : 32'b0;
6764
assign wbData = (read) ? readdata : aluResult;
6865

6966
// write part

Sec_8/MEM_Reg.v

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ module MEM_Stage_reg
33
(
44
clk,
55
rst,
6-
stall,
76
superStall,
87
PC_in,
98
PC,
@@ -24,7 +23,6 @@ module MEM_Stage_reg
2423
// input and output ports
2524
input clk;
2625
input rst;
27-
input stall;
2826
input superStall;
2927
input WB_En_in;
3028
input MEM_R_En_in;

Sec_8/MIPS.mpf

Lines changed: 28 additions & 28 deletions
Large diffs are not rendered by default.

Sec_8/MIPS.qsf

Lines changed: 979 additions & 973 deletions
Large diffs are not rendered by default.

Sec_8/MIPS.v

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,16 @@ module MIPS
66
rst,
77
Sel,
88
SRAMaddress, // SRAM Address bus 18 Bits
9-
SRAMWEn, // SRAM Write Enable
10-
SRAMOE, // SRAM Output Enable
9+
SRAMWEn, // SRAM Write Enable
1110
SRAMdata, // SRAM Data bus 16 Bits
12-
Instruction
1311
);
1412

1513
// input and outputs
1614
input clk;
1715
input rst;
1816
input Sel;
1917
output SRAMWEn;
20-
output SRAMOE;
2118
output [17:0] SRAMaddress;
22-
output [5:0] Instruction;
2319
inout [15:0] SRAMdata;
2420

2521
// wires
@@ -38,9 +34,8 @@ module MIPS
3834
wire Is_Imm2;
3935
wire Is_Imm3;
4036
wire Is_Imm4;
41-
wire shouldForward11;
42-
wire shouldForward12;
43-
wire shouldForward1mem;
37+
wire shouldForward11;
38+
wire shouldForward12;
4439
wire Branch_Taken;
4540
wire SRAM_NOT_READY;
4641
wire Stall;
@@ -90,9 +85,6 @@ module MIPS
9085

9186
// assemble modules
9287

93-
// output
94-
assign Instruction = Instruction1[31:26];
95-
9688
// instruction fetch
9789
IF_Stage IFS
9890
(
@@ -199,7 +191,6 @@ module MIPS
199191
.EXE_Cmd(EXE_Cmd2),
200192
.PC(PC2)
201193
);
202-
// execution
203194
ForwardUnit FU
204195
(
205196
.BR_Type(BR_Type2), // Pass BR_Type through levels
@@ -220,6 +211,7 @@ module MIPS
220211
.shouldForward1(shouldForward11),
221212
.shouldForward2(shouldForward12)
222213
);
214+
// execution
223215
EXE_Stage EXES
224216
(
225217
.BR_Type(BR_Type2),
@@ -242,7 +234,6 @@ module MIPS
242234
(
243235
.clk(clk),
244236
.rst(rst),
245-
.stall(Stall),
246237
.superStall(superStall),
247238
.PC_in(PC2),
248239
.PC(PC3),
@@ -276,7 +267,6 @@ module MIPS
276267
.wbData(WB_Data0),
277268
.SRAMaddress( SRAMaddress ),
278269
.SRAMWEn( SRAMWEn ),
279-
.SRAMOE( SRAMOE ),
280270
.SRAM_NOT_READY( SRAM_NOT_READY ),
281271
.SRAMdata( SRAMdata )
282272
);
@@ -285,7 +275,6 @@ module MIPS
285275
(
286276
.clk(clk),
287277
.rst(rst),
288-
.stall(Stall),
289278
.superStall(superStall),
290279
.PC_in(PC3),
291280
.PC(PC4),

Sec_8/MIPSHQ.v

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
// Permission:
66
//
77
// Terasic grants permission to use and modify this code for use
8-
// in synthesis for all Terasic Development Boards and Altera Development
9-
// Kits made by Terasic. Other use of this code, including the selling
8+
// in synthesis for all Terasic Development Boards and Altera Development
9+
// Kits made by Terasic. Other use of this code, including the selling
1010
// ,duplication, or modification of any portion is strictly prohibited.
1111
//
1212
// Disclaimer:
@@ -15,11 +15,11 @@
1515
// which illustrates how these types of functions can be implemented.
1616
// It is the user's responsibility to verify their design for
1717
// consistency and functionality through the use of formal
18-
// verification methods. Terasic provides no warranty regarding the use
18+
// verification methods. Terasic provides no warranty regarding the use
1919
// or functionality of this code.
2020
//
2121
// ============================================================================
22-
//
22+
//
2323
// Terasic Technologies Inc
2424
// 9F., No.176, Sec.2, Gongdao 5th Rd, East Dist, Hsinchu City, 30070. Taiwan
2525
//
@@ -39,15 +39,15 @@
3939
// Ver :| Author :| Mod. Date :| Changes Made:
4040
// V1.0 :| Johnny Chen :| 05/08/19 :| Initial Revision
4141
// V1.1 :| Johnny Chen :| 05/11/16 :| Added FLASH Address FL_ADDR[21:20]
42-
// V1.2 :| Johnny Chen :| 05/11/16 :| Fixed ISP1362 INT/DREQ Pin Direction.
42+
// V1.2 :| Johnny Chen :| 05/11/16 :| Fixed ISP1362 INT/DREQ Pin Direction.
4343
// V1.3 :| Johnny Chen :| 06/11/16 :| Added the Dedicated TV Decoder Line-Locked-Clock Input
4444
// for DE2 v2.X PCB.
4545
// V1.5 :| Eko Yan :| 12/01/30 :| Update to version 11.1 sp1.
4646
// ============================================================================
4747

4848
module MIPSHQ
4949
(
50-
//////////////////// Clock Input ////////////////////
50+
//////////////////// Clock Input ////////////////////
5151
CLOCK_27, // 27 MHz
5252
CLOCK_50, // 50 MHz
5353
EXT_CLOCK, // External Clock
@@ -76,7 +76,7 @@ module MIPSHQ
7676
///////////////////// SDRAM Interface ////////////////
7777
DRAM_DQ, // SDRAM Data bus 16 Bits
7878
DRAM_ADDR, // SDRAM Address bus 12 Bits
79-
DRAM_LDQM, // SDRAM Low-byte Data Mask
79+
DRAM_LDQM, // SDRAM Low-byte Data Mask
8080
DRAM_UDQM, // SDRAM High-byte Data Mask
8181
DRAM_WE_N, // SDRAM Write Enable
8282
DRAM_CAS_N, // SDRAM Column Address Strobe
@@ -96,8 +96,8 @@ module MIPSHQ
9696
//////////////////// SRAM Interface ////////////////
9797
SRAM_DQ, // SRAM Data bus 16 Bits
9898
SRAM_ADDR, // SRAM Address bus 18 Bits
99-
SRAM_UB_N, // SRAM High-byte Data Mask
100-
SRAM_LB_N, // SRAM Low-byte Data Mask
99+
SRAM_UB_N, // SRAM High-byte Data Mask
100+
SRAM_LB_N, // SRAM Low-byte Data Mask
101101
SRAM_WE_N, // SRAM Write Enable
102102
SRAM_CE_N, // SRAM Chip Enable
103103
SRAM_OE_N, // SRAM Output Enable
@@ -125,7 +125,7 @@ module MIPSHQ
125125
LCD_DATA, // LCD Data bus 8 bits
126126
//////////////////// SD_Card Interface ////////////////
127127
//SD_DAT, // SD Card Data
128-
//SD_WP_N, // SD Write protect
128+
//SD_WP_N, // SD Write protect
129129
//SD_CMD, // SD Card Command Signal
130130
//SD_CLK, // SD Card Clock
131131
//////////////////// USB JTAG link ////////////////////
@@ -204,7 +204,7 @@ output [17:0] LEDR; // LED Red[17:0]
204204
/////////////////////// SDRAM Interface ////////////////////////
205205
inout [15:0] DRAM_DQ; // SDRAM Data bus 16 Bits
206206
output [11:0] DRAM_ADDR; // SDRAM Address bus 12 Bits
207-
output DRAM_LDQM; // SDRAM Low-byte Data Mask
207+
output DRAM_LDQM; // SDRAM Low-byte Data Mask
208208
output DRAM_UDQM; // SDRAM High-byte Data Mask
209209
output DRAM_WE_N; // SDRAM Write Enable
210210
output DRAM_CAS_N; // SDRAM Column Address Strobe
@@ -224,8 +224,8 @@ output FL_CE_N; // FLASH Chip Enable
224224
//////////////////////// SRAM Interface ////////////////////////
225225
inout [15:0] SRAM_DQ; // SRAM Data bus 16 Bits
226226
output [17:0] SRAM_ADDR; // SRAM Address bus 18 Bits
227-
output SRAM_UB_N; // SRAM High-byte Data Mask
228-
output SRAM_LB_N; // SRAM Low-byte Data Mask
227+
output SRAM_UB_N; // SRAM High-byte Data Mask
228+
output SRAM_LB_N; // SRAM Low-byte Data Mask
229229
output SRAM_WE_N; // SRAM Write Enable
230230
output SRAM_CE_N; // SRAM Chip Enable
231231
output SRAM_OE_N; // SRAM Output Enable
@@ -307,16 +307,14 @@ MIPS UUT
307307
.clk(CLOCK_50),
308308
.rst(SW[0]),
309309
.Sel(SW[1]),
310-
.SRAMdata( SRAM_DQ ), // SRAM Data bus 16 Bits
311-
.SRAMaddress( SRAM_ADDR ), // SRAM Address bus 18 Bits
312-
.SRAMWEn( SRAM_WE_N ), // SRAM Write Enable
313-
.SRAMOE( SRAM_OE_N ), // SRAM Output Enable
314-
.Instruction(LEDR[5:0])
310+
.SRAMdata( SRAM_DQ ), // SRAM Data bus 16 Bits
311+
.SRAMaddress( SRAM_ADDR ), // SRAM Address bus 18 Bits
312+
.SRAMWEn( SRAM_WE_N ), // SRAM Write Enable
315313
);
316314

317-
assign SRAM_UB_N = 1'b0; // SRAM High-byte Data Mask
318-
assign SRAM_LB_N = 1'b0; // SRAM Low-byte Data Mask
315+
assign SRAM_UB_N = 1'b0; // SRAM High-byte Data Mask
316+
assign SRAM_LB_N = 1'b0; // SRAM Low-byte Data Mask
319317
assign SRAM_CE_N = 1'b0; // SRAM Chip Enable
320-
321-
endmodule
318+
assign SRAM_OE_N = 1'b0; // SRAM Output Enable
322319

320+
endmodule

0 commit comments

Comments
 (0)