Skip to content

Commit

Permalink
[pwrmgr] Synchronize lc signals
Browse files Browse the repository at this point in the history
Partially addresses #19051.

Signed-off-by: Michael Schaffner <[email protected]>
  • Loading branch information
msfschaffner committed Jul 10, 2023
1 parent e47df29 commit 143faa6
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 38 deletions.
4 changes: 2 additions & 2 deletions hw/ip/pwrmgr/dv/sva/pwrmgr_bind.sv
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ module pwrmgr_bind;
.fast_fsm_invalid(u_fsm.u_state_regs.unused_err_o),
.rom_intg_chk_dis(u_fsm.rom_intg_chk_dis),
.rom_intg_chk_ok(prim_mubi_pkg::mubi4_and_hi(u_fsm.rom_intg_chk_done, u_fsm.rom_intg_chk_good)),
.lc_dft_en_i,
.lc_hw_debug_en_i,
.lc_dft_en_i(u_fsm.lc_hw_debug_en_i),
.lc_hw_debug_en_i(u_fsm.lc_hw_debug_en_i),
.main_pd_ni(u_slow_fsm.main_pd_ni),
.rom_ctrl_done_i(u_fsm.rom_ctrl_done_i),
.rom_ctrl_good_i(u_fsm.rom_ctrl_good_i)
Expand Down
64 changes: 30 additions & 34 deletions hw/ip/pwrmgr/dv/sva/pwrmgr_sec_cm_checker_assert.sv
Original file line number Diff line number Diff line change
Expand Up @@ -38,46 +38,42 @@ module pwrmgr_sec_cm_checker_assert
always_comb esc_reset_or_disable = !rst_esc_ni || disable_sva;
always_comb slow_reset_or_disable = !rst_slow_ni || disable_sva;

`define ASYNC_ASSERT(_name, _prop, _sigs, _rst) \
_name: assert property (@(_sigs) disable iff ((_rst) !== '0) (_prop)) \
else begin \
`ASSERT_ERROR(_name) \
end

// Assuming lc_dft_en_i and lc_hw_debug_en_i are asynchronous
// rom_intg_chk_dis only allows two states.
`ASYNC_ASSERT(RomIntgChkDisTrue_A,
rom_intg_chk_dis == prim_mubi_pkg::MuBi4True |->
(lc_dft_en_i == lc_ctrl_pkg::On && lc_hw_debug_en_i == lc_ctrl_pkg::On),
(rom_intg_chk_dis | lc_dft_en_i | lc_hw_debug_en_i), reset_or_disable)
// Note that lc_dft_en_i and lc_hw_debug_en_i are already synchronized to clk_i at this
// hierarchy level.
`ASSERT(RomIntgChkDisTrue_A,
rom_intg_chk_dis == prim_mubi_pkg::MuBi4True |->
(lc_dft_en_i == lc_ctrl_pkg::On &&
lc_hw_debug_en_i == lc_ctrl_pkg::On),
clk_i,
reset_or_disable)

`ASYNC_ASSERT(RomIntgChkDisFalse_A,
rom_intg_chk_dis == prim_mubi_pkg::MuBi4False |->
(lc_dft_en_i !== lc_ctrl_pkg::On || lc_hw_debug_en_i !== lc_ctrl_pkg::On),
(rom_intg_chk_dis | lc_dft_en_i | lc_hw_debug_en_i), reset_or_disable)
`ASSERT(RomIntgChkDisFalse_A,
rom_intg_chk_dis == prim_mubi_pkg::MuBi4False |->
(lc_dft_en_i !== lc_ctrl_pkg::On ||
lc_hw_debug_en_i !== lc_ctrl_pkg::On),
clk_i,
reset_or_disable)

