Changed how caches are instantiated and configured.

Since it is preferred to have absl::Flags all in one file (the file with,
main()), how that flag is used to configure caches was changed to use config
objects in the X_top classes.

PiperOrigin-RevId: 679300970
Change-Id: I620f6848e28c8a5551940fabd6aa89e84c48ef5c
diff --git a/mpact/sim/generic/config.h b/mpact/sim/generic/config.h
index ce7f8d6..68aaf24 100644
--- a/mpact/sim/generic/config.h
+++ b/mpact/sim/generic/config.h
@@ -142,7 +142,7 @@
   // Add a callback on value written. Some configuration entries may be
   // modifiable during simulation, for example, an adjustable trade-off between
   // accuracy and speed, requiring a notification when the value changes. This
-  // supports this usecase. Note, the callback is made whenever the value is
+  // supports this use-case. Note, the callback is made whenever the value is
   // written to, not just if it changes.
   template <typename F>
   void AddValueWrittenCallback(F callback) {
diff --git a/mpact/sim/generic/test/config_test.cc b/mpact/sim/generic/test/config_test.cc
index e2ad820..47ae18a 100644
--- a/mpact/sim/generic/test/config_test.cc
+++ b/mpact/sim/generic/test/config_test.cc
@@ -18,13 +18,11 @@
 #include <memory>
 #include <string>
 #include <utility>
-#include <variant>
 #include <vector>
 
 #include "absl/container/btree_map.h"
-#include "absl/memory/memory.h"
 #include "absl/status/status.h"
-#include "googlemock/include/gmock/gmock.h"
+#include "googlemock/include/gmock/gmock.h"  // IWYU pragma: keep
 #include "googletest/include/gtest/gtest.h"
 #include "mpact/sim/proto/component_data.pb.h"
 #include "src/google/protobuf/text_format.h"
diff --git a/mpact/sim/util/renode/renode_cs/MpactCheriotCPU.cs b/mpact/sim/util/renode/renode_cs/MpactCheriotCPU.cs
index a2107e8..211b05e 100644
--- a/mpact/sim/util/renode/renode_cs/MpactCheriotCPU.cs
+++ b/mpact/sim/util/renode/renode_cs/MpactCheriotCPU.cs
@@ -89,6 +89,14 @@
             config_names.Add("clintPeriod");
             config_values.Add(clint_period.ToString("X"));
         }
+        if (icache_config != "") {
+            config_names.Add("iCache");
+            config_values.Add(icache_config);
+        }
+        if (dcache_config != "") {
+            config_names.Add("dCache");
+            config_values.Add(dcache_config);
+        }
     }
 
     public bool InstProfile {
@@ -111,6 +119,16 @@
         set => clint_period = value;
     }
 
+    public string ICache {
+        get => icache_config;
+        set => icache_config = value;
+    }
+
+    public string DCache {
+        get => dcache_config;
+        set => dcache_config = value;
+    }
+
     // ICPUWithHooks methods.
 
     public void AddHookAtInterruptBegin(Action<ulong> hook) {
@@ -187,6 +205,8 @@
     private UInt64 revocationMemBase;
     private UInt64 clint_mmr_base = 0x0;
     private UInt64 clint_period = 0;
+    private string icache_config = "";
+    private string dcache_config = "";
     private List<GDBFeatureDescriptor>
                 gdbFeatures = new List<GDBFeatureDescriptor>();
 }  // class MpactCheriotCPU
diff --git a/mpact/sim/util/renode/renode_cs/MpactRiscVCPU.cs b/mpact/sim/util/renode/renode_cs/MpactRiscVCPU.cs
index 12fa0cd..1d273f6 100644
--- a/mpact/sim/util/renode/renode_cs/MpactRiscVCPU.cs
+++ b/mpact/sim/util/renode/renode_cs/MpactRiscVCPU.cs
@@ -83,6 +83,14 @@
             config_names.Add("stackEnd");
             config_values.Add(stack_end.ToString("X"));
         }
+        if (icache_config != "") {
+            config_names.Add("iCache");
+            config_values.Add(icache_config);
+        }
+        if (dcache_config != "") {
+            config_names.Add("dCache");
+            config_values.Add(dcache_config);
+        }
     }
 
     public bool InstProfile {
@@ -111,6 +119,16 @@
         }
     }
 
+    public string ICache {
+        get => icache_config;
+        set => icache_config = value;
+    }
+
+    public string DCache {
+        get => dcache_config;
+        set => dcache_config = value;
+    }
+
     // ICPUWithHooks methods.
 
     public void AddHookAtInterruptBegin(Action<ulong> hook) {
@@ -188,6 +206,8 @@
     private bool stack_size_set = false;
     private ulong stack_end;
     private bool stack_end_set = false;
+    private string icache_config = "";
+    private string dcache_config = "";
     private List<GDBFeatureDescriptor>
                 gdbFeatures = new List<GDBFeatureDescriptor>();
 }  // class MpactRiscVCPU