From: Robert Jordens Date: Fri, 3 Apr 2015 20:55:20 +0000 (-0600) Subject: decorators: fix class/instance logic X-Git-Tag: 24jan2021_ls180~2099^2~127 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e702fb772791c8ac8b1c658e1f7dc97b30f592c5;p=litex.git decorators: fix class/instance logic --- diff --git a/migen/fhdl/decorators.py b/migen/fhdl/decorators.py index 815d7fcd..b6e906cd 100644 --- a/migen/fhdl/decorators.py +++ b/migen/fhdl/decorators.py @@ -1,6 +1,7 @@ import warnings from migen.fhdl.structure import * +from migen.fhdl.module import Module from migen.fhdl.tools import insert_reset, rename_clock_domain class ModuleTransformer: @@ -40,10 +41,10 @@ class ModuleTransformer: return victim def __call__(self, victim): - try: - return self.wrap_class(victim) - except TypeError: + if isinstance(victim, Module): return self.wrap_instance(victim) + else: + return self.wrap_class(victim) @classmethod def adhoc(cls, i, *args, **kwargs):