// check rom_intg_chk_ok
// rom_ctrl_i go through cdc. So use synchronous assertion.
// rom_intg_chk_ok can be any values.
`ASYNC_ASSERT(RomIntgChkOkTrue_A,
rom_intg_chk_ok == prim_mubi_pkg::MuBi4True |->
(rom_intg_chk_dis == prim_mubi_pkg::MuBi4True &&
rom_ctrl_done_i == prim_mubi_pkg::MuBi4True) ||
(rom_ctrl_done_i == prim_mubi_pkg::MuBi4True &&
rom_ctrl_good_i == prim_mubi_pkg::MuBi4True),
(rom_intg_chk_ok | rom_intg_chk_dis | rom_ctrl_done_i | rom_ctrl_good_i),
reset_or_disable)

`ASYNC_ASSERT(RomIntgChkOkFalse_A,
rom_intg_chk_ok != prim_mubi_pkg::MuBi4True |->
(rom_intg_chk_dis == prim_mubi_pkg::MuBi4False ||
rom_ctrl_done_i != prim_mubi_pkg::MuBi4True) &&
(rom_ctrl_done_i != prim_mubi_pkg::MuBi4True ||
rom_ctrl_good_i != prim_mubi_pkg::MuBi4True),
(rom_intg_chk_ok | rom_intg_chk_dis | rom_ctrl_done_i | rom_ctrl_good_i),
reset_or_disable)
`ASSERT(RomIntgChkOkTrue_A,
rom_intg_chk_ok == prim_mubi_pkg::MuBi4True |->
(rom_intg_chk_dis == prim_mubi_pkg::MuBi4True &&
rom_ctrl_done_i == prim_mubi_pkg::MuBi4True) ||
(rom_ctrl_done_i == prim_mubi_pkg::MuBi4True &&
rom_ctrl_good_i == prim_mubi_pkg::MuBi4True),
clk_i,
reset_or_disable)

`undef ASYNC_ASSERT
`ASSERT(RomIntgChkOkFalse_A,
rom_intg_chk_ok != prim_mubi_pkg::MuBi4True |->
(rom_intg_chk_dis == prim_mubi_pkg::MuBi4False ||
rom_ctrl_done_i != prim_mubi_pkg::MuBi4True) &&
(rom_ctrl_done_i != prim_mubi_pkg::MuBi4True ||
rom_ctrl_good_i != prim_mubi_pkg::MuBi4True),
clk_i,
reset_or_disable)

// pwr_rst_o.rstreqs checker
// sec_cm_esc_rx_clk_bkgn_chk, sec_cm_esc_rx_clk_local_esc
Expand Down
1 change: 1 addition & 0 deletions hw/ip/pwrmgr/pwrmgr.core
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ filesets:
depend:
- lowrisc:ip:tlul
- lowrisc:prim:esc
- lowrisc:prim:lc_sync
- lowrisc:prim:lc_sender
- lowrisc:prim:all
- lowrisc:ip:rom_ctrl_pkg
Expand Down
19 changes: 17 additions & 2 deletions hw/ip/pwrmgr/rtl/pwrmgr.sv
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,21 @@ module pwrmgr
.ast_o (pwr_ast_o)
);

lc_ctrl_pkg::lc_tx_t lc_dft_en;
prim_lc_sync u_prim_lc_sync_dft_en (
.clk_i,
.rst_ni,
.lc_en_i(lc_dft_en_i),
.lc_en_o({lc_dft_en})
);

lc_ctrl_pkg::lc_tx_t lc_hw_debug_en;
prim_lc_sync u_prim_lc_sync_hw_debug_en (
.clk_i,
.rst_ni,
.lc_en_i(lc_hw_debug_en_i),
.lc_en_o({lc_hw_debug_en})
);

////////////////////////////
/// clk FSM
Expand Down Expand Up @@ -590,8 +605,8 @@ module pwrmgr
.lc_init_o (pwr_lc_o.lc_init),
.lc_done_i (pwr_lc_i.lc_done),
.lc_idle_i (pwr_lc_i.lc_idle),
.lc_dft_en_i,
.lc_hw_debug_en_i,
.lc_dft_en_i (lc_dft_en),
.lc_hw_debug_en_i (lc_hw_debug_en),

// flash
.flash_idle_i (flash_rsp.flash_idle),
Expand Down

0 comments on commit 143faa6

Please sign in to comment.