Skip to content

Commit

Permalink
[jtag,dv] Fix race between tck_in_use and trst_n
Browse files Browse the repository at this point in the history
The DV_SPINWAIT_EXIT call will kill drive_jtag_req if trst_n goes low
in the middle of a JTAG transaction. This is reasonable, but we
mustn't leave tck_in_use asserted. Move that acquire/release pair
outside of the DV_SPINWAIT_EXIT call.

Signed-off-by: Rupert Swarbrick <[email protected]>
  • Loading branch information
rswarbrick committed Aug 9, 2024
1 parent 234c884 commit 536d60c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions hw/dv/sv/jtag_agent/jtag_driver.sv
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,10 @@ class jtag_driver extends dv_base_driver #(jtag_item, jtag_agent_cfg);
release_tck();

`uvm_info(`gfn, req.sprint(uvm_default_line_printer), UVM_HIGH)
enable_tck();
`DV_SPINWAIT_EXIT(drive_jtag_req(req, rsp);,
wait (!cfg.vif.trst_n);)
release_tck();

// Mark the item as having been handled. This passes the response (rsp) back to the
// sequencer, and also pops the request that we have been handling.
Expand Down Expand Up @@ -197,7 +199,9 @@ class jtag_driver extends dv_base_driver #(jtag_item, jtag_agent_cfg);

// drive jtag req and retrieve rsp
virtual task drive_jtag_req(jtag_item req, jtag_item rsp);
enable_tck();
// This task should only be called in situations where tck is already enabled.
`DV_CHECK_FATAL(tck_in_use)

if (req.reset_tap_fsm) begin
drive_jtag_test_logic_reset();
end
Expand Down Expand Up @@ -230,7 +234,6 @@ class jtag_driver extends dv_base_driver #(jtag_item, jtag_agent_cfg);
req.dr_pause_cycle,
req.exit_to_rti_dr);
end
release_tck();
endtask

task drive_jtag_ir(int len,
Expand Down

0 comments on commit 536d60c

Please sign in to comment.