Remote ENABLE_REGS_DUALPORT and init reg zero.
This commit is contained in:
parent
8b3d3390f5
commit
af85947a58
38
picorv32.v
38
picorv32.v
|
@ -52,7 +52,6 @@
|
|||
|
||||
module picorv32 #(
|
||||
parameter [ 0:0] ENABLE_REGS_16_31 = 1,
|
||||
parameter [ 0:0] ENABLE_REGS_DUALPORT = 1,
|
||||
parameter [ 0:0] LATCHED_MEM_RDATA = 0,
|
||||
parameter [ 0:0] TWO_STAGE_SHIFT = 1,
|
||||
parameter [ 0:0] BARREL_SHIFTER = 0,
|
||||
|
@ -66,7 +65,6 @@ module picorv32 #(
|
|||
parameter [ 0:0] ENABLE_IRQ_QREGS = 1,
|
||||
parameter [ 0:0] ENABLE_IRQ_TIMER = 1,
|
||||
parameter [ 0:0] ENABLE_TRACE = 0,
|
||||
parameter [ 0:0] REGS_INIT_ZERO = 0,
|
||||
parameter [31:0] MASKED_IRQ = 32'h 0000_0000,
|
||||
parameter [31:0] LATCHED_IRQ = 32'h ffff_ffff,
|
||||
parameter [31:0] PROGADDR_RESET = 32'h 0000_0000,
|
||||
|
@ -153,14 +151,6 @@ module picorv32 #(
|
|||
|
||||
`ifndef PICORV32_REGS
|
||||
reg [31:0] cpuregs [0:regfile_size-1];
|
||||
|
||||
integer i;
|
||||
initial begin
|
||||
if (REGS_INIT_ZERO) begin
|
||||
for (i = 0; i < regfile_size; i = i+1)
|
||||
cpuregs[i] = 0;
|
||||
end
|
||||
end
|
||||
`endif
|
||||
|
||||
task empty_statement;
|
||||
|
@ -964,7 +954,6 @@ module picorv32 #(
|
|||
|
||||
always @* begin
|
||||
decoded_rs = 'bx;
|
||||
if (ENABLE_REGS_DUALPORT) begin
|
||||
`ifndef RISCV_FORMAL_BLACKBOX_REGS
|
||||
cpuregs_rs1 = decoded_rs1 ? cpuregs[decoded_rs1] : 0;
|
||||
cpuregs_rs2 = decoded_rs2 ? cpuregs[decoded_rs2] : 0;
|
||||
|
@ -972,23 +961,15 @@ module picorv32 #(
|
|||
cpuregs_rs1 = decoded_rs1 ? $anyseq : 0;
|
||||
cpuregs_rs2 = decoded_rs2 ? $anyseq : 0;
|
||||
`endif
|
||||
end else begin
|
||||
decoded_rs = (cpu_state == cpu_state_ld_rs2) ? decoded_rs2 : decoded_rs1;
|
||||
`ifndef RISCV_FORMAL_BLACKBOX_REGS
|
||||
cpuregs_rs1 = decoded_rs ? cpuregs[decoded_rs] : 0;
|
||||
`else
|
||||
cpuregs_rs1 = decoded_rs ? $anyseq : 0;
|
||||
`endif
|
||||
cpuregs_rs2 = cpuregs_rs1;
|
||||
end
|
||||
|
||||
end
|
||||
`else
|
||||
wire[31:0] cpuregs_rdata1;
|
||||
wire[31:0] cpuregs_rdata2;
|
||||
|
||||
wire [5:0] cpuregs_waddr = latched_rd;
|
||||
wire [5:0] cpuregs_raddr1 = ENABLE_REGS_DUALPORT ? decoded_rs1 : decoded_rs;
|
||||
wire [5:0] cpuregs_raddr2 = ENABLE_REGS_DUALPORT ? decoded_rs2 : 0;
|
||||
wire [5:0] cpuregs_raddr1 = decoded_rs1;
|
||||
wire [5:0] cpuregs_raddr2 = decoded_rs2;
|
||||
|
||||
`PICORV32_REGS cpuregs (
|
||||
.clk(clk),
|
||||
|
@ -1003,14 +984,8 @@ module picorv32 #(
|
|||
|
||||
always @* begin
|
||||
decoded_rs = 'bx;
|
||||
if (ENABLE_REGS_DUALPORT) begin
|
||||
cpuregs_rs1 = decoded_rs1 ? cpuregs_rdata1 : 0;
|
||||
cpuregs_rs2 = decoded_rs2 ? cpuregs_rdata2 : 0;
|
||||
end else begin
|
||||
decoded_rs = (cpu_state == cpu_state_ld_rs2) ? decoded_rs2 : decoded_rs1;
|
||||
cpuregs_rs1 = decoded_rs ? cpuregs_rdata1 : 0;
|
||||
cpuregs_rs2 = cpuregs_rs1;
|
||||
end
|
||||
end
|
||||
`endif
|
||||
|
||||
|
@ -1193,7 +1168,6 @@ module picorv32 #(
|
|||
reg_op1 <= cpuregs_rs1;
|
||||
dbg_rs1val <= cpuregs_rs1;
|
||||
dbg_rs1val_valid <= 1;
|
||||
if (ENABLE_REGS_DUALPORT) begin
|
||||
pcpi_valid <= 1;
|
||||
`debug($display("LD_RS2: %2d 0x%08x", decoded_rs2, cpuregs_rs2);)
|
||||
reg_sh <= cpuregs_rs2;
|
||||
|
@ -1216,9 +1190,6 @@ module picorv32 #(
|
|||
end else
|
||||
cpu_state <= cpu_state_trap;
|
||||
end
|
||||
end else begin
|
||||
cpu_state <= cpu_state_ld_rs2;
|
||||
end
|
||||
end else begin
|
||||
`debug($display("EBREAK OR UNSUPPORTED INSN AT 0x%08x", reg_pc);)
|
||||
if (ENABLE_IRQ && !irq_mask[irq_ebreak] && !irq_active) begin
|
||||
|
@ -1331,7 +1302,6 @@ module picorv32 #(
|
|||
reg_op1 <= cpuregs_rs1;
|
||||
dbg_rs1val <= cpuregs_rs1;
|
||||
dbg_rs1val_valid <= 1;
|
||||
if (ENABLE_REGS_DUALPORT) begin
|
||||
`debug($display("LD_RS2: %2d 0x%08x", decoded_rs2, cpuregs_rs2);)
|
||||
reg_sh <= cpuregs_rs2;
|
||||
reg_op2 <= cpuregs_rs2;
|
||||
|
@ -1355,8 +1325,6 @@ module picorv32 #(
|
|||
cpu_state <= cpu_state_exec;
|
||||
end
|
||||
endcase
|
||||
end else
|
||||
cpu_state <= cpu_state_ld_rs2;
|
||||
end
|
||||
endcase
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue