diff options
author | Prashanth Mundkur <prashanth.mundkur@gmail.com> | 2019-02-20 13:32:59 -0800 |
---|---|---|
committer | Prashanth Mundkur <prashanth.mundkur@gmail.com> | 2019-02-20 13:32:59 -0800 |
commit | 31c55d5e0b10a53699de2b5712fbeb4350aa20b5 (patch) | |
tree | 1965502d52ef63b45f97ab776f70eda936e4f931 /c_emulator | |
parent | 5cb13966646d6d09f2589cd0992f1771cffc72ca (diff) | |
download | sail-riscv-31c55d5e0b10a53699de2b5712fbeb4350aa20b5.zip sail-riscv-31c55d5e0b10a53699de2b5712fbeb4350aa20b5.tar.gz sail-riscv-31c55d5e0b10a53699de2b5712fbeb4350aa20b5.tar.bz2 |
Add an option to report the model architecture to the emulators.
Diffstat (limited to 'c_emulator')
-rw-r--r-- | c_emulator/riscv_sim.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/c_emulator/riscv_sim.c b/c_emulator/riscv_sim.c index 9cca587..ebcfdc9 100644 --- a/c_emulator/riscv_sim.c +++ b/c_emulator/riscv_sim.c @@ -79,6 +79,7 @@ static struct option options[] = { {"device-tree-blob", required_argument, 0, 'b'}, {"terminal-log", required_argument, 0, 't'}, {"show-times", required_argument, 0, 'p'}, + {"report-arch", no_argument, 0, 'a'}, #ifdef RVFI_DII {"rvfi-dii", required_argument, 0, 'r'}, #endif @@ -101,6 +102,12 @@ static void print_usage(const char *argv0, int ec) exit(ec); } +static void report_arch(void) +{ + fprintf(stdout, "RV%lu\n", zxlen_val); + exit(0); +} + static void dump_dts(void) { #ifdef ENABLE_SPIKE @@ -154,9 +161,12 @@ char *process_args(int argc, char **argv) int c, idx = 1; uint64_t ram_size = 0; while(true) { - c = getopt_long(argc, argv, "dmCspz:b:t:v:hr:", options, &idx); + c = getopt_long(argc, argv, "admCspz:b:t:v:hr:", options, &idx); if (c == -1) break; switch (c) { + case 'a': + report_arch(); + break; case 'd': fprintf(stderr, "enabling dirty update.\n"); rv_enable_dirty_update = true; @@ -663,12 +673,12 @@ void init_logs() int main(int argc, char **argv) { + // Initialize model so that we can check or report its architecture. + preinit_sail(); + char *file = process_args(argc, argv); init_logs(); - // Initialize model so that we can check its architecture. - preinit_sail(); - if (gettimeofday(&init_start, NULL) < 0) { fprintf(stderr, "Cannot gettimeofday: %s\n", strerror(errno)); exit(1); |