mirror of
https://github.com/olofk/serv.git
synced 2025-04-20 11:57:07 -04:00
Add timeout argument
This commit is contained in:
parent
65eb89323a
commit
e059b7cf09
3 changed files with 17 additions and 1 deletions
|
@ -107,6 +107,11 @@ int main(int argc, char **argv, char **env)
|
|||
|
||||
signal(SIGINT, INThandler);
|
||||
|
||||
vluint64_t timeout = 0;
|
||||
const char *arg_timeout = Verilated::commandArgsPlusMatch("timeout=");
|
||||
if (arg_timeout[0])
|
||||
timeout = atoi(arg_timeout+9);
|
||||
|
||||
top->wb_clk = 1;
|
||||
bool q = top->q;
|
||||
while (!(done || Verilated::gotFinish())) {
|
||||
|
@ -118,6 +123,12 @@ int main(int argc, char **argv, char **env)
|
|||
do_uart(&uart_context, top->q);
|
||||
else
|
||||
do_gpio(&gpio_context, top->q);
|
||||
|
||||
if (timeout && (main_time >= timeout)) {
|
||||
printf("Timeout: Exiting at time %lu\n", main_time);
|
||||
done = true;
|
||||
}
|
||||
|
||||
top->wb_clk = !top->wb_clk;
|
||||
main_time+=31.25;
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ endif
|
|||
|
||||
RUN_TARGET=\
|
||||
$(TARGET_SIM) \
|
||||
+timeout=100000000 \
|
||||
+signature=$(work_dir_isa)/$(*).signature.output \
|
||||
+firmware=$(work_dir_isa)/$<.hex 2> $(work_dir_isa)/$@
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@ targets:
|
|||
verilator_tb:
|
||||
default_tool: verilator
|
||||
filesets : [soc, verilator_tb]
|
||||
parameters : [RISCV_FORMAL, firmware, memsize, signature, uart_baudrate, vcd]
|
||||
parameters : [RISCV_FORMAL, firmware, memsize, signature, timeout, uart_baudrate, vcd]
|
||||
tools:
|
||||
verilator:
|
||||
verilator_options : [--trace]
|
||||
|
@ -129,6 +129,10 @@ parameters:
|
|||
description : Treat q output as an UART with the specified baudrate (0 or omitted parameter disables UART decoding)
|
||||
paramtype : plusarg
|
||||
|
||||
timeout:
|
||||
datatype : int
|
||||
paramtype : plusarg
|
||||
|
||||
vcd:
|
||||
datatype : bool
|
||||
paramtype : plusarg
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue