@@ -1061,7 +1061,7 @@ def run(self, fsm):
10611061 if sub .substrm .sink_wait_count is None :
10621062 sub .substrm .sink_wait_count = sub .substrm .module .Reg (
10631063 '_' .join (['' , sub .substrm .name , 'sink_wait_count' ]),
1064- int (math .ceil (math .log (num_wdelay , 2 ))), initval = 0 )
1064+ int (math .ceil (math .log (max ( num_wdelay , 2 ) , 2 ))), initval = 0 )
10651065
10661066 sub .substrm .fsm .seq .If (sub .substrm .sink_wait_count == 1 ,
10671067 vtypes .Not (start_cond ),
@@ -1085,7 +1085,7 @@ def run(self, fsm):
10851085 if self .sink_wait_count is None :
10861086 self .sink_wait_count = self .module .Reg (
10871087 '_' .join (['' , self .name , 'sink_wait_count' ]),
1088- int (math .ceil (math .log (num_wdelay , 2 ))), initval = 0 )
1088+ int (math .ceil (math .log (max ( num_wdelay , 2 ) , 2 ))), initval = 0 )
10891089
10901090 self .fsm .seq .If (self .sink_wait_count == 1 ,
10911091 vtypes .Not (start_cond ),
@@ -1213,7 +1213,7 @@ def _setup_source_ram(self, ram, var, port, set_cond):
12131213 def _setup_source_ram_dump (self , ram , var , read_enable , read_data ):
12141214 pipeline_depth = self .pipeline_depth ()
12151215 log_pipeline_depth = max (
1216- int (math .ceil (math .log (pipeline_depth , 10 ))), 1 )
1216+ int (math .ceil (math .log (max ( pipeline_depth , 10 ) , 10 ))), 1 )
12171217
12181218 addr_base = (ram .dump_addr_base if hasattr (ram , 'dump_addr_base' ) else
12191219 self .dump_base )
@@ -1451,7 +1451,7 @@ def _make_source_multipattern_vars(self, var, name):
14511451
14521452 var .source_multipat_num_patterns = self .module .Reg (
14531453 '_source_%s_multipat_num_patterns' % prefix ,
1454- int (math .ceil (math .log (self .max_multipattern_length , 2 ))), initval = 0 )
1454+ int (math .ceil (math .log (max ( self .max_multipattern_length , 2 ) , 2 ))), initval = 0 )
14551455 var .source_multipat_offsets = [
14561456 self .module .Reg ('_source_%s_multipat_%d_offset' % (prefix , j ),
14571457 self .addrwidth , initval = 0 )
@@ -1661,7 +1661,7 @@ def _setup_sink_ram(self, ram, var, port, set_cond):
16611661 def _setup_sink_ram_dump (self , ram , var , write_enable ):
16621662 pipeline_depth = self .pipeline_depth ()
16631663 log_pipeline_depth = max (
1664- int (math .ceil (math .log (pipeline_depth , 10 ))), 1 )
1664+ int (math .ceil (math .log (max ( pipeline_depth , 10 ) , 10 ))), 1 )
16651665
16661666 addr_base = (ram .dump_addr_base if hasattr (ram , 'dump_addr_base' ) else
16671667 self .dump_base )
@@ -1886,7 +1886,7 @@ def _make_sink_multipattern_vars(self, var, name):
18861886
18871887 var .sink_multipat_num_patterns = self .module .Reg (
18881888 '_sink_%s_multipat_num_patterns' % prefix ,
1889- int (math .ceil (math .log (self .max_multipattern_length , 2 ))), initval = 0 )
1889+ int (math .ceil (math .log (max ( self .max_multipattern_length , 2 ) , 2 ))), initval = 0 )
18901890 var .sink_multipat_offsets = [
18911891 self .module .Reg ('_sink_%s_multipat_%d_offset' % (prefix , j ),
18921892 self .addrwidth , initval = 0 )
0 commit comments