Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ add optional CPU clock gating #775

Merged
merged 15 commits into from Jan 27, 2024
Merged

✨ add optional CPU clock gating #775

merged 15 commits into from Jan 27, 2024

Conversation

stnolting
Copy link
Owner

@stnolting stnolting commented Jan 26, 2024

This PR adds an optional clock gating mechanism to the processor. When enabled, the clock of the CPU core is shut down during sleep mode to reduce power consumption. This concept was developed/proposed by @mikaelsky in #772.

  • add new top generic 'CLOCK_GATING_EN', default "false"
  • add new VHDL module neorv32_clockgate.vhd that implements the clock switch

A secondary, always-on clock is added to the CPU. This additional clock is used to keep the interrupt buffer logic active while the rest of the CPU is switched off. Any (enabled) interrupt request (including a debug halt request) will make the CPU leave sleep mode.

The CPU's sleep signal is set high only when

  • the execution stage has halted (no pending memory access in progress) and
  • the instruction fetch stage is halted (no pending instruction fetch in progress) and
  • there is no (enabled) pending interrupt request.

Right now, just the CPU core is turned off during sleep mode. But I think it might be possible to shut down the caches and bus switch as well. If the DMA is not required the entire interconnect could be shut down as well.

clk_i: main clock, can be switched off
clk_aux_i: always-on clock
- SYSINFO->SOC bit 7
- some minor VHDL clean-ups (remove use of custom bool-to-std_ulogic function)
- minor code clean-ups (remove private print true/false function)
default = false; update version ID
- add new CLOCK_GATING_EN generic
- simplify instruction fetch engine: remove PARKED state, use the IPB FIFO level to check if the instruction fetch has halted
- make sure halt request signal is not registered by the switched-off clock
- add registered sleep mode signal
@stnolting stnolting added enhancement New feature or request HW hardware-related labels Jan 26, 2024
@stnolting stnolting self-assigned this Jan 26, 2024
- add CPU's clk_aux_i port
- add new processor generic CLOCK_GATING_EN
- refine section "sleep mode"
@stnolting stnolting marked this pull request as ready for review January 26, 2024 19:28
@stnolting stnolting added the experimental Experimental feature label Jan 26, 2024
@stnolting stnolting merged commit d625222 into main Jan 27, 2024
8 checks passed
@stnolting stnolting deleted the clock_gating branch January 27, 2024 12:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request experimental Experimental feature HW hardware-related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant