Replace Signal(bits_for(... with Signal(max=...
authorSebastien Bourdeauducq <sebastien@milkymist.org>
Thu, 29 Nov 2012 22:41:51 +0000 (23:41 +0100)
committerSebastien Bourdeauducq <sebastien@milkymist.org>
Thu, 29 Nov 2012 22:41:51 +0000 (23:41 +0100)
milkymist/asmicon/bankmachine.py
milkymist/asmicon/multiplexer.py
milkymist/asmicon/refresher.py

index 1fe39f4da6d6b5467f0dac131068d7a4bad5d38a..8b17408111ad88c2d6244463c0e5d713b45c20a5 100644 (file)
@@ -42,7 +42,7 @@ class _Selector:
                self.nslots = len(self.slots)
                self.stb = Signal()
                self.ack = Signal()
-               self.tag = Signal(bits_for(self.nslots-1))
+               self.tag = Signal(max=self.nslots)
                self.adr = Signal(self.slots[0].adr.nbits)
                self.we = Signal()
                
@@ -238,7 +238,7 @@ class BankMachine:
                # Respect write-to-precharge specification
                precharge_ok = Signal()
                t_unsafe_precharge = 2 + self.timing_settings.tWR - 1
-               unsafe_precharge_count = Signal(bits_for(t_unsafe_precharge))
+               unsafe_precharge_count = Signal(max=t_unsafe_precharge+1)
                comb.append(precharge_ok.eq(unsafe_precharge_count == 0))
                sync += [
                        If(self.cmd.stb & self.cmd.ack & self.cmd.is_write,
index 7c1745848f9dcae58b8267af4c7bc3f4955a971c..6258e6b007df2c73909cf1df6a8e32e7477bc441 100644 (file)
@@ -64,7 +64,7 @@ class _Steerer:
                
                ncmd = len(self.commands)
                nph = len(self.dfi.phases)
-               self.sel = [Signal(bits_for(ncmd-1)) for i in range(nph)]
+               self.sel = [Signal(max=ncmd) for i in range(nph)]
        
        def get_fragment(self):
                comb = []
@@ -194,7 +194,7 @@ class Multiplexer:
                        max_time = Signal()
                        if timeout:
                                t = timeout - 1
-                               time = Signal(bits_for(t))
+                               time = Signal(max=t+1)
                                comb.append(max_time.eq(time == 0))
                                sync.append(
                                        If(~en,
index ccab764ef66a9c50737d7cdee8ec7024a03567ba..463f673aa447c3d076d1ef2e5a935c4b79207f81 100644 (file)
@@ -45,7 +45,7 @@ class Refresher:
                ])
                
                # Periodic refresh counter
-               counter = Signal(bits_for(self.tREFI - 1))
+               counter = Signal(max=self.tREFI)
                start = Signal()
                sync += [
                        start.eq(0),