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):
921921 def comb_edges_to (self , bit ):
922922 yield (self .default [bit ], self .src_loc )
923923 for assign in self .assignments :
924- yield (assign .cond , assign .src_loc )
925924 if bit >= assign .start and bit < assign .start + len (assign .value ):
925+ yield (assign .cond , assign .src_loc )
926926 yield (assign .value [bit - assign .start ], assign .src_loc )
927927
928928
Original file line number Diff line number Diff line change @@ -3678,6 +3678,30 @@ def test_cycle(self):
36783678 r"$" ):
36793679 build_netlist (Fragment .get (m , None ), [])
36803680
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+
36813705
36823706class DomainLookupTestCase (FHDLTestCase ):
36833707 def test_domain_lookup (self ):
You can’t perform that action at this time.
0 commit comments