change htif to link against libfesvr
[riscv-isa-sim.git] / riscv / riscv-isa-run.cc
1 #include "sim.h"
2 #include "htif.h"
3 #include <stdio.h>
4 #include <stdlib.h>
5 #include <vector>
6 #include <string>
7
8 static void help()
9 {
10 fprintf(stderr, "usage: riscv-isa-run [host options] <target program> [target options]\n");
11 fprintf(stderr, "Host Options:\n");
12 fprintf(stderr, " -p <n> Simulate <n> processors\n");
13 fprintf(stderr, " -m <n> Provide <n> MB of target memory\n");
14 fprintf(stderr, " -d Interactive debug mode\n");
15 fprintf(stderr, " -h Print this help message\n");
16 exit(1);
17 }
18
19 int main(int argc, char** argv)
20 {
21 bool debug = false;
22 int nprocs = 1;
23 int mem_mb = 0;
24
25 // parse command-line arguments
26 for(int c; (c = getopt(argc,argv,"hdp:m:")) != -1; )
27 {
28 switch(c)
29 {
30 case 'd':
31 debug = true;
32 break;
33 case 'p':
34 nprocs = atoi(optarg);
35 break;
36 case 'm':
37 mem_mb = atoi(optarg);
38 break;
39 default:
40 fprintf(stderr, "unknown option: -%c", optopt);
41 case 'h':
42 help();
43 }
44 }
45
46 if (optind == argc)
47 help();
48
49 std::vector<std::string> htif_args(argv + optind, argv + argc);
50 sim_t s(nprocs, mem_mb, htif_args);
51 s.run(debug);
52 }