def _propagate_ports(self, ports):
# Collect all signals we're driving (on LHS of statements), and signals we're using
# (on RHS of statements, or in clock domains).
- self_driven = union(s._lhs_signals() for s in self.statements)
- self_used = union(s._rhs_signals() for s in self.statements)
+ self_driven = union(s._lhs_signals() for s in self.statements) or ValueSet()
+ self_used = union(s._rhs_signals() for s in self.statements) or ValueSet()
for domain, _ in self.iter_sync():
cd = self.domains[domain]
self_used.add(cd.clk)
self.c2 = Signal()
self.c3 = Signal()
+ def test_empty(self):
+ f = Fragment()
+
+ ins, outs = f._propagate_ports(ports=())
+ self.assertEqual(ins, ValueSet())
+ self.assertEqual(outs, ValueSet())
+ self.assertEqual(f.ports, ValueSet())
+
def test_self_contained(self):
f = Fragment()
f.add_statements(