Skip to content

Commit

Permalink
Start jtag server only if enabled via plus args
Browse files Browse the repository at this point in the history
Internal-tag: [#60812]
Signed-off-by: Ryszard Rozak <[email protected]>
  • Loading branch information
RRozak committed Jul 17, 2024
1 parent be8935a commit c09f3fa
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/scripts/openocd_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ echo -e "${COLOR_WHITE}======== Launching interactive simulation ========${COLOR

# Start the simulation
echo -e "Starting simulation..."
obj_dir/Vtb_top >"${SIM_LOG}" 2>&1 &
obj_dir/Vtb_top +ENABLE_JTAG=1 >"${SIM_LOG}" 2>&1 &
SIM_PID=$!

# Wait
Expand Down
20 changes: 15 additions & 5 deletions testbench/jtagdpi/jtagdpi.sv
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,29 @@ module jtagdpi #(
function void jtagdpi_close(input chandle ctx);

chandle ctx;
bit jtag_enabled;

initial begin
ctx = jtagdpi_create(Name, ListenPort);
if (!$value$plusargs("ENABLE_JTAG=%d", jtag_enabled)) jtag_enabled = 0;
$display(jtag_enabled);

if (jtag_enabled) begin
ctx = jtagdpi_create(Name, ListenPort);
end
end

final begin
jtagdpi_close(ctx);
ctx = null;
if (jtag_enabled) begin
jtagdpi_close(ctx);
ctx = null;
end
end

always_ff @(posedge clk_i, negedge rst_ni) begin
jtagdpi_tick(ctx, jtag_tck, jtag_tms, jtag_tdi, jtag_trst_n, jtag_srst_n,
jtag_tdo);
if (jtag_enabled) begin
jtagdpi_tick(ctx, jtag_tck, jtag_tms, jtag_tdi, jtag_trst_n, jtag_srst_n,
jtag_tdo);
end
end

endmodule

0 comments on commit c09f3fa

Please sign in to comment.