hdl.xfrm: handle empty lhs in LHSGroup{Analyzer,Filter}.

This commit is contained in:
whitequark 2019-06-04 10:19:54 +00:00
parent 1b54eb80da
commit 51c03ca391
3 changed files with 26 additions and 4 deletions

View file

@ -314,6 +314,8 @@ class PartTestCase(FHDLTestCase):
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))

View file

@ -303,6 +303,15 @@ class LHSGroupAnalyzerTestCase(FHDLTestCase):
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):
@ -329,6 +338,13 @@ class LHSGroupFilterTestCase(FHDLTestCase):
)
""")
def test_lhs_empty(self):
stmts = [
Cat().eq(0)
]
self.assertRepr(LHSGroupFilter(SignalSet())(stmts), "()")
class ResetInserterTestCase(FHDLTestCase):
def setUp(self):