File tree Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -921,8 +921,8 @@ def __repr__(self):
921
921
def comb_edges_to (self , bit ):
922
922
yield (self .default [bit ], self .src_loc )
923
923
for assign in self .assignments :
924
- yield (assign .cond , assign .src_loc )
925
924
if bit >= assign .start and bit < assign .start + len (assign .value ):
925
+ yield (assign .cond , assign .src_loc )
926
926
yield (assign .value [bit - assign .start ], assign .src_loc )
927
927
928
928
Original file line number Diff line number Diff line change @@ -3571,6 +3571,30 @@ def test_cycle(self):
3571
3571
r"$" ):
3572
3572
build_netlist (Fragment .get (m , None ), [])
3573
3573
3574
+ def test_assignment_cycle (self ):
3575
+ a = Signal (2 )
3576
+ m = Module ()
3577
+
3578
+ with m .If (a [0 ]):
3579
+ m .d .comb += a [0 ].eq (1 )
3580
+
3581
+ with self .assertRaisesRegex (CombinationalCycle ,
3582
+ r"^Combinational cycle detected, path:\n"
3583
+ r".*test_hdl_ir.py:\d+: cell Matches bit 0\n"
3584
+ r".*test_hdl_ir.py:\d+: signal a bit 0\n"
3585
+ r".*test_hdl_ir.py:\d+: cell AssignmentList bit 0\n"
3586
+ r".*test_hdl_ir.py:\d+: cell PriorityMatch bit 0\n"
3587
+ r"$" ):
3588
+ build_netlist (Fragment .get (m , None ), [])
3589
+
3590
+ m = Module ()
3591
+
3592
+ with m .If (a [0 ]):
3593
+ m .d .comb += a [1 ].eq (1 )
3594
+
3595
+ # no cycle here, a[1] gets assigned and a[0] gets checked
3596
+ build_netlist (Fragment .get (m , None ), [])
3597
+
3574
3598
3575
3599
class DomainLookupTestCase (FHDLTestCase ):
3576
3600
def test_domain_lookup (self ):
You can’t perform that action at this time.
0 commit comments