From bb582619eb0d64187c1f470d7e656eaa5c14e92d Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Tue, 25 Apr 2017 15:13:47 +0200 Subject: [PATCH] gen/genlib/cdc: cleanup lcm computation, fix timeout on BusSynchronizer --- litex/gen/genlib/cdc.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/litex/gen/genlib/cdc.py b/litex/gen/genlib/cdc.py index 2f9efabc..e7e09add 100644 --- a/litex/gen/genlib/cdc.py +++ b/litex/gen/genlib/cdc.py @@ -7,6 +7,7 @@ from litex.gen.fhdl.structure import * from litex.gen.fhdl.module import Module from litex.gen.fhdl.specials import Special, Memory from litex.gen.fhdl.bitcontainer import value_bits_sign +from litex.gen.fhdl.decorators import ClockDomainsRenamer from litex.gen.genlib.misc import WaitTimer from litex.gen.genlib.resetsync import AsyncResetSynchronizer @@ -99,7 +100,8 @@ class BusSynchronizer(Module): sync_i += starter.eq(0) self.submodules._ping = PulseSynchronizer(idomain, odomain) self.submodules._pong = PulseSynchronizer(odomain, idomain) - self.submodules._timeout = WaitTimer(timeout) + self.submodules._timeout = ClockDomainsRenamer(idomain)( + WaitTimer(timeout)) self.comb += [ self._timeout.wait.eq(~self._ping.i), self._ping.i.eq(starter | self._pong.o | self._timeout.done), @@ -198,7 +200,7 @@ class ElasticBuffer(Module): def lcm(a, b): """Compute the lowest common multiple of a and b""" - return int(a * b / gcd(a, b)) + return (a*b)//gcd(a, b) class Gearbox(Module): -- 2.30.2