fhdl/namer: support ClockSignal and ResetSignal. Closes #24

This commit is contained in:
Sebastien Bourdeauducq 2015-09-22 14:30:16 +08:00
parent 2c1553fea2
commit 1857ec6c32
2 changed files with 10 additions and 0 deletions

View File

@ -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:

View File

@ -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"