return groups
def on_Assign(self, stmt):
- self.unify(*stmt._lhs_signals())
+ lhs_signals = stmt._lhs_signals()
+ if lhs_signals:
+ self.unify(*stmt._lhs_signals())
on_Assert = on_Assign
def on_Assign(self, stmt):
# The invariant provided by LHSGroupAnalyzer is that all signals that ever appear together
# on LHS are a part of the same group, so it is sufficient to check any of them.
- any_lhs_signal = next(iter(stmt.lhs._lhs_signals()))
- if any_lhs_signal in self.signals:
- return stmt
+ lhs_signals = stmt.lhs._lhs_signals()
+ if lhs_signals:
+ any_lhs_signal = next(iter(lhs_signals))
+ if any_lhs_signal in self.signals:
+ return stmt
def on_Assert(self, stmt):
any_lhs_signal = next(iter(stmt._lhs_signals()))
class CatTestCase(FHDLTestCase):
def test_shape(self):
+ c0 = Cat()
+ self.assertEqual(c0.shape(), (0, False))
c1 = Cat(Const(10))
self.assertEqual(c1.shape(), (4, False))
c2 = Cat(Const(10), Const(1))
SignalSet((b,)),
])
+ def test_lhs_empty(self):
+ stmts = [
+ Cat().eq(0)
+ ]
+
+ groups = LHSGroupAnalyzer()(stmts)
+ self.assertEqual(list(groups.values()), [
+ ])
+
class LHSGroupFilterTestCase(FHDLTestCase):
def test_filter(self):
)
""")
+ def test_lhs_empty(self):
+ stmts = [
+ Cat().eq(0)
+ ]
+
+ self.assertRepr(LHSGroupFilter(SignalSet())(stmts), "()")
+
class ResetInserterTestCase(FHDLTestCase):
def setUp(self):