fix timeout
authorFlorent Kermarrec <florent@enjoy-digital.fr>
Fri, 6 Feb 2015 11:42:42 +0000 (12:42 +0100)
committerFlorent Kermarrec <florent@enjoy-digital.fr>
Fri, 6 Feb 2015 11:42:42 +0000 (12:42 +0100)
litesata/common.py

index 2a7bca0c4cf68a9133f90d5656450a1cd9d16ced..743edeb842d16a762db9091036553c9d8ca3cdda 100644 (file)
@@ -270,8 +270,8 @@ class Timeout(Module):
                self.reached = Signal()
                ###
                value = Signal(max=length)
-               self.sync += value.eq(value+1)
-               self.comb += self.reached.eq(value == length)
+               self.sync += If(~self.reached, value.eq(value+1))
+               self.comb += self.reached.eq(value == (length-1))
 
 class BufferizeEndpoints(ModuleDecorator):
        def __init__(self, submodule, *args):