diff --git a/Debug.md b/Debug.md index f6343e2ef..3c63b4d22 100644 --- a/Debug.md +++ b/Debug.md @@ -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 @@ -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 diff --git a/tb/testharness.sv b/tb/testharness.sv index 3dddffc9d..9abe4180f 100644 --- a/tb/testharness.sv +++ b/tb/testharness.sv @@ -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 ); @@ -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; @@ -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, @@ -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