File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed
Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -383,7 +383,7 @@ def on_Switch(self, stmt):
383383 value = int ("" .join ("0" if b == "-" else b for b in pattern ), 2 )
384384 gen_checks .append (f"{ value } == ({ mask } & { gen_test } )" )
385385 else :
386- value = int (pattern , 2 )
386+ value = int (pattern or "0" , 2 )
387387 gen_checks .append (f"{ value } == { gen_test } " )
388388 if index == 0 :
389389 self .emitter .append (f"if { ' or ' .join (gen_checks )} :" )
Original file line number Diff line number Diff line change @@ -1014,6 +1014,19 @@ def test_large_expr_parser_overflow(self):
10141014 m .d .comb += a .eq (op )
10151015 Simulator (m )
10161016
1017+ def test_switch_zero (self ):
1018+ m = Module ()
1019+ a = Signal (0 )
1020+ o = Signal ()
1021+ with m .Switch (a ):
1022+ with m .Case ("" ):
1023+ m .d .comb += o .eq (1 )
1024+ with self .assertSimulation (m ) as sim :
1025+ def process ():
1026+ yield Settle ()
1027+ self .assertEqual ((yield o ), 1 )
1028+ sim .add_process (process )
1029+
10171030
10181031class SimulatorRegressionTestCase (FHDLTestCase ):
10191032 def test_bug_325 (self ):
You can’t perform that action at this time.
0 commit comments