parameterise LoadStoreUnitInterface to be expandable
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 19 Jun 2020 01:44:24 +0000 (02:44 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 19 Jun 2020 01:44:24 +0000 (02:44 +0100)
src/soc/minerva/units/loadstore.py

index b081de8264db6345273f6fff9c8e21adf7da8eb7..b14bbbd769affe5739921329bb57666d76fea988 100644 (file)
@@ -11,14 +11,14 @@ __all__ = ["LoadStoreUnitInterface", "BareLoadStoreUnit",
 
 
 class LoadStoreUnitInterface:
-    def __init__(self):
+    def __init__(self, addr_wid=32, mask_wid=4, data_wid=32):
         self.dbus = Record(wishbone_layout)
 
-        self.x_addr = Signal(32)
-        self.x_mask = Signal(4)
+        self.x_addr = Signal(addr_wid)
+        self.x_mask = Signal(mask_wid)
         self.x_load = Signal()
         self.x_store = Signal()
-        self.x_store_data = Signal(32)
+        self.x_store_data = Signal(data_wid)
         self.x_stall = Signal()
         self.x_valid = Signal()
         self.m_stall = Signal()
@@ -26,10 +26,10 @@ class LoadStoreUnitInterface:
 
         self.x_busy = Signal()
         self.m_busy = Signal()
-        self.m_load_data = Signal(32)
+        self.m_load_data = Signal(data_wid)
         self.m_load_error = Signal()
         self.m_store_error = Signal()
-        self.m_badaddr = Signal(30)
+        self.m_badaddr = Signal(addr_wid-log2_int(mask_wid))
 
 
 class BareLoadStoreUnit(LoadStoreUnitInterface, Elaboratable):