Skip to content

Commit

Permalink
picorv32 bootLoad_tb.v: exercise new bootloader.S feature
Browse files Browse the repository at this point in the history
  • Loading branch information
ldoolitt committed Aug 31, 2024
1 parent 58893b3 commit 398d68f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
17 changes: 15 additions & 2 deletions soc/picorv32/test/bootLoad/bootLoad_tb.v
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ module bootloader_tb;
reg [31:0] _startup_adr_arr[0:0];
wire [31:0] _startup_adr = _startup_adr_arr[0];
reg [ 7:0] hexData [0:255];
reg [1:0] jx;
integer start_time, delay, dok;

//--------------------
// The test sequence
Expand Down Expand Up @@ -168,26 +170,37 @@ module bootloader_tb;
uart_read_task("!");
uart_read_task("!");
//-------------------
// Test timeout
// Test timeout or timeout bypass
//-------------------
for (jx=0; jx<2; jx=jx+1) begin
$display("\n<reset>");
@ (posedge mem_clk);
reset <= 1;
repeat (10) @(posedge mem_clk);
reset <= 0;
$display("---------------------");
$display(" Testing timeout");
$display(" Testing timeout %d", jx);
$display("---------------------");
// Sync sequence: ok
uart_read_task("o");
uart_read_task("o");
uart_read_task("k");
uart_read_task("\n");
// exercise new (Aug 2024) feature of being able to bypass timeout
if (jx==1) uart_write_task("q");
start_time = $time;
// The user program should start talking after the timeout
uart_read_task("!");
delay = $time - start_time;
// Be very lenient, to avoid failure with past or future gcc versions
if (jx == 0) dok = (delay > 20000 && delay < 90000);
if (jx == 1) dok = (delay < 4000);
$display("\nmeasured delay %d ticks %s", delay, dok ? " OK" : "BAD");
pass &= dok;
uart_read_task("!");
uart_read_task("!");
$write("\n");
end
#500
if (pass) begin
$display("PASS");
Expand Down
2 changes: 1 addition & 1 deletion soc/picorv32/test/bootLoad/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

#define F_CLK 100000000 // [Hz] for CMODA7

#define BOOTLOADER_DELAY 16
#define BOOTLOADER_DELAY 160
#define BOOTLOADER_BAUDRATE 9216000 // Used for fast simulation

#endif

0 comments on commit 398d68f

Please sign in to comment.