hdl.ir: rework named port handling for Instances.

The main purpose of this rework is cleanup, to avoid specifying
the direction of input ports in an implicit, ad-hoc way using
the named ports and ports dictionaries.

While working on this I realized that output ports can be connected
to anything that is valid on LHS, so this is now supported too.
This commit is contained in:
whitequark 2019-04-22 07:46:47 +00:00
parent aed2062101
commit 585514e6ed
4 changed files with 26 additions and 29 deletions

View file

@ -669,7 +669,7 @@ class _StatementCompiler(xfrm.StatementVisitor):
def convert_fragment(builder, fragment, hierarchy):
if isinstance(fragment, ir.Instance):
port_map = OrderedDict()
for port_name, value in fragment.named_ports.items():
for port_name, (value, dir) in fragment.named_ports.items():
port_map["\\{}".format(port_name)] = value
if fragment.type[0] == "$":