Skip to content

Commit

Permalink
renode_wrapper: Add configurable priv levels
Browse files Browse the repository at this point in the history
  • Loading branch information
MateuszKarlic committed Aug 23, 2024
1 parent 7a76cf3 commit 9622504
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
18 changes: 18 additions & 0 deletions scripts/renode_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
cpuType: "{isa}"
timeProvider: clint
hartId: 0
{priv_levels}
{additional_cpu_parameters}
clint: IRQControllers.CoreLevelInterruptor @ sysbus 0x02000000
Expand Down Expand Up @@ -83,6 +84,12 @@ def main():
default="Riscv32",
help="Renode CPU type",
)
parser.add_argument(
"--priv",
type=str,
default="",
help="Supported privilege levels",
)
# Some CPUs might not expose these parameters as configurable
# allow the testing software to ignore/override them if needed
parser.add_argument(
Expand All @@ -99,6 +106,16 @@ def main():
repl = os.path.join(tmpdir, "riscv.repl")
resc = os.path.join(tmpdir, "riscv.resc")

priv_levels = ""
if args.priv:
priv_levels += "privilegeLevels: PrivilegeLevels."
if "m" in args.priv:
priv_levels += "Machine"
if "s" in args.priv:
priv_levels += "Supervisor"
if "u" in args.priv:
priv_levels += "User"

params = {
"renode": args.renode,
"isa": args.isa,
Expand All @@ -108,6 +125,7 @@ def main():
"log": args.log,
"mem": args.mem_size,
"cpu_type": args.cpu_type,
"priv_levels": priv_levels,
"additional_cpu_parameters": args.additional_cpu_parameters,
}

Expand Down
2 changes: 1 addition & 1 deletion yaml/iss.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@
- iss: renode
path_var: RENODE_PATH
cmd: >
python3 <scripts_path>/renode_wrapper.py --renode "<path_var>" --elf <elf> --isa <variant> --mem-size 0x80000000
python3 <scripts_path>/renode_wrapper.py --renode "<path_var>" --elf <elf> --isa <variant> --priv=m<priv> --mem-size 0x80000000

0 comments on commit 9622504

Please sign in to comment.