@@ -38,6 +38,7 @@ static void help(int exit_code = 1)
38
38
fprintf (stderr, " -s Command I/O via socket (use with -d)\n " );
39
39
#endif
40
40
fprintf (stderr, " -h, --help Print this help message\n " );
41
+ fprintf (stderr, " --version Print spike version\n " );
41
42
fprintf (stderr, " --halted Start halted, allowing a debugger to connect\n " );
42
43
fprintf (stderr, " --log=<name> File name for option -l\n " );
43
44
fprintf (stderr, " --debug-cmd=<name> Read commands from file (use with -d)\n " );
@@ -94,6 +95,12 @@ static void suggest_help()
94
95
exit (1 );
95
96
}
96
97
98
+ static void state_version ()
99
+ {
100
+ fprintf (stdout, " Spike RISC-V ISA Simulator " SPIKE_VERSION " \n\n " );
101
+ exit (0 );
102
+ }
103
+
97
104
static bool check_file_exists (const char *fileName)
98
105
{
99
106
std::ifstream infile (fileName);
@@ -387,6 +394,7 @@ int main(int argc, char** argv)
387
394
parser.option (0 , " l2" , 1 , [&](const char * s){l2.reset (cache_sim_t::construct (s, " L2$" ));});
388
395
parser.option (0 , " big-endian" , 0 , [&](const char UNUSED *s){cfg.endianness = endianness_big;});
389
396
parser.option (0 , " misaligned" , 0 , [&](const char UNUSED *s){cfg.misaligned = true ;});
397
+ parser.option (0 , " version" , 0 , [&](const char UNUSED *s){state_version ();});
390
398
parser.option (0 , " log-cache-miss" , 0 , [&](const char UNUSED *s){log_cache = true ;});
391
399
parser.option (0 , " isa" , 1 , [&](const char * s){cfg.isa = s;});
392
400
parser.option (0 , " pmpregions" , 1 , [&](const char * s){cfg.pmpregions = atoul_safe (s);});
0 commit comments