hdl.ir: for instance ports, prioritize defs over uses.

Fixes #274.
This commit is contained in:
whitequark 2019-11-26 21:17:12 +00:00
parent f207f3f620
commit 56bb42aff2
2 changed files with 24 additions and 1 deletions

View file

@ -266,6 +266,27 @@ class FragmentPortsTestCase(FHDLTestCase):
(s, "io")
]))
def test_in_out_same_signal(self):
s = Signal()
f1 = Instance("foo", i_x=s, o_y=s)
f2 = Fragment()
f2.add_subfragment(f1)
f2._propagate_ports(ports=(), all_undef_as_ports=True)
self.assertEqual(f1.ports, SignalDict([
(s, "o")
]))
f3 = Instance("foo", o_y=s, i_x=s)
f4 = Fragment()
f4.add_subfragment(f3)
f4._propagate_ports(ports=(), all_undef_as_ports=True)
self.assertEqual(f3.ports, SignalDict([
(s, "o")
]))
def test_clk_rst(self):
sync = ClockDomain()
f = Fragment()