diff --git a/src/main/scala/devices/tilelink/Plic.scala b/src/main/scala/devices/tilelink/Plic.scala index ee915e1d..2c056bb6 100644 --- a/src/main/scala/devices/tilelink/Plic.scala +++ b/src/main/scala/devices/tilelink/Plic.scala @@ -12,6 +12,8 @@ import freechips.rocketchip.tile.XLen import freechips.rocketchip.tilelink._ import freechips.rocketchip.interrupts._ import freechips.rocketchip.util._ +import freechips.rocketchip.util.property._ +import chisel3.internal.sourceinfo.SourceInfo import scala.math.min class GatewayPLICIO extends Bundle { @@ -231,6 +233,25 @@ class TLPLIC(params: PLICParams)(implicit p: Parameters) extends LazyModule pending(0) := false for (e <- enables) e(0) := false + + if (nDevices >= 2) { + val claimed = claimer(0) && maxDevs(0) > 0 + val completed = completer(0) + cover(claimed && RegEnable(claimed, false.B, claimed || completed), "TWO_CLAIMS", "two claims with no intervening complete") + cover(completed && RegEnable(completed, false.B, claimed || completed), "TWO_COMPLETES", "two completes with no intervening claim") + + val ep = enables(0).asUInt & pending.asUInt + val ep2 = RegNext(ep) + val diff = ep & ~ep2 + cover((diff & (diff - 1)) =/= 0, "TWO_INTS_PENDING", "two enabled interrupts became pending on same cycle") + + if (nPriorities > 0) + ccover(maxDevs(0) > (UInt(1) << priority(0).getWidth) && maxDevs(0) <= Cat(UInt(1), threshold(0)), + "THRESHOLD", "interrupt pending but less than threshold") + } + + def ccover(cond: Bool, label: String, desc: String)(implicit sourceInfo: SourceInfo) = + cover(cond, s"PLIC_$label", "Interrupts;;" + desc) } } diff --git a/src/main/scala/tile/FPU.scala b/src/main/scala/tile/FPU.scala index 8b41462d..17bd316b 100644 --- a/src/main/scala/tile/FPU.scala +++ b/src/main/scala/tile/FPU.scala @@ -823,6 +823,7 @@ class FPU(cfg: FPUParams)(implicit p: Parameters) extends FPUModule()(p) { io.sboard_set := wb_reg_valid && !wb_cp_valid && Reg(next=useScoreboard(_._1.cond(mem_ctrl)) || mem_ctrl.div || mem_ctrl.sqrt) io.sboard_clr := !wb_cp_valid && (divSqrt_wen || (wen(0) && useScoreboard(x => wbInfo(0).pipeid === UInt(x._2)))) io.sboard_clra := waddr + ccover(io.sboard_clr && load_wb, "DUAL_WRITEBACK", "load and FMA writeback on same cycle") // we don't currently support round-max-magnitude (rm=4) io.illegal_rm := io.inst(14,12).isOneOf(5, 6) || io.inst(14,12) === 7 && io.fcsr_rm >= 5