undo code removed by commit 12297566322355ce5fed2e2a5460bea54f69e79e
authorTobias Platen <tplaten@posteo.de>
Tue, 9 Jun 2020 13:05:10 +0000 (15:05 +0200)
committerTobias Platen <tplaten@posteo.de>
Tue, 9 Jun 2020 13:05:10 +0000 (15:05 +0200)
src/soc/experiment/l0_cache.py

index e86d9eae0269e8496299cadf75e879cbb3a143df..e43cf9b0134e4eceab9c11292f42d27e53b9c8f9 100644 (file)
@@ -318,11 +318,19 @@ class L0CacheBuffer(Elaboratable):
     def __init__(self, n_units, mem, regwid=64, addrwid=48):
         self.n_units = n_units
         self.mem = mem
+        self.regwid = regwid
+        self.addrwid = addrwid
         ul = []
         for i in range(n_units):
             ul.append(LDSTPort(i, regwid, addrwid))
         self.dports = Array(ul)
 
+    def truncaddr(self, addr):
+        """truncates the address to the top bits of the memory granularity
+        """
+        nbits = log2_int(self.mem.regwid)
+        return addr[nbits:]
+
     def elaborate(self, platform):
         m = Module()
         comb, sync = m.d.comb, m.d.sync