From a12703b4ee70d0940d8d11aaceb43f636fa3ab35 Mon Sep 17 00:00:00 2001 From: Rasmus Pedersen Date: Thu, 29 Jun 2023 14:13:49 +0200 Subject: [PATCH 1/3] litex_json2renode: only add cpu timeProvider if time_provider exists --- litex/tools/litex_json2renode.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/litex/tools/litex_json2renode.py b/litex/tools/litex_json2renode.py index 3cd37aa73..6259b6d40 100755 --- a/litex/tools/litex_json2renode.py +++ b/litex/tools/litex_json2renode.py @@ -297,7 +297,7 @@ def generate_cpu(csr, time_provider, number_of_cores): cpu{cpu_id}: CPU.{cpu_string.strip()} hartId: {cpu_id} """ - if cpu.get('supports_time_provider', False): + if cpu.get('supports_time_provider', False) and time_provider: result += f' timeProvider: {time_provider}\n' return result From 8d33dc364ff4daa2695fa35e8dface0e13f61271 Mon Sep 17 00:00:00 2001 From: Rasmus Pedersen Date: Fri, 30 Jun 2023 13:44:31 +0200 Subject: [PATCH 2/3] Only add "cpu PC " if opensbi is present --- litex/tools/litex_json2renode.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/litex/tools/litex_json2renode.py b/litex/tools/litex_json2renode.py index 6259b6d40..61bd82f04 100755 --- a/litex/tools/litex_json2renode.py +++ b/litex/tools/litex_json2renode.py @@ -889,8 +889,9 @@ showAnalyzer sysbus.uart Antmicro.Renode.Analyzers.LoggingUartAnalyzer sysbus LoadBinary @{} {} """.format(args.bios_binary, hex(opensbi_base)) - for cpu_id in range(0, number_of_cores): - result += f"cpu{cpu_id} PC {hex(opensbi_base)}\n" + if opensbi_base: + for cpu_id in range(0, number_of_cores): + result += f"cpu{cpu_id} PC {hex(opensbi_base)}\n" if args.tftp_ip: result += """ From 26ed13a3006f3c65e0e0219f462b524029e1f4bd Mon Sep 17 00:00:00 2001 From: Rasmus Pedersen Date: Fri, 30 Jun 2023 13:45:40 +0200 Subject: [PATCH 3/3] Assume cpu count 1 if not present --- litex/tools/litex_json2renode.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/litex/tools/litex_json2renode.py b/litex/tools/litex_json2renode.py index 61bd82f04..08a5440b5 100755 --- a/litex/tools/litex_json2renode.py +++ b/litex/tools/litex_json2renode.py @@ -214,7 +214,7 @@ def get_cpu_type(csr): return (kind, variant) def get_cpu_count(csr): - return csr['constants']['config_cpu_count'] + return csr['constants'].get('config_cpu_count', 1) vexriscv_common_kind = { 'name': 'VexRiscv',