aboutsummaryrefslogtreecommitdiff
path: root/spike_main
diff options
context:
space:
mode:
authorKarthik B K <karthik.bk@incoresemi.com>2023-11-04 15:55:21 +0530
committerKarthik B K <karthik.bk@incoresemi.com>2023-11-04 15:55:21 +0530
commit5bdb9d4d7e8b8e113606446fe64ab7af9c17850a (patch)
tree0601ff0361a2c515e7d3360b8b14ada81695e2bf /spike_main
parent5a1145742e701597eb45825855311dfad21232a6 (diff)
downloadriscv-isa-sim-5bdb9d4d7e8b8e113606446fe64ab7af9c17850a.zip
riscv-isa-sim-5bdb9d4d7e8b8e113606446fe64ab7af9c17850a.tar.gz
riscv-isa-sim-5bdb9d4d7e8b8e113606446fe64ab7af9c17850a.tar.bz2
expose pmp granularity as a cli option.
PMP Granularity is made available as a command line option. The default value is 4 Bytes. The value can be changed by passing the option --pmp-granularity=<value> to spike. Signed-off-by: Karthik B K <karthik.bk@incoresemi.com>
Diffstat (limited to 'spike_main')
-rw-r--r--spike_main/spike-log-parser.cc1
-rw-r--r--spike_main/spike.cc3
2 files changed, 4 insertions, 0 deletions
diff --git a/spike_main/spike-log-parser.cc b/spike_main/spike-log-parser.cc
index 9bea5c5..6ac4ab0 100644
--- a/spike_main/spike-log-parser.cc
+++ b/spike_main/spike-log-parser.cc
@@ -36,6 +36,7 @@ int main(int UNUSED argc, char** argv)
/*default_misaligned=*/false,
/*default_endianness*/endianness_little,
/*default_pmpregions=*/16,
+ /*default_pmpgranularity=*/(1 << PMP_SHIFT),
/*default_mem_layout=*/std::vector<mem_cfg_t>(),
/*default_hartids=*/std::vector<size_t>(),
/*default_real_time_clint=*/false,
diff --git a/spike_main/spike.cc b/spike_main/spike.cc
index 7b28e25..8fd9104 100644
--- a/spike_main/spike.cc
+++ b/spike_main/spike.cc
@@ -41,6 +41,7 @@ static void help(int exit_code = 1)
fprintf(stderr, " --debug-cmd=<name> Read commands from file (use with -d)\n");
fprintf(stderr, " --isa=<name> RISC-V ISA string [default %s]\n", DEFAULT_ISA);
fprintf(stderr, " --pmpregions=<n> Number of PMP regions [default 16]\n");
+ fprintf(stderr, " --pmpgranularity=<n> PMP Granularity in bytes [default 4]\n");
fprintf(stderr, " --priv=<m|mu|msu> RISC-V privilege modes supported [default %s]\n", DEFAULT_PRIV);
fprintf(stderr, " --varch=<name> RISC-V Vector uArch string [default %s]\n", DEFAULT_VARCH);
fprintf(stderr, " --pc=<address> Override ELF entry point\n");
@@ -366,6 +367,7 @@ int main(int argc, char** argv)
/*default_misaligned=*/false,
/*default_endianness*/endianness_little,
/*default_pmpregions=*/16,
+ /*default_pmpgranularity=*/(1 << PMP_SHIFT),
/*default_mem_layout=*/parse_mem_layout("2048"),
/*default_hartids=*/std::vector<size_t>(),
/*default_real_time_clint=*/false,
@@ -406,6 +408,7 @@ int main(int argc, char** argv)
parser.option(0, "log-cache-miss", 0, [&](const char UNUSED *s){log_cache = true;});
parser.option(0, "isa", 1, [&](const char* s){cfg.isa = s;});
parser.option(0, "pmpregions", 1, [&](const char* s){cfg.pmpregions = atoul_safe(s);});
+ parser.option(0, "pmpgranularity", 1, [&](const char* s){cfg.pmpgranularity = atoul_safe(s);});
parser.option(0, "priv", 1, [&](const char* s){cfg.priv = s;});
parser.option(0, "varch", 1, [&](const char* s){cfg.varch = s;});
parser.option(0, "device", 1, device_parser);