cv32e40s icon indicating copy to clipboard operation
cv32e40s copied to clipboard

WFE/WFI in wb + pending irq can cause interrupt to be missed

Open silabs-hfegran opened this issue 2 years ago • 6 comments

WFE/WFI in wb + IRQ can cause interrupt to be missed

An wfi/wfe in wb while there is a pending and enabled interrupt for one cycle causes interrupt to be missed. In the example below the second pending and enabled interrupt wakes up the core and is taken.

Steps to Reproduce

  1. git hash: df6c2cd793b4
  2. Assertion:
    property p_higher_lvl_than_mintthresh_th_can_preempt;
            clic.irq
        ##1 ($past(clic.priv) == current_priv_mode)
        &&  ($past(clic.level) > effective_clic_level)
        &&  mstatus_fields.mie
        &&  is_interrupt_allowed == 1'b1
      |->
            irq_ack
      or
            rvfi_valid[->1:2]
        ##0 rvfi_dbg_mode
      or
            rvfi_valid[->1:2]
        ##0 rvfi_intr.exception
      or
            rvfi_valid[->1:2]
        ##0 rvfi_trap.exception
      or
            rvfi_valid[->1:2]
        ##0 is_cause_nmi
      ;
    endproperty : p_higher_lvl_than_mintthresh_th_can_preempt

    a_higher_lvl_than_mintthresh_th_can_preempt: assert property(p_higher_lvl_than_mintthresh_th_can_preempt)
    else
      `uvm_error(info_tag,
        $sformatf("Higher level than mintthresh should be able to interrupt"));

  1. Logfile and/or wave-dump info (screen shots can be useful) image

silabs-hfegran avatar Feb 06 '23 08:02 silabs-hfegran

Not an RTL bug, but the interrupt_allowed signal should be fixed nonetheless to have a more logical behavior for 'multi-op' WFE/WFI. Should be SEC clean, but will aid writing assertions.

Silabs-ArjanB avatar Feb 13 '23 07:02 Silabs-ArjanB

Resolved with https://github.com/openhwgroup/cv32e40x/pull/795

Silabs-ArjanB avatar Feb 28 '23 08:02 Silabs-ArjanB

The merge from CV32E40X will come shortly.

silabs-oysteink avatar Feb 28 '23 08:02 silabs-oysteink

@silabs-hfegran Can you please close this if it has been fixed?

Silabs-ArjanB avatar Mar 13 '23 07:03 Silabs-ArjanB

@Silabs-ArjanB Will close this issue when verified

silabs-hfegran avatar Mar 13 '23 09:03 silabs-hfegran

Is this verified yet?

silabs-oysteink avatar Apr 13 '23 08:04 silabs-oysteink