From 5bdb9d4d7e8b8e113606446fe64ab7af9c17850a Mon Sep 17 00:00:00 2001 From: Karthik B K Date: Sat, 4 Nov 2023 15:55:21 +0530 Subject: 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= to spike. Signed-off-by: Karthik B K --- spike_main/spike-log-parser.cc | 1 + spike_main/spike.cc | 3 +++ 2 files changed, 4 insertions(+) (limited to 'spike_main') 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(), /*default_hartids=*/std::vector(), /*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= Read commands from file (use with -d)\n"); fprintf(stderr, " --isa= RISC-V ISA string [default %s]\n", DEFAULT_ISA); fprintf(stderr, " --pmpregions= Number of PMP regions [default 16]\n"); + fprintf(stderr, " --pmpgranularity= PMP Granularity in bytes [default 4]\n"); fprintf(stderr, " --priv= RISC-V privilege modes supported [default %s]\n", DEFAULT_PRIV); fprintf(stderr, " --varch= RISC-V Vector uArch string [default %s]\n", DEFAULT_VARCH); fprintf(stderr, " --pc=
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(), /*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); -- cgit v1.1