comparison cpu_dsl.py @ 2589:6bca3c28e2ad

Low confidence fix for edge case in CPU DSL not currently hit
author Michael Pavone <pavone@retrodev.com>
date Sun, 09 Feb 2025 02:56:50 -0800
parents e04c7e753bf6
children 563d05355a12
comparison
equal deleted inserted replaced
2588:0ea26288d983 2589:6bca3c28e2ad
961 vals = '((uint64_t)1) : ((uint64_t)0)' 961 vals = '((uint64_t)1) : ((uint64_t)0)'
962 elif needsSizeAdjust: 962 elif needsSizeAdjust:
963 decl,name = prog.getTemp(size) 963 decl,name = prog.getTemp(size)
964 dst = params[2] 964 dst = params[2]
965 return '{decl}\n\t{tmp} = ({b} & {mask}) - ({a} & {mask}) - ({check} ? 1 : 0);\n\t{dst} = ({dst} & ~{mask}) | {tmp};'.format( 965 return '{decl}\n\t{tmp} = ({b} & {mask}) - ({a} & {mask}) - ({check} ? 1 : 0);\n\t{dst} = ({dst} & ~{mask}) | {tmp};'.format(
966 decl = decl, tmp = name, a = params[0], b = params[1], op = op, dst = dst, mask = ((1 << size) - 1), check = carryCheck 966 decl = decl, tmp = name, a = params[0], b = params[1], dst = dst, mask = ((1 << size) - 1), check = carryCheck
967 ) 967 )
968 else: 968 else:
969 dst = params[2] 969 dst = params[2]
970 return decl + '\n\t{dst} = {b} - {a} - ({check} ? {vals});'.format(dst = dst, 970 return decl + '\n\t{dst} = {b} - {a} - ({check} ? {vals});'.format(dst = dst,
971 a = params[0], b = params[1], check=_getCarryCheck(prog), vals = vals 971 a = params[0], b = params[1], check=_getCarryCheck(prog), vals = vals