Allows setting a core version from command line and renode properties.
The version is specified as an integer, with 100 = 1.00, 150 = 1.50, etc.

Behavior of jal/jalr are changed for core versions greater than 100 (default).
In higher versions, when the destination register is not "ra", then an
unsealed return capability is returned as opposed to a sealed one.

PiperOrigin-RevId: 702487323
Change-Id: I3cdefd785a7eb793e1c50924aa434568a2930bf9
diff --git a/mpact/sim/util/renode/renode_cs/MpactCheriotCPU.cs b/mpact/sim/util/renode/renode_cs/MpactCheriotCPU.cs
index 211b05e..20c060d 100644
--- a/mpact/sim/util/renode/renode_cs/MpactCheriotCPU.cs
+++ b/mpact/sim/util/renode/renode_cs/MpactCheriotCPU.cs
@@ -97,6 +97,11 @@
             config_names.Add("dCache");
             config_values.Add(dcache_config);
         }
+        // If the core version is greater than 0.5, add it to the config.
+        if (core_version > 50) {
+            config_names.Add("coreVersion");
+            config_values.Add(core_version.ToString("X"));
+        }
     }
 
     public bool InstProfile {
@@ -129,6 +134,11 @@
         set => dcache_config = value;
     }
 
+    public uint CoreVersion {
+        get => core_version;
+        set => core_version = value;
+    }
+
     // ICPUWithHooks methods.
 
     public void AddHookAtInterruptBegin(Action<ulong> hook) {
@@ -205,6 +215,7 @@
     private UInt64 revocationMemBase;
     private UInt64 clint_mmr_base = 0x0;
     private UInt64 clint_period = 0;
+    private uint core_version = 50;  // Default is 50 (v0.5).
     private string icache_config = "";
     private string dcache_config = "";
     private List<GDBFeatureDescriptor>