wishbone2lasmi: fix wordbits computation
authorFlorent Kermarrec <florent@enjoy-digital.fr>
Wed, 30 Apr 2014 16:03:56 +0000 (18:03 +0200)
committerSebastien Bourdeauducq <sb@m-labs.hk>
Thu, 1 May 2014 11:32:18 +0000 (13:32 +0200)
migen/bus/wishbone2lasmi.py

index cda742e6c6f9099dffe359c3b22255aa27a3b5d3..bf722c274dbb015d3bfcaf9ccc2373624398dc09 100644 (file)
@@ -23,7 +23,7 @@ class WB2LASMI(Module):
                addressbits = lasmim.aw + offsetbits
                linebits = log2_int(cachesize) - offsetbits
                tagbits = addressbits - linebits
-               wordbits = data_width//lasmim.dw
+               wordbits = log2_int(max(data_width//lasmim.dw, 1))
                adr_offset, adr_line, adr_tag = split(self.wishbone.adr, offsetbits, linebits, tagbits)
                word = Signal(wordbits) if wordbits else None