Skip to content

Commit

Permalink
[jtag,dv] Add a check about synchronisation in jtag driver
Browse files Browse the repository at this point in the history
Signed-off-by: Rupert Swarbrick <rswarbrick@lowrisc.org>
  • Loading branch information
rswarbrick committed May 30, 2024
1 parent 5016628 commit bec5baa
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions hw/dv/sv/jtag_agent/jtag_driver.sv
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,9 @@ class jtag_driver extends dv_base_driver #(jtag_item, jtag_agent_cfg);

// Drive TMS, TDI to the given values and wait for a single edge of TCK.
task tms_tdi_step(bit tms, bit tdi);
// We normally expect this task to be called at the negedge of tck (synchronous with HOST_CB).
// But that won't quite be true if the clock has been paused for a while because tck=1 when
// idle. We can spot that happening because tck will be 1. In that situation, wait for HOST_CB
// so we can get back in sync.
if (cfg.vif.tck) begin
@(`HOST_CB);
end
// When everything is in sync, this task will be called just after the negedge of TCK
// (synchronous with HOST_CB). In particular, TCK should be low: check that this is true.
`DV_CHECK_FATAL(!cfg.vif.tck);

`HOST_CB.tms <= tms;
`HOST_CB.tdi <= tdi;
Expand Down

0 comments on commit bec5baa

Please sign in to comment.