-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Poke in PeekPokeTester always happens at negedge??? #159
Comments
There is not currently a way to do this. I will link this to our list of things to consider in a testers refactoring project we are reviewing. |
Hi @chick class DumpBufferRegister(width : Int) extends Module {
val io = IO(new Bundle {
val in = Flipped(Decoupled(UInt(width.W)))
val out = Decoupled(UInt(width.W))
})
val reg_valid = RegInit(Bool(), false.B)
val reg_data = Reg(UInt(width.W))
val reg_ready = Wire(Bool())
when(reg_ready){
reg_valid := io.in.valid
reg_data := io.in.bits
}
reg_ready := io.out.ready || !reg_valid
io.in.ready := reg_ready
io.out.valid := reg_valid
io.out.bits := reg_data
} In this example The issue is pretty simple:
Conclusion, as far as I know :
@jackkoenig I would be interested to know how you overcome this major flaw in your everyday (real-industrial)-life ? I have seen in VCS and IVL backend that an option
That being said, thank you for your great work on the tester 👍 |
This has come up before and I don't have an answer for it IIRC @ducky64 had a reasoned argument about this in the last year but I was unable to find it. I think he will be back in the lab next week and can weigh in. In the meantime: In my efforts to add verilator support to testers2 I have been hitting what I believe are related problems. I am working my way through verilator. Up to now, it's has been a black box to me. Treadle was built to do things, as much as possible, the same as the verilator backend. It is capable of doing a lot more than the testers API allows, including I think what you are looking for here, but the only way to do it now is writing your own native treadle harness. Probably not what you want to do. It would be really helpful if you could provide a chisel-testers test for the circuit described above that exposes the problem. Use pseudo-code if necessary, or perhaps to show some idea of what you'd like the API to do. That would be helpful guiding me through verilator. I am leaving tomorrow for a week vacation with very limited internet access, but I will try to get to this as soon as possible. Maybe @ducky64 or @jackkoenig will have some solution in the interim. Thanks for the thorough explanation. |
I don't remember any explicit rationale, but one nice side effect of clock high for register transitions and clock low for pokes is that it might be easier to visually differentiate register propagation and test stimulus change on waveform dumps. Side note: for testers2, I think I want to introduce a half-step construct that gives higher control and allows both posedge and negedge pokes. I don't know if I formalized the semantics for full step (either rising then falling, or falling then rising) though. I'm not sure I completely understand your example, but I think you're looking for some guarantee that a some peek happens after a particular poke? I believe that PeekPokeTesters follows an imperative programming model and peeks after pokes should reflect the results of the pokes - and in your example negedge is kind of a hack to achieve that. In testers2, I've implemented the concept of regions so that operations can be ordered within a time step especially when threading concurrency is involved. The idea is there would be a dedicated monitor region which happens after the main region, with the convention being that no poke operations should happen in the monitor region. |
Hi @chick & @ducky64 and thank you for your answers Concerning this tiny example, I've just tried to make a simple PeekPokeTester that exposes the issue. Do you think that it might depend of the number of deltas/steps the simulator has to compute to solve the combinational path ? |
My understanding is that combinational paths are re-evaluated on a peek-after-poke. Peeking stale combinational paths would be a bug. |
I have at last found back my notes explaining my previous issues: |
Hi, is this something that's still being considered in any capacity? It would be great to at least have the option to select which edge pokes should be aligned with in traces. |
Hi, I am also having trouble testing Decoupled because of this. please make pokes/peeks on posedge. |
I am testing a hardware that has streaming IO. From vcd waveform, it looks like that "poke" always happens at negedge. Is there a way to poke at the posedge of the clock?
The text was updated successfully, but these errors were encountered: