fhdl/structure: disable we_granularity when larger than width
authorSebastien Bourdeauducq <sebastien@milkymist.org>
Fri, 23 Nov 2012 22:08:12 +0000 (23:08 +0100)
committerSebastien Bourdeauducq <sebastien@milkymist.org>
Fri, 23 Nov 2012 22:08:12 +0000 (23:08 +0100)
migen/fhdl/structure.py

index 04bcdae7e3c12acc1c135e1c358eee588c705c55..791d47f558a9ba2fcf93f5f6ae375b4daa74e29f 100644 (file)
@@ -335,6 +335,8 @@ class Memory(HUID):
        def get_port(self, write_capable=False, async_read=False,
          has_re=False, we_granularity=0, mode=WRITE_FIRST,
          clock_domain="sys"):
+               if we_granularity >= self.width:
+                       we_granularity = 0
                adr = Signal(BV(bits_for(self.depth-1)))
                dat_r = Signal(BV(self.width))
                if write_capable: