Search code examples
scalacode-coveragechisel

Retrieving chisel source description inside of treadle


I'm currently working on trying to add coverage to treadle. I was able to do so for the input LoFIRRTL code as follows:

COVERAGE REPORT:

+ circuit Test_1 :
+   module Test_1 :
+     input in$a : UInt<1>
+     input in$b$0 : UInt<2>
+     input in$b$1 : UInt<2>
+     input clock : Clock
+     output io_cov_valid_0 : UInt<1>
+     output io_cov_valid_1 : UInt<1>
+     output out : UInt<2>
+   
+     io_cov_valid_0 <= in$a
-     io_cov_valid_1 <= mux(in$a, UInt<1>("h0"), UInt<1>("h1"))
+     out <= mux(in$a, in$b$0, in$b$1)

Where + means that the line was covered by a test and - means that it wasn't. The goal would be to map this information to the Chisel source, which would be more useful.

So is there a way to retrieve the chisel source inside of treadle? If not would there be a pre-existing tool allowing one to reconstruct a Chisel description from LoFIRRTL code?


Solution

  • Treadle's symbols have an info field which contains (if present) the source locator that references the chisel source. Muxs do not have source locators but you the symbol on the left hand side would be the closest you can get. Good luck, I'm happy to answer any Treadle internals questions