Add a parameter to control register file reset, instead of the weird ifdef tree
This commit is contained in:
parent
df0fd536eb
commit
5f4127948d
|
@ -227,6 +227,7 @@ hazard3_cpu_1port #(
|
||||||
.CSR_M_TRAP (1),
|
.CSR_M_TRAP (1),
|
||||||
.DEBUG_SUPPORT (1),
|
.DEBUG_SUPPORT (1),
|
||||||
.NUM_IRQ (1),
|
.NUM_IRQ (1),
|
||||||
|
.RESET_REGFILE (0),
|
||||||
// Can be overridden from the defaults in hazard3_config.vh during
|
// Can be overridden from the defaults in hazard3_config.vh during
|
||||||
// instantiation of example_soc():
|
// instantiation of example_soc():
|
||||||
.EXTENSION_A (EXTENSION_A),
|
.EXTENSION_A (EXTENSION_A),
|
||||||
|
|
|
@ -129,6 +129,11 @@ parameter MULH_FAST = 0,
|
||||||
// especially if Zba extension is enabled. Disabling may save area.
|
// especially if Zba extension is enabled. Disabling may save area.
|
||||||
parameter FAST_BRANCHCMP = 1,
|
parameter FAST_BRANCHCMP = 1,
|
||||||
|
|
||||||
|
// RESET_REGFILE: whether to support reset of the general purpose registers.
|
||||||
|
// There are around 1k bits in the register file, so the reset can be
|
||||||
|
// disabled e.g. to permit block-RAM inference on FPGA.
|
||||||
|
parameter RESET_REGFILE = 1,
|
||||||
|
|
||||||
// MTVEC_WMASK: Mask of which bits in MTVEC are modifiable. Save gates by
|
// MTVEC_WMASK: Mask of which bits in MTVEC are modifiable. Save gates by
|
||||||
// making trap vector base partly fixed (legal, as it's WARL).
|
// making trap vector base partly fixed (legal, as it's WARL).
|
||||||
//
|
//
|
||||||
|
|
|
@ -33,5 +33,6 @@
|
||||||
.MULH_FAST (MULH_FAST),
|
.MULH_FAST (MULH_FAST),
|
||||||
.FAST_BRANCHCMP (FAST_BRANCHCMP),
|
.FAST_BRANCHCMP (FAST_BRANCHCMP),
|
||||||
.MTVEC_WMASK (MTVEC_WMASK),
|
.MTVEC_WMASK (MTVEC_WMASK),
|
||||||
|
.RESET_REGFILE (RESET_REGFILE),
|
||||||
.W_ADDR (W_ADDR),
|
.W_ADDR (W_ADDR),
|
||||||
.W_DATA (W_DATA)
|
.W_DATA (W_DATA)
|
||||||
|
|
|
@ -1032,19 +1032,10 @@ end
|
||||||
|
|
||||||
|
|
||||||
hazard3_regfile_1w2r #(
|
hazard3_regfile_1w2r #(
|
||||||
.FAKE_DUALPORT(0),
|
.RESET_REGS (RESET_REGFILE),
|
||||||
`ifdef SIM
|
.N_REGS (32),
|
||||||
.RESET_REGS(1),
|
.W_DATA (W_DATA)
|
||||||
`elsif FORMAL
|
) regs (
|
||||||
.RESET_REGS(1),
|
|
||||||
`elsif FPGA
|
|
||||||
.RESET_REGS(0),
|
|
||||||
`else
|
|
||||||
.RESET_REGS(1),
|
|
||||||
`endif
|
|
||||||
.N_REGS(32),
|
|
||||||
.W_DATA(W_DATA)
|
|
||||||
) inst_regfile_1w2r (
|
|
||||||
.clk (clk),
|
.clk (clk),
|
||||||
.rst_n (rst_n),
|
.rst_n (rst_n),
|
||||||
// On downstream stall, we feed D's addresses back into regfile
|
// On downstream stall, we feed D's addresses back into regfile
|
||||||
|
|
Loading…
Reference in New Issue