wishbone2lasmi : add support for 32 bits lasmim data width
authorFlorent Kermarrec <florent@enjoy-digital.fr>
Tue, 20 Aug 2013 14:53:55 +0000 (16:53 +0200)
committerSebastien Bourdeauducq <sebastien@milkymist.org>
Tue, 20 Aug 2013 16:49:46 +0000 (18:49 +0200)
migen/bus/wishbone2lasmi.py

index 4c7881cdd7e6c07c5b2efc493f79fa70e0274838..75fd9fd7108fc1b30ab046d2b8fbadd7de5c77a7 100644 (file)
@@ -11,8 +11,8 @@ class WB2LASMI(Module):
 
                ###
 
-               if lasmim.dw <= 32:
-                       raise ValueError("LASMI data width must be strictly larger than 32")
+               if lasmim.dw < 32:
+                       raise ValueError("LASMI data width must be >= 32")
                if (lasmim.dw % 32) != 0:
                        raise ValueError("LASMI data width must be a multiple of 32")
 
@@ -31,7 +31,12 @@ class WB2LASMI(Module):
                
                write_from_lasmi = Signal()
                write_to_lasmi = Signal()
-               adr_offset_r = Signal(offsetbits)
+               if adr_offset is None:
+                       adr_offset_r = None
+               else:
+                       adr_offset_r = Signal(offsetbits)
+                       self.sync += adr_offset_r.eq(adr_offset)
+
                self.comb += [
                        data_port.adr.eq(adr_line),
                        If(write_from_lasmi,
@@ -49,7 +54,7 @@ class WB2LASMI(Module):
                        ),
                        chooser(data_port.dat_r, adr_offset_r, self.wishbone.dat_r, reverse=True)
                ]
-               self.sync += adr_offset_r.eq(adr_offset)
+
                
                # Tag memory
                tag_layout = [("tag", tagbits), ("dirty", 1)]