Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: m-labs/nmigen
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 921f506e6938
Choose a base ref
...
head repository: m-labs/nmigen
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 39bc59c924c3
Choose a head ref
  • 1 commit
  • 2 files changed
  • 1 contributor

Commits on May 13, 2019

  1. Copy the full SHA
    39bc59c View commit details
Showing with 27 additions and 5 deletions.
  1. +6 −5 nmigen/hdl/ir.py
  2. +21 −0 nmigen/test/test_hdl_ir.py
11 changes: 6 additions & 5 deletions nmigen/hdl/ir.py
Original file line number Diff line number Diff line change
@@ -445,11 +445,6 @@ def lca_of(fragu, fragv):
for sig in uses:
if sig in defs:
lca = reduce(lca_of, uses[sig], defs[sig])

frag = defs[sig]
while frag != lca:
frag.add_ports(sig, dir="o")
frag = parent[frag]
else:
lca = reduce(lca_of, uses[sig])

@@ -460,6 +455,12 @@ def lca_of(fragu, fragv):
frag.add_ports(sig, dir="i")
frag = parent[frag]

if sig in defs:
frag = defs[sig]
while frag != lca:
frag.add_ports(sig, dir="o")
frag = parent[frag]

for sig in ios:
frag = ios[sig]
while frag is not None:
21 changes: 21 additions & 0 deletions nmigen/test/test_hdl_ir.py
Original file line number Diff line number Diff line change
@@ -156,6 +156,27 @@ def test_output_from_subfragment(self):
(self.c2, "o"),
]))

def test_output_from_subfragment_2(self):
f1 = Fragment()
f1.add_statements(
self.c1.eq(self.s1)
)
f2 = Fragment()
f2.add_statements(
self.c2.eq(self.s1)
)
f1.add_subfragment(f2)
f3 = Fragment()
f3.add_statements(
self.s1.eq(0)
)
f2.add_subfragment(f3)

f1._propagate_ports(ports=(), all_undef_as_ports=True)
self.assertEqual(f2.ports, SignalDict([
(self.s1, "o"),
]))

def test_input_output_sibling(self):
f1 = Fragment()
f2 = Fragment()