soc_core: add automatic down-conversion of CPU buses to 32-bit (if needed)
authorFlorent Kermarrec <florent@enjoy-digital.fr>
Fri, 11 Oct 2019 06:59:25 +0000 (08:59 +0200)
committerFlorent Kermarrec <florent@enjoy-digital.fr>
Fri, 11 Oct 2019 07:01:08 +0000 (09:01 +0200)
litex/soc/integration/soc_core.py
litex/soc/interconnect/wishbone.py

index 0284252f2aba5042492c1c5851e5b30450bc4856..eecfb54a01d5d37799e902f2c3d8d32810f4620d 100644 (file)
@@ -184,6 +184,12 @@ class SoCCore(Module):
 
             # Add CPU buses as Wisbone masters
             for bus in self.cpu.buses:
+                assert bus.data_width in [32, 64, 128]
+                # Down Convert CPU buses to 32-bit if needed
+                if bus.data_width != 32:
+                    dc_bus = wishbone.Interface()
+                    self.submodules += wishbone.Converter(bus, dc_bus)
+                    bus = dc_bus
                 self.add_wb_master(bus)
 
             # Add CPU CSR (dynamic)
index f76cdb4c4948c9d525fdfa01ac401c446a86fb94..d32799b6306619774b9d369f2af77a1d75bcce70 100644 (file)
@@ -34,6 +34,8 @@ _layout = [
 
 class Interface(Record):
     def __init__(self, data_width=32, adr_width=30):
+        self.data_width = data_width
+        self.adr_width  = adr_width
         Record.__init__(self, set_layout_parameters(_layout,
             adr_width=adr_width,
             data_width=data_width,