comparison cpu_dsl.py @ 2672:6894a25ebfaa

Fix mulu nflag when compiling with optimization enabled
author Michael Pavone <pavone@retrodev.com>
date Sat, 08 Mar 2025 20:20:23 -0800
parents 38c281ef57b0
children 7e86ec94c899
comparison
equal deleted inserted replaced
2671:e0935d5878c3 2672:6894a25ebfaa
881 if p0Size >= size: 881 if p0Size >= size:
882 p0Size = size // 2 882 p0Size = size // 2
883 if p1Size >= size: 883 if p1Size >= size:
884 p1Size = size // 2 884 p1Size = size // 2
885 #TODO: Handle case in which destSize > size 885 #TODO: Handle case in which destSize > size
886 return f'\n\t{params[2]} = ((uint{p0Size}_t){params[0]}) * ((uint{p1Size}_t){params[1]});' 886 p0Mask = (1 << p0Size) - 1
887 p1Mask = (1 << p1Size) - 1
888 return f'\n\t{params[2]} = ((uint{size}_t)({params[0]} & {p0Mask})) * ((uint{size}_t)({params[1]} & {p1Mask}));'
887 889
888 def _getCarryCheck(prog): 890 def _getCarryCheck(prog):
889 carryFlag = None 891 carryFlag = None
890 for flag in prog.flags.flagOrder: 892 for flag in prog.flags.flagOrder:
891 if prog.flags.flagCalc[flag] == 'carry': 893 if prog.flags.flagCalc[flag] == 'carry':