Skip to content

Commit

Permalink
[t1emu] add coverage for different sew / vmul / vl
Browse files Browse the repository at this point in the history
  • Loading branch information
Clo91eaf committed Nov 12, 2024
1 parent 8ce2ba1 commit 08436ab
Showing 1 changed file with 32 additions and 6 deletions.
38 changes: 32 additions & 6 deletions t1/src/T1.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1853,26 +1853,52 @@ class T1(val parameter: T1Parameter)

// coverage for one instruction
instructions.map { instruction: Instruction =>
val issueMatch =
val coverMatch =
Sequence.BoolSequence(
requestReg.valid && requestReg.bits.issue.instruction === BitPat("b" + instruction.encoding.toString)
)
CoverProperty(issueMatch, label = Some(s"t1_cover_issue_1_${instruction.name}"))
CoverProperty(coverMatch, label = Some(s"t1_cover_1_${instruction.name}"))
}

// coverage for two instructions
instructions.map { case instructionNew: Instruction =>
instructions.map { case instructionOld: Instruction =>
val issueInstructionOld = RegEnable(requestReg.bits.issue.instruction, requestReg.valid)
val issueMatchNew = Sequence.BoolSequence(
val coverMatchNew = Sequence.BoolSequence(
requestReg.valid && requestReg.bits.issue.instruction === BitPat("b" + instructionNew.encoding.toString)
)
val issueMatchOld =
val coverMatchOld =
Sequence.BoolSequence(issueInstructionOld === BitPat("b" + instructionOld.encoding.toString))
CoverProperty(
issueMatchNew.and(issueMatchOld),
label = Some(s"t1_cover_issue_2_${instructionOld.name}_with_${instructionNew.name}")
coverMatchNew.and(coverMatchOld),
label = Some(s"t1_cover_2_${instructionOld.name}_with_${instructionNew.name}")
)
}
}

// coverage for different sew / vmul / vl
val vsews = Seq(0, 1, 2)
val sews = Seq(8, 16, 32)
val vlmuls = Seq(0, 1, 2, 3, 6, 7)
val lmuls = Seq(1, 2, 4, 8, -1, -1, 0.25, 0.5)
val vls = Seq((1.0, 1), (1.0, 0), (0.25, 0), (0.25, 1), (0.25, 2), (0.5, 0), (0.5, 1), (0.5, 2))
vsews.map { vsew =>
vlmuls.map { vlmul =>
vls.map { case (vla: Double, vlb: Int) =>
// `vlmax = vLen * (2**lmul) / (2 ** sew * 8)`
val sew = sews(vsew)
val lmul = lmuls(vlmul)
val vlmax = parameter.vLen * math.pow(2, lmul) / math.pow(2, sew) / 8
val vl = (vlmax * vla).toInt + vlb - 1

val coverMatch = Sequence.BoolSequence(
requestReg.valid && requestReg.bits.issue.vl === vl.U &&
T1Issue.vlmul(requestReg.bits.issue) === vlmul.U &&
T1Issue.vsew(requestReg.bits.issue) === vsew.U
)

CoverProperty(coverMatch, label = Some(s"t1_cover_3_sew_${sew}_lmul_${lmul}_vl_${vl}"))
}
}
}
}

0 comments on commit 08436ab

Please sign in to comment.