8 fprintf(stderr
, "usage: riscv-isa-run -f <fd> -t <fd> [additional options]\n");
9 fprintf(stderr
, "Options:\n");
10 fprintf(stderr
, " -f <fd> From-host pipe file descriptor\n");
11 fprintf(stderr
, " -t <fd> To-host pipe file descriptor\n");
12 fprintf(stderr
, " -p <n> Simulate <n> processors\n");
13 fprintf(stderr
, " -d Interactive debug mode\n");
17 int main(int argc
, char** argv
)
21 int fromhost_fd
= -1, tohost_fd
= -1;
23 // parse command-line arguments
24 for(int c
; (c
= getopt(argc
,argv
,"hdp:f:t:")) != -1; )
32 nprocs
= atoi(optarg
);
35 fromhost_fd
= atoi(optarg
);
38 tohost_fd
= atoi(optarg
);
41 fprintf(stderr
, "unknown option: -%c", optopt
);
47 // we require -f and -t to be specified so we can communicate with the host
48 if(fromhost_fd
== -1 || tohost_fd
== -1)
51 // initialize host-target interface
52 htif_t
htif(tohost_fd
, fromhost_fd
);
54 // initalize simulator and run to completion
55 sim_t
s(nprocs
, &htif
);