Fix to rv32 RISC-V ISS example

This commit is contained in:
Simon Southwell 2025-09-30 09:24:48 +01:00
commit d9dc0e20dc
3 changed files with 16 additions and 6 deletions

View file

@ -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

View file

@ -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

View file

@ -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