Skip to content

Commit

Permalink
Speed up tb/jtag_pkg.sv load_L2 task
Browse files Browse the repository at this point in the history
Use address autoincrementation to speed up loading of a binary when
using the riscv-dbg module.
  • Loading branch information
micprog committed Jun 13, 2022
1 parent e2cb590 commit a515542
Showing 1 changed file with 35 additions and 24 deletions.
59 changes: 35 additions & 24 deletions rtl/tb/jtag_pkg.sv
Original file line number Diff line number Diff line change
Expand Up @@ -1502,11 +1502,11 @@ package jtag_pkg;
jtag_data[0] = stimuli[num_stim][63:0]; // assign data

this.set_sbreadonaddr(1'b0, s_tck, s_tms, s_trstn, s_tdi, s_tdo);
this.set_sbautoincrement(1'b0, s_tck, s_tms, s_trstn, s_tdi, s_tdo);
this.set_sbautoincrement(1'b1, s_tck, s_tms, s_trstn, s_tdi, s_tdo);

$display("[JTAG] %t - Loading L2 with debug module jtag interface", $realtime);

spi_addr_old = spi_addr - 32'h8;
spi_addr_old = '1;//spi_addr - 32'h8;

while (more_stim) begin // loop until we have no more stimuli

Expand All @@ -1523,24 +1523,35 @@ package jtag_pkg;
if (spi_addr != (spi_addr_old + 32'h8))
begin
spi_addr_old = spi_addr - 32'h8;
this.set_dmi(
2'b10, //write
7'h39, //sbaddress0,
spi_addr[31:0], //bootaddress
{dm_addr, dm_data, dm_op},
s_tck,
s_tms,
s_trstn,
s_tdi,
s_tdo
);
break;
end
else begin
num_stim = num_stim + 1;
end
spi_addr_old = spi_addr;

this.set_dmi(
2'b10, //write
7'h39, //sbaddress0,
spi_addr[31:0], //bootaddress
{dm_addr, dm_data, dm_op},
s_tck,
s_tms,
s_trstn,
s_tdi,
s_tdo
);
// this.set_dmi(
// 2'b10, //write
// 7'h39, //sbaddress0,
// spi_addr[31:0], //bootaddress
// {dm_addr, dm_data, dm_op},
// s_tck,
// s_tms,
// s_trstn,
// s_tdi,
// s_tdo
// );

this.set_dmi(
2'b10, //write
Expand All @@ -1554,17 +1565,17 @@ package jtag_pkg;
s_tdo
);
//$display("[JTAG] Loading L2 - Written %x at %x (%t)", jtag_data[0], spi_addr[31:0], $realtime);
this.set_dmi(
2'b10, //write
7'h39, //sbaddress0,
spi_addr[31:0]+4, //bootaddress
{dm_addr, dm_data, dm_op},
s_tck,
s_tms,
s_trstn,
s_tdi,
s_tdo
);
// this.set_dmi(
// 2'b10, //write
// 7'h39, //sbaddress0,
// spi_addr[31:0]+4, //bootaddress
// {dm_addr, dm_data, dm_op},
// s_tck,
// s_tms,
// s_trstn,
// s_tdi,
// s_tdo
// );

this.set_dmi(
2'b10, //write
Expand Down

0 comments on commit a515542

Please sign in to comment.