In Chisel iotesters, we pass a factory that creates a Chisel design to the tester, e.g. () => new DUT, as follows:
"Test" should "simulate" in {
chisel3.iotesters.Driver.execute(arguments, () => new DUT) { c => new MyPeekPokeTester(c) } should be (true)
}
If I have many tests and a large design, there's design elaboration that happens for every test resulting in a long runtime. Since for many tests, it is possibly exact same design being passed, a logical question comes up - is there a way to reuse the elaborated design (DUT.fir or DUT.v depending on the backend) in multiple tests? Given a reset is called in the beginning of every test, it shouldn't incur functional issues.
I'd suggest building a PeekPokeTester that aggregates a number of testers. Something like
class MyMegaPeekPokeTester(c: MyDut) extends PeekPokeTester(c) {
new MyPeekPokeTester1(c) &&
new MyPeekPokeTester2(c) &&
...
new MyPeekPokeTesterN(c)
}
There's various ways you could sugar this up (putting the classes into a list, calling reset between them programmatically, etc).
There's an effort to refactor and modernize the testers and this issue is under consideration. One complication is that PeekPokeTesters require access to the instance of the dut in order to provide type safe access to the IO. It is difficult to serialize or otherwise preserve this information.