diff --git a/run.py b/run.py index b6b8aa0a..ac323177 100644 --- a/run.py +++ b/run.py @@ -140,6 +140,9 @@ def parse_iss_yaml(iss, iss_yaml, isa, setting_dir, debug_cmd): logging.info("Processing ISS setup file : {}".format(iss_yaml)) yaml_data = read_yaml(iss_yaml) + # Path to the "yaml" subdirectory + yaml_dir = os.path.dirname(iss_yaml) + # Path to the "scripts" subdirectory my_path = os.path.dirname(os.path.realpath(__file__)) scripts_dir = os.path.join(my_path, "scripts") # Search for matched ISS @@ -167,6 +170,7 @@ def parse_iss_yaml(iss, iss_yaml, isa, setting_dir, debug_cmd): else: cmd = re.sub("\", isa, cmd) cmd = re.sub("\", scripts_dir, cmd) + cmd = re.sub("\", yaml_dir, cmd) return cmd logging.error("Cannot find ISS {}".format(iss)) sys.exit(RET_FAIL) diff --git a/scripts/renode_log_to_trace_csv.py b/scripts/renode_log_to_trace_csv.py index cee4a29a..351cf29b 100644 --- a/scripts/renode_log_to_trace_csv.py +++ b/scripts/renode_log_to_trace_csv.py @@ -78,6 +78,10 @@ def process_renode_sim_log(log_name, csv_name): if not line: continue + # We've hit ecall, quit + if line.startswith("ECALL:"): + break + # Skip non-regdump if not line.startswith("REGDUMP:"): continue diff --git a/scripts/renode_wrapper.py b/scripts/renode_wrapper.py index 245de927..4f56d582 100644 --- a/scripts/renode_wrapper.py +++ b/scripts/renode_wrapper.py @@ -8,12 +8,13 @@ REPL_TEMPLATE = """ memory: Memory.MappedMemory @ sysbus 0x80000000 - size: 0x10000 + size: {mem} cpu: CPU.RiscV32 @ sysbus cpuType: "{isa}" timeProvider: clint hartId: 0 + allowUnalignedAccesses: true clint: IRQControllers.CoreLevelInterruptor @ sysbus 0x02000000 [0,1] -> cpu@[3,7] @@ -29,8 +30,9 @@ cpu MaximumBlockSize 1 cpu SetHookAtBlockEnd "print('REGDUMP:' + ','.join(self.GetRegistersValues()))" +cpu InstallCustomInstructionHandlerFromString "00000000000000000000000001110011" "print('ECALL:');" -emulation RunFor "0.000100" +emulation RunFor "0.001" quit """ @@ -69,6 +71,12 @@ def main(): required=True, help="ELF file to run", ) + parser.add_argument( + "--mem-size", + type=str, + default="0x100000", + help="Memory size", + ) args = parser.parse_args() @@ -84,6 +92,7 @@ def main(): "repl": repl, "resc": resc, "log": args.log, + "mem": args.mem_size, } # Render REPL template diff --git a/yaml/iss.yaml b/yaml/iss.yaml index 8a8b6623..ecf3224a 100644 --- a/yaml/iss.yaml +++ b/yaml/iss.yaml @@ -15,7 +15,7 @@ - iss: spike path_var: SPIKE_PATH cmd: > - /spike --log-commits --isa= -l + /spike --log-commits --isa= --misaligned -l - iss: ovpsim path_var: OVPSIM_PATH @@ -35,9 +35,9 @@ - iss: whisper path_var: WHISPER_ISS cmd: > - --log --xlen --isa + --log --xlen --isa --configfile /whisper.json --iccmrw - iss: renode path_var: RENODE_PATH cmd: > - python3 /renode_wrapper.py --renode "" --elf --isa + python3 /renode_wrapper.py --renode "" --elf --isa --mem-size 0x80000000 diff --git a/yaml/whisper.json b/yaml/whisper.json new file mode 100644 index 00000000..62551c7c --- /dev/null +++ b/yaml/whisper.json @@ -0,0 +1,7 @@ +{ + "iccm": { + "region": "0", + "size": "0x80000000", + "offset": "0x80000000" + } +}