Skip to content

Commit

Permalink
Add the enable option for DifftestModule (#191)
Browse files Browse the repository at this point in the history
  • Loading branch information
poemonsense authored Oct 17, 2023
1 parent 27c1371 commit 4725b62
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/main/scala/Difftest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ trait DifftestModule[T <: DifftestBundle] {
}

object DifftestModule {
private val enabled = true
private val instances = ListBuffer.empty[(DifftestBundle, String)]
private val macros = ListBuffer.empty[String]

Expand All @@ -279,15 +280,17 @@ object DifftestModule {
dontCare: Boolean = false,
delay: Int = 0,
): T = {
val id = register(gen, style)
val difftest: T = Wire(gen)
val sink = style match {
case "batch" => Batch(gen)
// By default, use the DPI-C style.
case _ => DPIC(gen)
if (enabled) {
val id = register(gen, style)
val sink = style match {
case "batch" => Batch(gen)
// By default, use the DPI-C style.
case _ => DPIC(gen)
}
sink := Merge(Delayer(difftest, delay))
sink.coreid := difftest.coreid
}
sink := Merge(Delayer(difftest, delay))
sink.coreid := difftest.coreid
if (dontCare) {
difftest := DontCare
}
Expand Down

0 comments on commit 4725b62

Please sign in to comment.