0%

2.6 Chisel Test

2.6 Chisel Test

Basic

ChiselTest’s test method requires a bit less boiler plate. What was the PeekPokeTester is now built into the process.

  • The poke and expect methods are now part of each individual io element. This gives important hints to the tester to make better checking of types. The peek and step operations are also now methods on io elements.
  • Another difference is that values poked and expected are Chisel literals. Although pretty simple here, it also provides stronger checking in more advanced and interesting examples. This will be further enhanced with coming improvements in the ability to specify Bundle literals
iotesters (deprived ?) ChiselTest
poke poke(c.io.in1, 6) c.io.in1.poke(6.U)
peek peek(c.io.out1) c.io.out1.peek()
expect expect(c.io.out1, 6) c.io.out1.expect(6.U)
step step(1) c.io.clock.step(1)
initiate Driver.execute(…) { c => test(…) { c =>

Modules with Decoupled Interfaces

1
2
3
4
5
class QueueModule[T <: Data](ioType: T, entries: Int) extends MultiIOModule {
val in = IO(Flipped(Decoupled(ioType)))
val out = IO(Decoupled(ioType))
out <> Queue(in, entries)
}