From 1857ec6c32c47f36e1b3d67d31e9a27cc63a673f Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Tue, 22 Sep 2015 14:30:16 +0800 Subject: [PATCH] fhdl/namer: support ClockSignal and ResetSignal. Closes #24 --- migen/fhdl/namer.py | 9 +++++++++ migen/fhdl/verilog.py | 1 + 2 files changed, 10 insertions(+) diff --git a/migen/fhdl/namer.py b/migen/fhdl/namer.py index eaf23a0c..e6c18cb0 100644 --- a/migen/fhdl/namer.py +++ b/migen/fhdl/namer.py @@ -227,8 +227,17 @@ class Namespace: self.counts = {k: 1 for k in reserved_keywords} self.sigs = {} self.pnd = pnd + self.clock_domains = dict() def get_name(self, sig): + if isinstance(sig, ClockSignal): + sig = self.clock_domains[sig.cd].clk + if isinstance(sig, ResetSignal): + sig = self.clock_domains[sig.cd].rst + if sig is None: + raise ValueError("Attempted to obtain name of non-existent " + "reset signal of domain "+sig.cd) + if sig.name_override is not None: sig_name = sig.name_override else: diff --git a/migen/fhdl/verilog.py b/migen/fhdl/verilog.py index d5d878c9..23207305 100644 --- a/migen/fhdl/verilog.py +++ b/migen/fhdl/verilog.py @@ -342,6 +342,7 @@ def convert(f, ios=None, name="top", ns = build_namespace(list_signals(f) \ | list_special_ios(f, True, True, True) \ | ios, _reserved_keywords) + ns.clock_domains = f.clock_domains r.ns = ns src = "/* Machine-generated using Migen */\n" -- 2.30.2