Skip to content

Commit

Permalink
use jtag i/o from harness when not using jtag dpi (#379)
Browse files Browse the repository at this point in the history
  • Loading branch information
davideschiavone authored Oct 4, 2023
1 parent a5474d1 commit 63db878
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 14 deletions.
4 changes: 2 additions & 2 deletions Debug.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ The remote bitbang server is simplemented in the folder ./hw/vendor/pulp_platfor
To simulate your application with Questasim using the remote_bitbang server, you need to compile you system adding the `JTAG DPI` functions:

```
make verilator-sim "FUSESOC_PARAM="--JTAG_DPI=1"
make verilator-sim FUSESOC_PARAM="--JTAG_DPI=1"
```

then, go to your target system built folder
Expand All @@ -63,7 +63,7 @@ and type to run your compiled software:
To simulate your application with Questasim using the remote_bitbang server, you need to compile you system adding the `JTAG DPI` functions:

```
make questasim-sim "FUSESOC_PARAM="--JTAG_DPI=1"
make questasim-sim FUSESOC_PARAM="--JTAG_DPI=1"
```

then, go to your target system built folder
Expand Down
36 changes: 24 additions & 12 deletions tb/testharness.sv
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ module testharness #(
inout wire boot_select_i,
inout wire execute_from_flash_i,

inout wire jtag_tck_i,
inout wire jtag_tms_i,
inout wire jtag_trst_ni,
inout wire jtag_tdi_i,
inout wire jtag_tdo_o,
input wire jtag_tck_i,
input wire jtag_tms_i,
input wire jtag_trst_ni,
input wire jtag_tdi_i,
output wire jtag_tdo_o,
output logic [31:0] exit_value_o,
inout wire exit_valid_o
);
Expand Down Expand Up @@ -53,10 +53,14 @@ module testharness #(
logic sim_jtag_enable = (JTAG_DPI == 1);
wire sim_jtag_tck;
wire sim_jtag_tms;
wire sim_jtag_trst;
wire sim_jtag_tdi;
wire sim_jtag_tdo;
wire sim_jtag_trstn;
wire mux_jtag_tck;
wire mux_jtag_tms;
wire mux_jtag_tdi;
wire mux_jtag_tdo;
wire mux_jtag_trstn;
wire [31:0] gpio;

wire [3:0] spi_flash_sd_io;
Expand Down Expand Up @@ -139,11 +143,11 @@ module testharness #(
) x_heep_system_i (
.clk_i,
.rst_ni,
.jtag_tck_i(sim_jtag_tck),
.jtag_tms_i(sim_jtag_tms),
.jtag_trst_ni(sim_jtag_trstn),
.jtag_tdi_i(sim_jtag_tdi),
.jtag_tdo_o(sim_jtag_tdo),
.jtag_tck_i(mux_jtag_tck),
.jtag_tms_i(mux_jtag_tms),
.jtag_trst_ni(mux_jtag_trstn),
.jtag_tdi_i(mux_jtag_tdi),
.jtag_tdo_o(mux_jtag_tdo),
.boot_select_i,
.execute_from_flash_i,
.exit_valid_o,
Expand Down Expand Up @@ -335,7 +339,15 @@ module testharness #(
.exit()
);

assign slow_ram_slave_req = ext_slave_req[SLOW_MEMORY_IDX];
assign mux_jtag_tck = JTAG_DPI ? sim_jtag_tck : jtag_tck_i;
assign mux_jtag_tms = JTAG_DPI ? sim_jtag_tms : jtag_tms_i;
assign mux_jtag_tdi = JTAG_DPI ? sim_jtag_tdi : jtag_tdi_i;
assign mux_jtag_trstn = JTAG_DPI ? sim_jtag_trstn : jtag_trst_ni;

assign sim_jtag_tdo = JTAG_DPI ? mux_jtag_tdo : '0;
assign jtag_tdo_o = !JTAG_DPI ? mux_jtag_tdo : '0;

assign slow_ram_slave_req = ext_slave_req[SLOW_MEMORY_IDX];
assign ext_slave_resp[SLOW_MEMORY_IDX] = slow_ram_slave_resp;

generate
Expand Down

0 comments on commit 63db878

Please sign in to comment.