Skip to content
This repository was archived by the owner on Jun 29, 2023. It is now read-only.

Commit bae85c7

Browse files
author
Kai M. Wetlesen
committed
Merge branch 'master' into kaiw
2 parents 0d411bc + cb5eed7 commit bae85c7

24 files changed

+375
-6285
lines changed

CP2.v

+8-8
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ module CP2(
2727
output wire [31:0] rdData_cpu,
2828

2929
output reg we_dma,
30-
output reg [19:0] addr_dma,
30+
output reg [31:0] addr_dma,
3131
input wire[31:0] wrData_dma,
3232
output reg [31:0] rdData_dma,
3333

@@ -146,17 +146,17 @@ module CP2(
146146
end // END rst
147147
else begin
148148
if(we_cpu) reg_cpu[addr_cpu] = (addr_cpu==0)? {wrData_cpu[31:25], reg_cpu[0][24], wrData_cpu[23:0] } : wrData_cpu;
149-
end
149+
/* end
150150
end
151151
152152
153-
always @ (posedge clk) begin
153+
always @ (posedge clk) begin*/
154154
case(state_dma)
155155
idle : state_dma = reg_cpu[0][30] ? dmaSet : idle; // WHILE go !=1
156156
dmaSet : begin
157157
reg_cpu[0][24]<= 1;
158158
//self.clk = clk*1; // reset clk
159-
addr_dma <= reg_cpu[1][19:0];
159+
addr_dma <= reg_cpu[1][31:0];
160160
we_dma = 0;
161161
i = 0;
162162
length = 0;
@@ -207,7 +207,7 @@ module CP2(
207207

208208
dmaWriteA : begin
209209
we_dma <= 1;
210-
addr_dma <= reg_cpu[1][19:0];
210+
addr_dma <= reg_cpu[1][31:0];
211211
state_dma = dmaWriteB; end
212212
dmaWriteB : begin
213213
rdData_dma = r00[i];
@@ -233,9 +233,9 @@ module CP2(
233233
state_dma = idle; end
234234
default : state_dma = idle;
235235
endcase // ENDCASE STATE_DMA
236-
end
236+
/* end
237237
238-
always @ (posedge clk) begin
238+
always @ (posedge clk) begin*/
239239
case(state_aes)
240240
idle : state_aes = reg_cpu[0][30] ? loadKeyA : idle;
241241
loadKeyA :begin
@@ -308,7 +308,7 @@ module CP2(
308308
default : state_aes = idle;
309309
endcase // ENDCASE AES_STATE
310310
end
311-
311+
end
312312
endmodule
313313

314314

CPzero.v

+13-11
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ module CPzero
22
(input clk, rst, we1, alu_trap, [4:0] addr, [5:0] interrupt, [31:0] wd, pcp4,
33
output exl, iv, [31:0] rd1);
44

5-
6-
75
// if need full space then use the following line.
86
// reg [32:0] rf [0:31];
97
reg [31:0] rf [0:15];
@@ -13,12 +11,16 @@ module CPzero
1311
// external flag assigns
1412
assign iv = rf[13][23]; // handler location, which location to select (180|200)
1513
assign exl = rf[12][1]; // external flag to CU for any interrupt
16-
always @ (posedge exl) begin // capture pc+4 Return addr when INT flag is set
17-
rf[14] = pcp4;
14+
always @ (posedge exl /*or (addr == 5'b01110)*/) begin // capture pc+4 Return addr when INT flag is set
15+
/* if(we1 && (addr == 5'b01110)) begin
16+
rf[addr] <= wd;
17+
end else if(exl) begin*/
18+
rf[14] <= pcp4;
19+
// end
1820
end
1921

2022
//MUST BE UNCOMMENTED TO RUN TESTBENCH.
21-
/* always @ (posedge rst) begin
23+
/* always @ (posedge rst) begin
2224
// MIPS ISA leaves most of the values within this module as
2325
// undefined on startup. To allow functional verification in the
2426
//testbench, used register files 12-14 are initilized to zero
@@ -48,7 +50,8 @@ module CPzero
4850
end
4951

5052

51-
/* always @ (interrupt) begin
53+
/*
54+
always @ (interrupt) begin
5255
// set INT flags
5356
if (rf[12][0] == 1) begin
5457
rf[13][10] <= (interrupt[0] & rf[12][10]);
@@ -182,11 +185,10 @@ end
182185
rf[addr][8] <= wd[8];
183186
end
184187
end
185-
5'b01110: //reg 14
186-
if(we1) begin
187-
rf[addr] <= wd;
188-
end
189-
188+
//5'b01110: //reg 14
189+
// if(we1) begin
190+
// rf[addr] <= wd;
191+
// end
190192
endcase // END case(addr)
191193
//end of interrupt logic
192194
//end

constraints.xdc

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ set_property -dict { PACKAGE_PIN E22 IOSTANDARD LVCMOS33} [get_ports { INT[0] }
1616
set_property -dict { PACKAGE_PIN F21 IOSTANDARD LVCMOS33} [get_ports { INT[1] }]; #IO_25_16 Sch=sw[1]
1717
set_property -dict { PACKAGE_PIN G21 IOSTANDARD LVCMOS33} [get_ports { INT[2] }]; #IO_L24P_T3_16 Sch=sw[2]
1818
set_property -dict { PACKAGE_PIN G22 IOSTANDARD LVCMOS33} [get_ports { INT[3] }]; #IO_L24N_T3_16 Sch=sw[3]
19-
set_property -dict { PACKAGE_PIN H17 IOSTANDARD LVCMOS33} [get_ports { INT[4] }]; #IO_L6P_T0_15 Sch=sw[4]
19+
#set_property -dict { PACKAGE_PIN H17 IOSTANDARD LVCMOS33} [get_ports { INT[4] }]; #IO_L6P_T0_15 Sch=sw[4]
2020

2121
#test unit
2222
set_property -dict { PACKAGE_PIN T14 IOSTANDARD LVCMOS25 } [get_ports { pc_current }]; #IO_L15P_T2_DQS_13 Sch=led[0]

0 commit comments

Comments
 (0)