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 @@ -3678,6 +3678,30 @@ def test_cycle(self):
3678
3678
r"$" ):
3679
3679
build_netlist (Fragment .get (m , None ), [])
3680
3680
3681
+ def test_assignment_cycle (self ):
3682
+ a = Signal (2 )
3683
+ m = Module ()
3684
+
3685
+ with m .If (a [0 ]):
3686
+ m .d .comb += a [0 ].eq (1 )
3687
+
3688
+ with self .assertRaisesRegex (CombinationalCycle ,
3689
+ r"^Combinational cycle detected, path:\n"
3690
+ r".*test_hdl_ir.py:\d+: cell Matches bit 0\n"
3691
+ r".*test_hdl_ir.py:\d+: signal a bit 0\n"
3692
+ r".*test_hdl_ir.py:\d+: cell AssignmentList bit 0\n"
3693
+ r".*test_hdl_ir.py:\d+: cell PriorityMatch bit 0\n"
3694
+ r"$" ):
3695
+ build_netlist (Fragment .get (m , None ), [])
3696
+
3697
+ m = Module ()
3698
+
3699
+ with m .If (a [0 ]):
3700
+ m .d .comb += a [1 ].eq (1 )
3701
+
3702
+ # no cycle here, a[1] gets assigned and a[0] gets checked
3703
+ build_netlist (Fragment .get (m , None ), [])
3704
+
3681
3705
3682
3706
class DomainLookupTestCase (FHDLTestCase ):
3683
3707
def test_domain_lookup (self ):
You can’t perform that action at this time.
0 commit comments