Use a UnitTester to construct a test harness for a chisel module
this module will be canonically referred to as the device_under_test, often simply as c in
a unit test, and also dut
The UnitTester is used to put series of values (as chisel3.Vec's) into the ports of the dut io which are INPUT
At specified times it check the dut io OUTPUT ports to see that they match a specific value
The vec's are assembled through the following API
poke, expect and step, pokes
class Adder(width:Int) extends Module {
val io = new Bundle {
val in0 : UInt(INPUT, width=width)
val in1 : UInt(INPUT, width=width)
val out : UInt(OUTPUT, width=width)
}
}
class AdderTester extends UnitTester {
val device_under_test = Module( new Adder(32) )
testBlock {
poke(c.io.in0, 5)
poke(c.io.in1, 7)
expect(c.io.out, 12)
}
}
Linear Supertypes
HWIOTester, BasicTester, core.Module, HasId, InstanceId, AnyRef, Any
Use a UnitTester to construct a test harness for a chisel module this module will be canonically referred to as the device_under_test, often simply as c in a unit test, and also dut The UnitTester is used to put series of values (as chisel3.Vec's) into the ports of the dut io which are INPUT At specified times it check the dut io OUTPUT ports to see that they match a specific value The vec's are assembled through the following API poke, expect and step, pokes