# HG changeset patch # User Michael Pavone # Date 1741494023 28800 # Node ID 6894a25ebfaa0f2d007dc9e561ab0f3ec08b810e # Parent e0935d5878c33047097fd87832e75ad2319eb574 Fix mulu nflag when compiling with optimization enabled diff -r e0935d5878c3 -r 6894a25ebfaa cpu_dsl.py --- a/cpu_dsl.py Sat Mar 08 19:57:23 2025 -0800 +++ b/cpu_dsl.py Sat Mar 08 20:20:23 2025 -0800 @@ -883,7 +883,9 @@ if p1Size >= size: p1Size = size // 2 #TODO: Handle case in which destSize > size - return f'\n\t{params[2]} = ((uint{p0Size}_t){params[0]}) * ((uint{p1Size}_t){params[1]});' + p0Mask = (1 << p0Size) - 1 + p1Mask = (1 << p1Size) - 1 + return f'\n\t{params[2]} = ((uint{size}_t)({params[0]} & {p0Mask})) * ((uint{size}_t)({params[1]} & {p1Mask}));' def _getCarryCheck(prog): carryFlag = None