[Firechip] Include reset in tracerv tokens
This commit is contained in:
@@ -42,10 +42,13 @@ trait HasTraceIOImp extends LazyModuleImp {
|
||||
outer.tileTraceNodes.zipWithIndex.foreach({ case (node, idx) =>
|
||||
if (p(InstantiateTracerVBridges)) {
|
||||
val b = TracerVBridge(node.bundle)
|
||||
// Used for verifying the TracerV bridge
|
||||
if (p(PrintTracePort)) {
|
||||
val traceprint = WireDefault(0.U(512.W))
|
||||
traceprint := b.io.traces.asUInt
|
||||
printf(s"TRACEPORT ${idx}: %x\n", traceprint)
|
||||
withClockAndReset(node.bundle.head.clock, node.bundle.head.reset) {
|
||||
val traceprint = WireDefault(0.U(512.W))
|
||||
traceprint := b.io.traces.asUInt
|
||||
printf(s"TRACEPORT ${idx}: %x\n", traceprint)
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -106,15 +106,16 @@ abstract class FireSimTestSuite(
|
||||
def diffTracelog(verilatedLog: String) {
|
||||
behavior of "captured instruction trace"
|
||||
it should s"match the chisel printf in ${verilatedLog}" in {
|
||||
def getLines(file: File, dropLines: Int = 0, prefixFilter: String = ""): Seq[String] = {
|
||||
val lines = Source.fromFile(file).getLines.toList
|
||||
lines.filter(_.startsWith(prefixFilter))
|
||||
.drop(dropLines)
|
||||
.map(_.stripPrefix(prefixFilter))
|
||||
}
|
||||
val resetLength = 51
|
||||
val verilatedOutput = getLines(new File(outDir, s"/${verilatedLog}"), prefixFilter = "TRACEPORT 0: ")
|
||||
val synthPrintOutput = getLines(new File(genDir, s"/TRACEFILE"), dropLines = resetLength)
|
||||
def getLines(file: File): Seq[String] = Source.fromFile(file).getLines.toList
|
||||
|
||||
val printfPrefix = "TRACEPORT 0: "
|
||||
val verilatedOutput = getLines(new File(outDir, s"/${verilatedLog}")).collect({
|
||||
case line if line.startsWith(printfPrefix) => line.stripPrefix(printfPrefix) })
|
||||
|
||||
// Last bit indicates the core was under reset; reject those tokens
|
||||
val synthPrintOutput = getLines(new File(genDir, s"/TRACEFILE")).filter(line =>
|
||||
(line.last.toInt & 1) == 0)
|
||||
|
||||
assert(math.abs(verilatedOutput.size - synthPrintOutput.size) <= 1,
|
||||
s"\nPrintf Length: ${verilatedOutput.size}, Trace Length: ${synthPrintOutput.size}")
|
||||
assert(verilatedOutput.nonEmpty)
|
||||
|
||||
Reference in New Issue
Block a user