bank = csrgen.Bank([oreg, ireg])
f = bank.get_fragment() + inf
i = bank.interface
-ofield.dev_r.name = "gpio_out"
+ofield.dev_r.name_override = "gpio_out"
v = verilog.convert(f, {i.d_o, ofield.dev_r, i.a_i, i.we_i, i.d_i, gpio_in})
print(v)
def name_backtrace(root, backtrace):
parts = []
- for step in backtrace:
+ for step in backtrace[:-1]:
n = obj_name(step[0])
found = list(filter(lambda x: x.name == n, root.children))
node = found[0]
parts.append(node.name)
if node.include_varname and step[1] is not None:
parts.append(step[1])
+ root = node
+ last = backtrace[-1]
+ if last[1] is not None:
+ parts.append(last[1])
+ else:
+ parts.append(obj_name(last[0]))
return "_".join(parts)
def _include_divergence(root, bt1, bt2):
for step1, step2 in zip(bt1, bt2):
n1, n2 = obj_name(step1[0]), obj_name(step2[0])
- node1 = list(filter(lambda x: x.name == n1, root.children))
- node2 = list(filter(lambda x: x.name == n2, root.children))
+ node1 = list(filter(lambda x: x.name == n1, root.children))[0]
+ node2 = list(filter(lambda x: x.name == n2, root.children))[0]
if node1 != node2:
node1.include_context = True
node2.include_context = True
def resolve_conflicts(root, signals):
for s1, s2 in combinations(signals, 2):
- if name_backtrace(root, s1) == name_backtrace(root, s2):
+ if name_backtrace(root, s1.backtrace) == name_backtrace(root, s2.backtrace):
_include_divergence(root, s1.backtrace, s2.backtrace)
def build_tree_res(signals):
# to run the combinatorial process once at the beginning.
syn_off = "// synthesis translate off\n"
syn_on = "// synthesis translate on\n"
- dummy_s = Signal()
+ dummy_s = Signal(name_override="dummy_s")
r += syn_off
r += "reg " + _printsig(ns, dummy_s) + ";\n"
r += "initial " + ns.get_name(dummy_s) + " <= 1'b0;\n"
if len(g[1]) == 1 and isinstance(g[1][0], _Assign):
r += "assign " + _printnode(ns, _AT_BLOCKING, 0, g[1][0])
else:
- dummy_d = Signal()
+ dummy_d = Signal(name_override="dummy_d")
r += "\n" + syn_off
r += "reg " + _printsig(ns, dummy_d) + ";\n"
r += syn_on