Skip to content

Commit

Permalink
[pwrmgr] standardize clocking controls
Browse files Browse the repository at this point in the history
- disable clocks whenever main power is turned off.
- similar to usb

Signed-off-by: Timothy Chen <[email protected]>
  • Loading branch information
Timothy Chen committed Jan 13, 2022
1 parent e41a401 commit 7df0097
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion hw/ip/pwrmgr/dv/sva/pwrmgr_clock_enables_sva_if.sv
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,6 @@ interface pwrmgr_clock_enables_sva_if (
`ASSERT(CoreClkPwrDown_A, transitionDown_S |=> core_clk_en == core_clk_en_i, clk_i,
reset_or_disable)
`ASSERT(IoClkPwrDown_A, transitionDown_S |=> io_clk_en == io_clk_en_i, clk_i, reset_or_disable)
`ASSERT(UsbClkPwrDown_A, transitionDown_S |=> usb_clk_en == main_pd_ni & usb_clk_en_lp_i, clk_i,
`ASSERT(UsbClkPwrDown_A, transitionDown_S |=> usb_clk_en == (main_pd_ni & usb_clk_en_lp_i), clk_i,
reset_or_disable)
endinterface
14 changes: 10 additions & 4 deletions hw/ip/pwrmgr/rtl/pwrmgr_slow_fsm.sv
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,16 @@ module pwrmgr_slow_fsm import pwrmgr_pkg::*; (
logic usb_clk_en_lp;
assign usb_clk_en_lp = main_pd_ni & usb_clk_en_lp_i;

// all other clocks are also diasbled when power is turned off.
logic core_clk_en;
logic io_clk_en;
assign core_clk_en = main_pd_ni & core_clk_en_i;
assign io_clk_en = main_pd_ni & io_clk_en_i;

// if clocks were configured to turn off, make sure val is invalid
// if clocks were not configured to turn off, just bypass the check
assign all_clks_invalid = (core_clk_en_i | ~ast_i.core_clk_val) &
(io_clk_en_i | ~ast_i.io_clk_val) &
assign all_clks_invalid = (core_clk_en | ~ast_i.core_clk_val) &
(io_clk_en | ~ast_i.io_clk_val) &
(usb_clk_en_lp | ~ast_i.usb_clk_val);

always_ff @(posedge clk_i or negedge rst_ni) begin
Expand Down Expand Up @@ -223,8 +229,8 @@ module pwrmgr_slow_fsm import pwrmgr_pkg::*; (
end

SlowPwrStateClocksOff: begin
core_clk_en_d = core_clk_en_i;
io_clk_en_d = io_clk_en_i;
core_clk_en_d = core_clk_en;
io_clk_en_d = io_clk_en;
usb_clk_en_d = usb_clk_en_lp;

if (all_clks_invalid) begin
Expand Down

0 comments on commit 7df0097

Please sign in to comment.