Merge pull request #1205 from freechipsproject/fpu-cover
Add some covers for VM and FPU
This commit is contained in:
commit
94d2edceb9
@ -279,6 +279,15 @@ class PTW(n: Int)(implicit edge: TLEdgeOut, p: Parameters) extends CoreModule()(
|
|||||||
count := pgLevels-1
|
count := pgLevels-1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (i <- 0 until pgLevels) {
|
||||||
|
val leaf = io.mem.resp.valid && !traverse && count === i
|
||||||
|
ccover(leaf && pte.v && !invalid_paddr, s"L$i", s"successful page-table access, level $i")
|
||||||
|
ccover(leaf && pte.v && invalid_paddr, s"L${i}_BAD_PPN_MSB", s"PPN too large, level $i")
|
||||||
|
ccover(leaf && !io.mem.resp.bits.data(0), s"L${i}_INVALID_PTE", s"page not present, level $i")
|
||||||
|
if (i != pgLevels-1)
|
||||||
|
ccover(leaf && !pte.v && io.mem.resp.bits.data(0), s"L${i}_BAD_PPN_LSB", s"PPN LSBs not zero, level $i")
|
||||||
|
}
|
||||||
|
ccover(io.mem.resp.valid && count === pgLevels-1 && pte.table(), s"TOO_DEEP", s"page table too deep")
|
||||||
ccover(io.mem.s2_nack, "NACK", "D$ nacked page-table access")
|
ccover(io.mem.s2_nack, "NACK", "D$ nacked page-table access")
|
||||||
ccover(state === s_wait2 && io.mem.s2_xcpt.ae.ld, "AE", "access exception while walking page table")
|
ccover(state === s_wait2 && io.mem.s2_xcpt.ae.ld, "AE", "access exception while walking page table")
|
||||||
|
|
||||||
|
@ -10,6 +10,8 @@ import freechips.rocketchip.config.Parameters
|
|||||||
import freechips.rocketchip.rocket._
|
import freechips.rocketchip.rocket._
|
||||||
import freechips.rocketchip.rocket.Instructions._
|
import freechips.rocketchip.rocket.Instructions._
|
||||||
import freechips.rocketchip.util._
|
import freechips.rocketchip.util._
|
||||||
|
import freechips.rocketchip.util.property._
|
||||||
|
import chisel3.internal.sourceinfo.SourceInfo
|
||||||
|
|
||||||
case class FPUParams(
|
case class FPUParams(
|
||||||
divSqrt: Boolean = true,
|
divSqrt: Boolean = true,
|
||||||
@ -768,6 +770,7 @@ class FPU(cfg: FPUParams)(implicit p: Parameters) extends FPUModule()(p) {
|
|||||||
val wbInfo = Reg(Vec(maxLatency-1, new WBInfo))
|
val wbInfo = Reg(Vec(maxLatency-1, new WBInfo))
|
||||||
val mem_wen = mem_reg_valid && (mem_ctrl.fma || mem_ctrl.fastpipe || mem_ctrl.fromint)
|
val mem_wen = mem_reg_valid && (mem_ctrl.fma || mem_ctrl.fastpipe || mem_ctrl.fromint)
|
||||||
val write_port_busy = RegEnable(mem_wen && (memLatencyMask & latencyMask(ex_ctrl, 1)).orR || (wen & latencyMask(ex_ctrl, 0)).orR, req_valid)
|
val write_port_busy = RegEnable(mem_wen && (memLatencyMask & latencyMask(ex_ctrl, 1)).orR || (wen & latencyMask(ex_ctrl, 0)).orR, req_valid)
|
||||||
|
ccover(mem_reg_valid && write_port_busy, "WB_STRUCTURAL", "structural hazard on writeback")
|
||||||
|
|
||||||
for (i <- 0 until maxLatency-2) {
|
for (i <- 0 until maxLatency-2) {
|
||||||
when (wen(i+1)) { wbInfo(i) := wbInfo(i+1) }
|
when (wen(i+1)) { wbInfo(i) := wbInfo(i+1) }
|
||||||
@ -825,6 +828,9 @@ class FPU(cfg: FPUParams)(implicit p: Parameters) extends FPUModule()(p) {
|
|||||||
|
|
||||||
if (cfg.divSqrt) {
|
if (cfg.divSqrt) {
|
||||||
val divSqrt_killed = Reg(Bool())
|
val divSqrt_killed = Reg(Bool())
|
||||||
|
ccover(divSqrt_inFlight && divSqrt_killed, "DIV_KILLED", "divide killed after issued to divider")
|
||||||
|
ccover(divSqrt_inFlight && mem_reg_valid && (mem_ctrl.div || mem_ctrl.sqrt), "DIV_BUSY", "divider structural hazard")
|
||||||
|
ccover(mem_reg_valid && divSqrt_write_port_busy, "DIV_WB_STRUCTURAL", "structural hazard on division writeback")
|
||||||
|
|
||||||
for (t <- floatTypes) {
|
for (t <- floatTypes) {
|
||||||
val tag = !mem_ctrl.singleOut // TODO typeTag
|
val tag = !mem_ctrl.singleOut // TODO typeTag
|
||||||
@ -873,4 +879,7 @@ class FPU(cfg: FPUParams)(implicit p: Parameters) extends FPUModule()(p) {
|
|||||||
}
|
}
|
||||||
req
|
req
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def ccover(cond: Bool, label: String, desc: String)(implicit sourceInfo: SourceInfo) =
|
||||||
|
cover(cond, s"FPU_$label", "Core;;" + desc)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user