In chisel-template test example there are some init calls method for decoupled value:
class GCDSpec extends FreeSpec with ChiselScalatestTester {
"Gcd should calculate proper greatest common denominator" in {
test(new DecoupledGcd(16)) { dut =>
dut.input.initSource()
dut.input.setSourceClock(dut.clock)
dut.output.initSink()
dut.output.setSinkClock(dut.clock)
//...
I can't find documentation explained the purpose of these methods. Why do we have to «init source or sink» of decoupled input ?
The api documentation is not filled with documentation for it.
The two init methods do the following
dut.input.initSource()
sets input decoupled's valid signal tofalse.B
dut.output.initSink()
sets output decoupled's ready signal tofalse.B
I think you could do these on your own manually. The clock setting calls do a bit more complicated stuff in order to coordinate clock handling acrossfork
calls which are typically used with theenqueue
anddequeue
family of functions. It might be that this could be inferred from DUTs but detecting thedecoupled
interfaces is currently a bit hard to do.The boilerplate calls to these function can be more succinctly specified as
since the
initSource
andinitSync
return the port decoupled portAs to documentation, this should definitely be improved for the decoupled helpers. I have added a note to do this to an existing documentation issue