bus/wb2lasmi: use existing interface to determine WB width to be consistent with...
authorSebastien Bourdeauducq <sebastien@milkymist.org>
Mon, 26 Aug 2013 18:33:34 +0000 (20:33 +0200)
committerSebastien Bourdeauducq <sebastien@milkymist.org>
Mon, 26 Aug 2013 18:33:34 +0000 (20:33 +0200)
migen/bus/wishbone2lasmi.py

index d8ce1d5b58f7858363c84c533ce5a63c225b126e..39a9daebedb9993c968c74f64876270007f87a66 100644 (file)
@@ -6,11 +6,14 @@ from migen.genlib.record import Record, layout_len
 
 # cachesize (in 32-bit words) is the size of the data store, must be a power of 2
 class WB2LASMI(Module):
-       def __init__(self, cachesize, lasmim, data_width=32):
-               self.wishbone = wishbone.Interface()
+       def __init__(self, cachesize, lasmim, wbm=None):
+               if wbm is None:
+                       wbm = wishbone.Interface()
+               self.wishbone = wbm
 
                ###
 
+               data_width = flen(self.wishbone.dat_r)
                if lasmim.dw < data_width:
                        raise ValueError("LASMI data width must be >= {dw}".format(dw=data_width))
                if (lasmim.dw % data_width) != 0: