in a terrible botched way, get at I-Cache and set it up
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sun, 12 Dec 2021 13:15:51 +0000 (13:15 +0000)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sun, 12 Dec 2021 13:15:51 +0000 (13:15 +0000)
this is for adding in I-Cache and MMU into core.

src/soc/config/ifetch.py
src/soc/experiment/icache.py
src/soc/simple/core.py
src/soc/simple/issuer.py

index b33d7464fdfa5e1eea5e187b7d09ea5048f899e7..35a9ddec0d230aa8f6354871faad6aa202dd7a33 100644 (file)
@@ -20,9 +20,11 @@ class ConfigFetchUnit:
                   }
         self.pspec = pspec
         if self.pspec.imem_ifacetype in ['mmu_cache_wb', 'test_mmu_cache_wb']:
-            self.fu = self.lsmem.lsi.icache # ICache already FetchUnitInterface
+            # XXX BLECH! use pspec to transfer the I-Cache which is
+            # created down inside LoadStore1!
+            self.fu = icache = pspec.icache # ICache already FetchUnitInterface
             # tell I-Cache to connect up to its FetchUnitInterface
-            self.fu.use_fetch_interface()
+            icache.use_fetch_interface()
             return
 
         fukls = fudict[pspec.imem_ifacetype]
index cb42f1b63abdcd9fa9917e716c010a0215f28ed3..f66e2210e91a3e1cf00feb70a4cbcf2a748580b7 100644 (file)
@@ -890,7 +890,6 @@ class ICache(FetchUnitInterface, Elaboratable):
         if hasattr(ibus, "stall"):
             comb += self.bus.stall.eq(ibus.stall)
 
-
         return m
 
 
index 1d8d3d72427999947520b0ebffddb0745d18b9eb..6bca3bd8b02215bb0f61c8468cc8297582d0a699 100644 (file)
@@ -156,6 +156,8 @@ class NonProductionCore(ControlBase):
             lsi = l0.cmpi.lsmem.lsi # a LoadStore1 Interface object
             print ("core lsmem.lsi", lsi)
             mmu.alu.set_ldst_interface(lsi)
+            # urr store I-Cache in core so it is easier to get at
+            self.icache = lsi.icache
 
         # register files (yes plural)
         self.regs = RegFiles(pspec, make_hazard_vecs=self.make_hazard_vecs)
index 6aa790191c38a96d01d608a817d09417c50b6bdb..9c40e45d85bc9c8185499d7be0bbf4b0e20d096a 100644 (file)
@@ -48,7 +48,7 @@ from soc.bus.SPBlock512W64B8W import SPBlock512W64B8W
 from soc.clock.select import ClockSelect
 from soc.clock.dummypll import DummyPLL
 from openpower.sv.svstate import SVSTATERec
-
+from soc.experiment.icache import ICache
 
 from nmutil.util import rising_edge
 
@@ -433,6 +433,10 @@ class TestIssuerInternal(Elaboratable):
             self.svp64 = SVP64PrefixDecoder()  # for decoding SVP64 prefix
 
         # Test Instruction memory
+        if hasattr(core, "icache"):
+            # XXX BLECH! use pspec to transfer the I-Cache to ConfigFetchUnit
+            # truly dreadful.  needs a huge reorg.
+            pspec.icache = core.icache
         self.imem = ConfigFetchUnit(pspec).fu
 
         # DMI interface
@@ -1017,7 +1021,10 @@ class TestIssuerInternal(Elaboratable):
         dbd = DomainRenamer(self.dbg_domain)
 
         m.submodules.core = core = csd(self.core)
-        m.submodules.imem = imem = csd(self.imem)
+        # this _so_ needs sorting out.  ICache is added down inside
+        # LoadStore1 and is already a submodule of LoadStore1
+        if not isinstance(self.imem, ICache):
+            m.submodules.imem = imem = csd(self.imem)
         m.submodules.dbg = dbg = dbd(self.dbg)
         if self.jtag_en:
             m.submodules.jtag = jtag = dbd(self.jtag)