Filter specified HTIF arguments and plusargs only
This commit is contained in:
@@ -123,6 +123,10 @@ int main(int argc, char** argv)
|
|||||||
#endif
|
#endif
|
||||||
int verilog_plusargs_legal = 1;
|
int verilog_plusargs_legal = 1;
|
||||||
|
|
||||||
|
int verilated_argc = 1;
|
||||||
|
char** verilated_argv = new char*[argc];
|
||||||
|
verilated_argv[0] = argv[0];
|
||||||
|
|
||||||
opterr = 1;
|
opterr = 1;
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
@@ -195,9 +199,15 @@ int main(int argc, char** argv)
|
|||||||
else if (arg.substr(0, 12) == "+cycle-count")
|
else if (arg.substr(0, 12) == "+cycle-count")
|
||||||
c = 'c';
|
c = 'c';
|
||||||
else if (arg == "+permissive")
|
else if (arg == "+permissive")
|
||||||
|
{
|
||||||
c = 'p';
|
c = 'p';
|
||||||
|
verilated_argv[verilated_argc++] = optarg;
|
||||||
|
}
|
||||||
else if (arg == "+permissive-off")
|
else if (arg == "+permissive-off")
|
||||||
|
{
|
||||||
c = 'o';
|
c = 'o';
|
||||||
|
verilated_argv[verilated_argc++] = optarg;
|
||||||
|
}
|
||||||
// If we don't find a legacy '+' EMULATOR argument, it still could be
|
// If we don't find a legacy '+' EMULATOR argument, it still could be
|
||||||
// a VERILOG_PLUSARG and not an error.
|
// a VERILOG_PLUSARG and not an error.
|
||||||
else if (verilog_plusargs_legal) {
|
else if (verilog_plusargs_legal) {
|
||||||
@@ -213,6 +223,7 @@ int main(int argc, char** argv)
|
|||||||
verilog_plusargs_legal = 0;
|
verilog_plusargs_legal = 0;
|
||||||
} else {
|
} else {
|
||||||
c = 'P';
|
c = 'P';
|
||||||
|
verilated_argv[verilated_argc++] = optarg;
|
||||||
}
|
}
|
||||||
goto retry;
|
goto retry;
|
||||||
}
|
}
|
||||||
@@ -235,6 +246,7 @@ int main(int argc, char** argv)
|
|||||||
c = '?';
|
c = '?';
|
||||||
} else {
|
} else {
|
||||||
c = 'p';
|
c = 'p';
|
||||||
|
verilated_argv[verilated_argc++] = optarg;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
goto retry;
|
goto retry;
|
||||||
@@ -258,11 +270,8 @@ done_processing:
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int htif_argc = 1;
|
// Copy the binary file name into the verilator argument stack
|
||||||
char** htif_argv = new char*[argc];
|
while (optind < argc) verilated_argv[verilated_argc++] = argv[optind++];
|
||||||
htif_argv[0] = argv[0];
|
|
||||||
for (int i = 1; i < argc; i++)
|
|
||||||
if (argv[i][0] != '-') htif_argv[htif_argc++] = argv[i];
|
|
||||||
|
|
||||||
if (verbose)
|
if (verbose)
|
||||||
fprintf(stderr, "using random seed %u\n", random_seed);
|
fprintf(stderr, "using random seed %u\n", random_seed);
|
||||||
@@ -271,7 +280,7 @@ done_processing:
|
|||||||
srand48(random_seed);
|
srand48(random_seed);
|
||||||
|
|
||||||
Verilated::randReset(2);
|
Verilated::randReset(2);
|
||||||
Verilated::commandArgs(htif_argc, htif_argv);
|
Verilated::commandArgs(verilated_argc, verilated_argv);
|
||||||
TEST_HARNESS *tile = new TEST_HARNESS;
|
TEST_HARNESS *tile = new TEST_HARNESS;
|
||||||
|
|
||||||
#if VM_TRACE
|
#if VM_TRACE
|
||||||
@@ -380,6 +389,6 @@ done_processing:
|
|||||||
if (tsi) delete tsi;
|
if (tsi) delete tsi;
|
||||||
if (jtag) delete jtag;
|
if (jtag) delete jtag;
|
||||||
if (tile) delete tile;
|
if (tile) delete tile;
|
||||||
if (htif_argv) delete[] htif_argv;
|
if (verilated_argv) delete[] verilated_argv;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user