diff --git a/examples/riscv/src/VUserMain0.cpp b/examples/riscv/src/VUserMain0.cpp index a48e86f..42a3534 100644 --- a/examples/riscv/src/VUserMain0.cpp +++ b/examples/riscv/src/VUserMain0.cpp @@ -43,6 +43,7 @@ static uint32_t irq = 0; static const int strbufsize = 256; static char argstr[strbufsize]; +static char execstr[strbufsize]; static rv32* pCpu; static double tv_diff_usec; @@ -248,7 +249,8 @@ int parseArgs(int argcIn, char** argvIn, rv32i_cfg_s &cfg, const int node) switch (c) { case 't': - cfg.exec_fname = optarg; + strncpy(execstr, optarg, strbufsize); + cfg.exec_fname = execstr; cfg.user_fname = true; break; case 'n': @@ -362,11 +364,12 @@ uint32_t iss_int_callback(const rv32i_time_t time, rv32i_time_t *wakeup_time) extern "C" void VUserMain0() { rv32i_cfg_s cfg; + int error = 0; VPrint("\n*****************************\n"); VPrint( "* Wyvern Semiconductors *\n"); VPrint( "* rv32_cpu ISS (on VProc) *\n"); - VPrint( "* Copyright (c) 2024 *\n"); + VPrint( "* Copyright (c) 2025 *\n"); VPrint( "*****************************\n\n"); VTick(20, node); @@ -427,8 +430,11 @@ extern "C" void VUserMain0() else { // Load an executable - if (!pCpu->read_elf(cfg.exec_fname)) + error = pCpu->read_elf(cfg.exec_fname); + + if (!error) { + pre_run_setup(); // Run processor @@ -454,6 +460,10 @@ extern "C" void VUserMain0() } } } + else + { + fprintf(stderr, "***ERROR: failed to load %s\n", cfg.exec_fname); + } } // Clean up diff --git a/examples/riscv/test.v b/examples/riscv/test.v index 6cee1ea..87c2da9 100644 --- a/examples/riscv/test.v +++ b/examples/riscv/test.v @@ -79,7 +79,7 @@ reg readdatavalid; reg swirq; wire timirq; -wire [2:0] irq = {swirq, timirq, 1'b0}; +wire [2:0] irq = {1'b0, timirq, swirq}; // ----------------------------------------------- // Initialisation, clock and reset diff --git a/examples/riscv/vusermain.cfg b/examples/riscv/vusermain.cfg index 55362f1..b59fe70 100644 --- a/examples/riscv/vusermain.cfg +++ b/examples/riscv/vusermain.cfg @@ -1,3 +1,3 @@ -#vusermain0 -rbH -D disassem.log -t ./interrupt/test.exe -vusermain0 -T -n 10000000 -t ./main.exe +vusermain0 -rbH -D disassem.log -t ./interrupt/test.exe +#vusermain0 -T -n 10000000 -t ./main.exe