-
Notifications
You must be signed in to change notification settings - Fork 76
poke
in ChiselScalatestTester
occurs on falling clock edge in traces
#646
Comments
poke
in ChiselScalatestTester
occurs on falling edgepoke
in ChiselScalatestTester
occurs on falling clock edge in traces
This is actually a often requested feature. It is a little difficult to implement since it would need to work for all our backends and there might be unexpected interactions with Verilog blackboxes, but it would definitely be possible to implement. You want pokes to occur a delta cycle after the rising edge, correct? Not a delta cycle before the rising edge. |
I'm not entirely sure what a "delta cycle" is, but I think I can relatively easily articulate what I expect. Consider the following design and test: class Hello extends Module {
val io = IO(new Bundle {
val input = Input(Bool())
val output = Output(Bool())
})
io.output := RegNext(io.input, false.B)
}
class HelloTests extends AnyFlatSpec with ChiselScalatestTester {
behavior of "Hello"
it should "demonstrate poke edges" in {
test(new Hello).withAnnotations(Seq(chiseltest.simulator.WriteVcdAnnotation)) { dut =>
dut.io.input.poke(false)
dut.clock.step(1)
dut.io.input.poke(true)
dut.clock.step(2)
dut.io.input.poke(false)
dut.clock.step(2)
}
}
} Running this test, I get the following trace: Importantly, changes to I would have expected changes from I'm currently working around this with a python script that shifts all of the non-clock changes to the most recent rising edge in the .vcd output (which is what I used to produce the second trace above). This is obviously less than ideal, but it does work :) |
OK, I think you want all pokes to apply right after the rising clock edge. A "delta cycle" is a Verilog term for the smallest possible time-step in simulation. A rising clock edge is an instantaneous event, so you cannot really have an input change "during" the rising edge. They either have to change a litter (i.e. a delta cycle) before or after the rising edge. |
Ok, right. Then yeah, a delta cycle after the rising edge. |
This is surprising; I would have expected
poke
s to happen "immediately", typically aligned with the rising edge of the clock in a trace. Is there an option to enable this? As it is now, it's quite an adjustment to read traces this way.The text was updated successfully, but these errors were encountered: