Skip to content

Commit

Permalink
Merge pull request chipsalliance#959 from antmicro/renode-fixes
Browse files Browse the repository at this point in the history
ISS usage fixes
  • Loading branch information
mkurc-ant authored Oct 9, 2023
2 parents 71666eb + 76be52e commit f01f628
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 5 deletions.
4 changes: 4 additions & 0 deletions run.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -167,6 +170,7 @@ def parse_iss_yaml(iss, iss_yaml, isa, setting_dir, debug_cmd):
else:
cmd = re.sub("\<variant\>", isa, cmd)
cmd = re.sub("\<scripts_path\>", scripts_dir, cmd)
cmd = re.sub("\<config_path\>", yaml_dir, cmd)
return cmd
logging.error("Cannot find ISS {}".format(iss))
sys.exit(RET_FAIL)
Expand Down
4 changes: 4 additions & 0 deletions scripts/renode_log_to_trace_csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 11 additions & 2 deletions scripts/renode_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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
"""
Expand Down Expand Up @@ -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()

Expand All @@ -84,6 +92,7 @@ def main():
"repl": repl,
"resc": resc,
"log": args.log,
"mem": args.mem_size,
}

# Render REPL template
Expand Down
6 changes: 3 additions & 3 deletions yaml/iss.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
- iss: spike
path_var: SPIKE_PATH
cmd: >
<path_var>/spike --log-commits --isa=<variant> -l <elf>
<path_var>/spike --log-commits --isa=<variant> --misaligned -l <elf>
- iss: ovpsim
path_var: OVPSIM_PATH
Expand All @@ -35,9 +35,9 @@
- iss: whisper
path_var: WHISPER_ISS
cmd: >
<path_var> <elf> --log --xlen <xlen> --isa <variant>
<path_var> <elf> --log --xlen <xlen> --isa <variant> --configfile <config_path>/whisper.json --iccmrw
- iss: renode
path_var: RENODE_PATH
cmd: >
python3 <scripts_path>/renode_wrapper.py --renode "<path_var>" --elf <elf> --isa <variant>
python3 <scripts_path>/renode_wrapper.py --renode "<path_var>" --elf <elf> --isa <variant> --mem-size 0x80000000
7 changes: 7 additions & 0 deletions yaml/whisper.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"iccm": {
"region": "0",
"size": "0x80000000",
"offset": "0x80000000"
}
}

0 comments on commit f01f628

Please sign in to comment.