From: Sebastien Bourdeauducq Date: Sun, 18 Dec 2011 20:47:29 +0000 (+0100) Subject: fhdl: also take into account object attributes in _make_signal_name. Get rid of decla... X-Git-Tag: 24jan2021_ls180~2099^2~1125 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=dd42b2daffc072e3a44d3ba311a41c7c30a85352;p=litex.git fhdl: also take into account object attributes in _make_signal_name. Get rid of declare_signal --- diff --git a/migen/fhdl/structure.py b/migen/fhdl/structure.py index 9148e46e..4d593f53 100644 --- a/migen/fhdl/structure.py +++ b/migen/fhdl/structure.py @@ -128,9 +128,11 @@ def _cst(x): def _make_signal_name(): frame = inspect.currentframe().f_back.f_back line = inspect.getframeinfo(frame).code_context[0] - m = re.match('[\t ]*([0-9A-Za-z_]+) =', line) + m = re.match('[\t ]*([0-9A-Za-z_\.]+) =', line) if m is None: return None name = m.group(1) + name = name.split('.') + name = name[len(name)-1] modules = frame.f_globals["__name__"] if modules != "__main__": modules = modules.split('.') @@ -151,15 +153,6 @@ class Signal(Value): def __hash__(self): return id(self) -def declare_signal(parent, name, bv=BV(), variable=False, reset=0): - # try to find a meaningful prefix - if parent.__module__ == "__main__": - prefix = parent.__class__.__name__ - else: - modules = parent.__module__.split('.') - prefix = modules[len(modules)-1] - setattr(parent, name, Signal(bv, prefix + "_" + name, variable, reset)) - # statements class Assign: