Question

I am rather new to CHISEL.

Is it possible for CHISEL testbench to receive an arg passed in during runtime? For example, sbt run --backend c --compile --test --genHarness --dut1

--dut1 is meant to be received by the testbench as an arg. It will be used to determine which DUT to be instantiated.

Was it helpful?

Solution

Yes, I believe that would work.

sbt "project myproject" "run my_arg --backend c --targetDir my_target_dir"

You can catch that in your own main, strip out your arguments, and pass Chisel its arguments. Something sort of like this:

```` object top_main { def main(args: Array[String]): Unit = { val my_arg = args(0) val chiselArgs = ArrayBufferString

chiselMain(chiselArgs.toArray, () => iforgettheexactsyntax(my_arg))

} }

Check out (Chisel runtime error in test harness) for an example main that invokes Chisel.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top