Skip to content

[BUG] Incorrect interrupt cause encoding in RV64 bit due to 32-bit literal in INTERRUPTS definition

Is there an existing CVA6 bug for this?

  • I have searched the existing bug issues

Bug Description

In cva6.sv, the INTERRUPTS localparam uses the expression (1 << (CVA6Cfg.XLEN - 1)) to set the MSB of the interrupt cause. However, under Synopsys VCS, the literal 1 is treated as a 32-bit value. When CVA6Cfg.XLEN is 64, the left shift operation overflows, resulting in an incorrect encoding of the interrupt cause. (All interrupts cannot be accepted by cva6)

Suggested fix: Use an explicit XLEN-sized constant to avoid overflow: (CVA6Cfg.XLEN'(1) << (CVA6Cfg.XLEN - 1))

This ensures the MSB is correctly set for both RV32 and RV64.