move microwatt_mmu bool variable to pspec
authorTobias Platen <tplaten@posteo.de>
Sat, 16 Jan 2021 16:43:46 +0000 (17:43 +0100)
committerTobias Platen <tplaten@posteo.de>
Sat, 16 Jan 2021 16:43:46 +0000 (17:43 +0100)
src/soc/fu/compunits/compunits.py
src/soc/fu/mmu/test/test_issuer_mmu_data_path.py
src/soc/simple/core.py
src/soc/simple/test/test_issuer.py

index 4129d36891e641e588abf9918830b02188880894..d2a0e54684f5b0514cf6df16ce70ea13ce757cf4 100644 (file)
@@ -238,9 +238,11 @@ class AllFunctionUnits(Elaboratable):
 
     """
 
-    def __init__(self, pspec, pilist=None, div_fsm=True,microwatt_mmu = False):
+    def __init__(self, pspec, pilist=None, div_fsm=True):
         addrwid = pspec.addr_wid
         units = pspec.units
+        microwatt_mmu = hasattr(pspec, "mmu") and pspec.mmu == True
+        print("AllFunctionUnits.microwatt_mmu="+str(microwatt_mmu))
         if not isinstance(units, dict):
             units = {'alu': 1, 'cr': 1, 'branch': 1, 'trap': 1,
                      'spr': 1,
index 60011e3b3ceb1203852019188e30a7cbf904a658..f2e12b998b466e6480cd38fec32ac22083ee29ec 100644 (file)
@@ -28,7 +28,7 @@ class MMUDataPathTestCase(TestAccumulatorBase):
 if __name__ == "__main__":
     unittest.main(exit=False)
     suite = unittest.TestSuite()
-    suite.addTest(TestRunner(MMUDataPathTestCase().test_data))
+    suite.addTest(TestRunner(MMUDataPathTestCase().test_data,microwatt_mmu=True))
 
     runner = unittest.TextTestRunner()
     runner.run(suite)
index 04d3604ec9c741a0668de341968fafea93b2f7bc..9d115a3dc297e450b5fc02e854a90b9c8b0d28bc 100644 (file)
@@ -68,7 +68,7 @@ def sort_fuspecs(fuspecs):
 
 
 class NonProductionCore(Elaboratable):
-    def __init__(self, pspec, microwatt_mmu = False):
+    def __init__(self, pspec):
         self.pspec = pspec
 
         # single LD/ST funnel for memory access
@@ -76,8 +76,8 @@ class NonProductionCore(Elaboratable):
         pi = self.l0.l0.dports[0]
 
         # function units (only one each)
-        self.microwatt_mmu = microwatt_mmu
-        self.fus = AllFunctionUnits(pspec, pilist=[pi], microwatt_mmu = self.microwatt_mmu)
+        # only include mmu if enabled in pspec
+        self.fus = AllFunctionUnits(pspec, pilist=[pi])
 
         # register files (yes plural)
         self.regs = RegFiles()
index 708eb1ff44da44a7097585518cb580e9ff94d4a1..ea5a5c27e2469abd1e11bf595337891b71ea2d2d 100644 (file)
@@ -132,9 +132,10 @@ def get_dmi(dmi, addr):
 
 
 class TestRunner(FHDLTestCase):
-    def __init__(self, tst_data):
+    def __init__(self, tst_data, microwatt_mmu=False):
         super().__init__("run_all")
         self.test_data = tst_data
+        self.microwatt_mmu = microwatt_mmu
 
     def run_all(self):
         m = Module()
@@ -151,6 +152,7 @@ class TestRunner(FHDLTestCase):
                              nocore=False,
                              xics=False,
                              gpio=False,
+                             mmu=self.microwatt_mmu,
                              reg_wid=64)
         m.submodules.issuer = issuer = TestIssuerInternal(pspec)
         imem = issuer.imem._get_memory()
@@ -306,7 +308,7 @@ class TestRunner(FHDLTestCase):
                                 (test.name, int_reg, value))
 
         sim.add_sync_process(process)
-        with sim.write_vcd("issuer_simulator.vcd",
+        with sim.write_vcd("issuer_simulator.vcd","issuer_simulator.gtkw",
                            traces=[]):
             sim.run()