mirror of
https://github.com/stnolting/neorv32.git
synced 2025-04-24 06:07:52 -04:00
[rtl] cpu: remove clock gating option
This commit is contained in:
parent
96bee9ec3d
commit
f33db178ce
1 changed files with 62 additions and 86 deletions
|
@ -55,7 +55,6 @@ entity neorv32_cpu is
|
|||
RISCV_ISA_Sdtrig : boolean; -- implement trigger module extension
|
||||
RISCV_ISA_Smpmp : boolean; -- implement physical memory protection
|
||||
-- Tuning Options --
|
||||
CPU_CLOCK_GATING_EN : boolean; -- enable clock gating when in sleep mode
|
||||
CPU_FAST_MUL_EN : boolean; -- use DSPs for M extension's multiplier
|
||||
CPU_FAST_SHIFT_EN : boolean; -- use barrel shifter for shift operations
|
||||
CPU_RF_HW_RST_EN : boolean; -- implement full hardware reset for register file
|
||||
|
@ -109,7 +108,6 @@ architecture neorv32_cpu_rtl of neorv32_cpu is
|
|||
|
||||
-- local signals --
|
||||
signal ctrl : ctrl_bus_t; -- main control bus
|
||||
signal clk_gated : std_ulogic; -- switchable clock (clock gating)
|
||||
signal frontend : if_bus_t; -- instruction-fetch interface
|
||||
signal rf_wdata : std_ulogic_vector(XLEN-1 downto 0); -- register file write data
|
||||
signal rs1 : std_ulogic_vector(XLEN-1 downto 0); -- source register 1
|
||||
|
@ -174,10 +172,9 @@ begin
|
|||
|
||||
-- CPU tuning options --
|
||||
assert false report "[NEORV32] CPU tuning options: " &
|
||||
cond_sel_string_f(CPU_CLOCK_GATING_EN, "clock_gating ", "") &
|
||||
cond_sel_string_f(CPU_FAST_MUL_EN, "fast_mul ", "") &
|
||||
cond_sel_string_f(CPU_FAST_SHIFT_EN, "fast_shift ", "") &
|
||||
cond_sel_string_f(CPU_RF_HW_RST_EN, "rf_hw_rst ", "")
|
||||
cond_sel_string_f(CPU_FAST_MUL_EN, "fast_mul ", "") &
|
||||
cond_sel_string_f(CPU_FAST_SHIFT_EN, "fast_shift ", "") &
|
||||
cond_sel_string_f(CPU_RF_HW_RST_EN, "rf_hw_rst ", "")
|
||||
severity note;
|
||||
|
||||
-- simulation notifier --
|
||||
|
@ -186,25 +183,6 @@ begin
|
|||
end generate; -- /hello_neorv32
|
||||
|
||||
|
||||
-- Clock Gating ---------------------------------------------------------------------------
|
||||
-- -------------------------------------------------------------------------------------------
|
||||
neorv32_cpu_clockgate_enabled:
|
||||
if CPU_CLOCK_GATING_EN generate
|
||||
neorv32_cpu_clockgate_inst: entity neorv32.neorv32_clockgate
|
||||
port map (
|
||||
clk_i => clk_i,
|
||||
rstn_i => rstn_i,
|
||||
halt_i => ctrl.cpu_sleep,
|
||||
clk_o => clk_gated
|
||||
);
|
||||
end generate;
|
||||
|
||||
neorv32_cpu_clockgate_disabled:
|
||||
if not CPU_CLOCK_GATING_EN generate
|
||||
clk_gated <= clk_i;
|
||||
end generate;
|
||||
|
||||
|
||||
-- Front-End (Instruction Fetch) ----------------------------------------------------------
|
||||
-- -------------------------------------------------------------------------------------------
|
||||
neorv32_cpu_frontend_inst: entity neorv32.neorv32_cpu_frontend
|
||||
|
@ -213,7 +191,7 @@ begin
|
|||
)
|
||||
port map (
|
||||
-- global control --
|
||||
clk_i => clk_gated, -- global clock, rising edge
|
||||
clk_i => clk_i, -- global clock, rising edge
|
||||
rstn_i => rstn_i, -- global reset, low-active, async
|
||||
ctrl_i => ctrl, -- main control bus
|
||||
-- instruction fetch interface --
|
||||
|
@ -229,52 +207,50 @@ begin
|
|||
neorv32_cpu_control_inst: entity neorv32.neorv32_cpu_control
|
||||
generic map (
|
||||
-- General --
|
||||
HART_ID => HART_ID, -- hardware thread ID
|
||||
BOOT_ADDR => BOOT_ADDR, -- cpu boot address
|
||||
DEBUG_PARK_ADDR => DEBUG_PARK_ADDR, -- cpu debug mode parking loop entry address
|
||||
DEBUG_EXC_ADDR => DEBUG_EXC_ADDR, -- cpu debug mode exception entry address
|
||||
HART_ID => HART_ID, -- hardware thread ID
|
||||
BOOT_ADDR => BOOT_ADDR, -- cpu boot address
|
||||
DEBUG_PARK_ADDR => DEBUG_PARK_ADDR, -- cpu debug mode parking loop entry address
|
||||
DEBUG_EXC_ADDR => DEBUG_EXC_ADDR, -- cpu debug mode exception entry address
|
||||
-- RISC-V ISA Extensions --
|
||||
RISCV_ISA_A => riscv_a_c, -- implement atomic memory operations extension
|
||||
RISCV_ISA_B => riscv_b_c, -- implement bit-manipulation extension
|
||||
RISCV_ISA_C => RISCV_ISA_C, -- implement compressed extension
|
||||
RISCV_ISA_E => RISCV_ISA_E, -- implement embedded RF extension
|
||||
RISCV_ISA_M => RISCV_ISA_M, -- implement mul/div extension
|
||||
RISCV_ISA_U => RISCV_ISA_U, -- implement user mode extension
|
||||
RISCV_ISA_Zaamo => RISCV_ISA_Zaamo, -- implement atomic read-modify-write operations extension
|
||||
RISCV_ISA_Zalrsc => RISCV_ISA_Zalrsc, -- implement atomic reservation-set operations extension
|
||||
RISCV_ISA_Zba => RISCV_ISA_Zba, -- implement shifted-add bit-manipulation extension
|
||||
RISCV_ISA_Zbb => RISCV_ISA_Zbb, -- implement basic bit-manipulation extension
|
||||
RISCV_ISA_Zbkb => RISCV_ISA_Zbkb, -- implement bit-manipulation instructions for cryptography
|
||||
RISCV_ISA_Zbkc => RISCV_ISA_Zbkc, -- implement carry-less multiplication instructions
|
||||
RISCV_ISA_Zbkx => RISCV_ISA_Zbkx, -- implement cryptography crossbar permutation extension
|
||||
RISCV_ISA_Zbs => RISCV_ISA_Zbs, -- implement single-bit bit-manipulation extension
|
||||
RISCV_ISA_Zfinx => RISCV_ISA_Zfinx, -- implement 32-bit floating-point extension
|
||||
RISCV_ISA_Zicntr => RISCV_ISA_Zicntr, -- implement base counters
|
||||
RISCV_ISA_Zicond => RISCV_ISA_Zicond, -- implement integer conditional operations
|
||||
RISCV_ISA_Zihpm => RISCV_ISA_Zihpm, -- implement hardware performance monitors
|
||||
RISCV_ISA_Zkn => riscv_zkn_c, -- NIST algorithm suite available
|
||||
RISCV_ISA_Zknd => RISCV_ISA_Zknd, -- implement cryptography NIST AES decryption extension
|
||||
RISCV_ISA_Zkne => RISCV_ISA_Zkne, -- implement cryptography NIST AES encryption extension
|
||||
RISCV_ISA_Zknh => RISCV_ISA_Zknh, -- implement cryptography NIST hash extension
|
||||
RISCV_ISA_Zks => riscv_zks_c, -- ShangMi algorithm suite available
|
||||
RISCV_ISA_Zksed => RISCV_ISA_Zksed, -- implement ShangMi block cipher extension
|
||||
RISCV_ISA_Zksh => RISCV_ISA_Zksh, -- implement ShangMi hash extension
|
||||
RISCV_ISA_Zkt => riscv_zkt_c, -- data-independent execution time available (for cryptographic operations)
|
||||
RISCV_ISA_Zmmul => RISCV_ISA_Zmmul, -- implement multiply-only M sub-extension
|
||||
RISCV_ISA_Zxcfu => RISCV_ISA_Zxcfu, -- implement custom (instr.) functions unit
|
||||
RISCV_ISA_Sdext => RISCV_ISA_Sdext, -- implement external debug mode extension
|
||||
RISCV_ISA_Sdtrig => RISCV_ISA_Sdtrig, -- implement trigger module extension
|
||||
RISCV_ISA_Smpmp => RISCV_ISA_Smpmp, -- implement physical memory protection
|
||||
RISCV_ISA_A => riscv_a_c, -- implement atomic memory operations extension
|
||||
RISCV_ISA_B => riscv_b_c, -- implement bit-manipulation extension
|
||||
RISCV_ISA_C => RISCV_ISA_C, -- implement compressed extension
|
||||
RISCV_ISA_E => RISCV_ISA_E, -- implement embedded RF extension
|
||||
RISCV_ISA_M => RISCV_ISA_M, -- implement mul/div extension
|
||||
RISCV_ISA_U => RISCV_ISA_U, -- implement user mode extension
|
||||
RISCV_ISA_Zaamo => RISCV_ISA_Zaamo, -- implement atomic read-modify-write operations extension
|
||||
RISCV_ISA_Zalrsc => RISCV_ISA_Zalrsc, -- implement atomic reservation-set operations extension
|
||||
RISCV_ISA_Zba => RISCV_ISA_Zba, -- implement shifted-add bit-manipulation extension
|
||||
RISCV_ISA_Zbb => RISCV_ISA_Zbb, -- implement basic bit-manipulation extension
|
||||
RISCV_ISA_Zbkb => RISCV_ISA_Zbkb, -- implement bit-manipulation instructions for cryptography
|
||||
RISCV_ISA_Zbkc => RISCV_ISA_Zbkc, -- implement carry-less multiplication instructions
|
||||
RISCV_ISA_Zbkx => RISCV_ISA_Zbkx, -- implement cryptography crossbar permutation extension
|
||||
RISCV_ISA_Zbs => RISCV_ISA_Zbs, -- implement single-bit bit-manipulation extension
|
||||
RISCV_ISA_Zfinx => RISCV_ISA_Zfinx, -- implement 32-bit floating-point extension
|
||||
RISCV_ISA_Zicntr => RISCV_ISA_Zicntr, -- implement base counters
|
||||
RISCV_ISA_Zicond => RISCV_ISA_Zicond, -- implement integer conditional operations
|
||||
RISCV_ISA_Zihpm => RISCV_ISA_Zihpm, -- implement hardware performance monitors
|
||||
RISCV_ISA_Zkn => riscv_zkn_c, -- NIST algorithm suite available
|
||||
RISCV_ISA_Zknd => RISCV_ISA_Zknd, -- implement cryptography NIST AES decryption extension
|
||||
RISCV_ISA_Zkne => RISCV_ISA_Zkne, -- implement cryptography NIST AES encryption extension
|
||||
RISCV_ISA_Zknh => RISCV_ISA_Zknh, -- implement cryptography NIST hash extension
|
||||
RISCV_ISA_Zks => riscv_zks_c, -- ShangMi algorithm suite available
|
||||
RISCV_ISA_Zksed => RISCV_ISA_Zksed, -- implement ShangMi block cipher extension
|
||||
RISCV_ISA_Zksh => RISCV_ISA_Zksh, -- implement ShangMi hash extension
|
||||
RISCV_ISA_Zkt => riscv_zkt_c, -- data-independent execution time available (for cryptographic operations)
|
||||
RISCV_ISA_Zmmul => RISCV_ISA_Zmmul, -- implement multiply-only M sub-extension
|
||||
RISCV_ISA_Zxcfu => RISCV_ISA_Zxcfu, -- implement custom (instr.) functions unit
|
||||
RISCV_ISA_Sdext => RISCV_ISA_Sdext, -- implement external debug mode extension
|
||||
RISCV_ISA_Sdtrig => RISCV_ISA_Sdtrig, -- implement trigger module extension
|
||||
RISCV_ISA_Smpmp => RISCV_ISA_Smpmp, -- implement physical memory protection
|
||||
-- Tuning Options --
|
||||
CPU_CLOCK_GATING_EN => CPU_CLOCK_GATING_EN, -- enable clock gating when in sleep mode
|
||||
CPU_FAST_MUL_EN => CPU_FAST_MUL_EN, -- use DSPs for M extension's multiplier
|
||||
CPU_FAST_SHIFT_EN => CPU_FAST_SHIFT_EN, -- use barrel shifter for shift operations
|
||||
CPU_RF_HW_RST_EN => CPU_RF_HW_RST_EN -- implement full hardware reset for register file
|
||||
CPU_FAST_MUL_EN => CPU_FAST_MUL_EN, -- use DSPs for M extension's multiplier
|
||||
CPU_FAST_SHIFT_EN => CPU_FAST_SHIFT_EN, -- use barrel shifter for shift operations
|
||||
CPU_RF_HW_RST_EN => CPU_RF_HW_RST_EN -- implement full hardware reset for register file
|
||||
)
|
||||
port map (
|
||||
-- global control --
|
||||
clk_i => clk_gated, -- global clock, rising edge
|
||||
clk_aux_i => clk_i, -- always-on clock, rising edge
|
||||
clk_i => clk_i, -- global clock, rising edge
|
||||
rstn_i => rstn_i, -- global reset, low-active, async
|
||||
ctrl_o => ctrl, -- main control bus
|
||||
-- instruction fetch (front-end) interface --
|
||||
|
@ -320,11 +296,11 @@ begin
|
|||
)
|
||||
port map (
|
||||
-- global control --
|
||||
clk_i => clk_gated, -- global clock, rising edge
|
||||
rstn_i => rstn_i, -- global reset, low-active, async
|
||||
ctrl_i => ctrl, -- main control bus
|
||||
clk_i => clk_i, -- global clock, rising edge
|
||||
rstn_i => rstn_i, -- global reset, low-active, async
|
||||
ctrl_i => ctrl, -- main control bus
|
||||
-- read back --
|
||||
rdata_o => xcsr_cnt -- read data
|
||||
rdata_o => xcsr_cnt -- read data
|
||||
);
|
||||
end generate;
|
||||
|
||||
|
@ -344,14 +320,14 @@ begin
|
|||
)
|
||||
port map (
|
||||
-- global control --
|
||||
clk_i => clk_gated, -- global clock, rising edge
|
||||
rstn_i => rstn_i, -- global reset, low-active, async
|
||||
ctrl_i => ctrl, -- main control bus
|
||||
clk_i => clk_i, -- global clock, rising edge
|
||||
rstn_i => rstn_i, -- global reset, low-active, async
|
||||
ctrl_i => ctrl, -- main control bus
|
||||
-- operands --
|
||||
rd_i => rf_wdata, -- destination operand rd
|
||||
rs1_o => rs1, -- source operand rs1
|
||||
rs2_o => rs2, -- source operand rs2
|
||||
rs3_o => rs3 -- source operand rs3
|
||||
rd_i => rf_wdata, -- destination operand rd
|
||||
rs1_o => rs1, -- source operand rs1
|
||||
rs2_o => rs2, -- source operand rs2
|
||||
rs3_o => rs3 -- source operand rs3
|
||||
);
|
||||
|
||||
-- all buses are zero unless there is an according operation --
|
||||
|
@ -385,7 +361,7 @@ begin
|
|||
)
|
||||
port map (
|
||||
-- global control --
|
||||
clk_i => clk_gated, -- global clock, rising edge
|
||||
clk_i => clk_i, -- global clock, rising edge
|
||||
rstn_i => rstn_i, -- global reset, low-active, async
|
||||
ctrl_i => ctrl, -- main control bus
|
||||
-- data input --
|
||||
|
@ -407,7 +383,7 @@ begin
|
|||
neorv32_cpu_lsu_inst: entity neorv32.neorv32_cpu_lsu
|
||||
port map (
|
||||
-- global control --
|
||||
clk_i => clk_gated, -- global clock, rising edge
|
||||
clk_i => clk_i, -- global clock, rising edge
|
||||
rstn_i => rstn_i, -- global reset, low-active, async
|
||||
ctrl_i => ctrl, -- main control bus
|
||||
-- cpu data access interface --
|
||||
|
@ -437,15 +413,15 @@ begin
|
|||
)
|
||||
port map (
|
||||
-- global control --
|
||||
clk_i => clk_gated, -- global clock, rising edge
|
||||
rstn_i => rstn_i, -- global reset, low-active, async
|
||||
ctrl_i => ctrl, -- main control bus
|
||||
clk_i => clk_i, -- global clock, rising edge
|
||||
rstn_i => rstn_i, -- global reset, low-active, async
|
||||
ctrl_i => ctrl, -- main control bus
|
||||
-- CSR interface --
|
||||
csr_o => xcsr_pmp, -- read data
|
||||
csr_o => xcsr_pmp, -- read data
|
||||
-- address input --
|
||||
addr_ls_i => alu_add, -- load/store address
|
||||
addr_ls_i => alu_add, -- load/store address
|
||||
-- access error --
|
||||
fault_o => pmp_fault -- permission violation
|
||||
fault_o => pmp_fault -- permission violation
|
||||
);
|
||||
end generate;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue