Currently there's a bug with the pseudo-code to Python function generator, where extra brackets are dropped. https://git.libre-soc.org/?p=openpower-isa.git;a=commitdiff;h=ef967c61da13d8c80ff5424fe43c35756928b145 This was noticed when adding the pseudo-code for the "cprop" instruction, and a temp variable was added to circumvent this issue: https://git.libre-soc.org/?p=openpower-isa.git;a=commitdiff;h=a87e45f65c3e2e93fb6234c1ae7b65bd9dab60b3
Adding IRC log conversation: https://libre-soc.org/irclog/%23libre-soc.2022-06-22.log.html#t2022-06-22T14:45:32
binary operator precedence error. unfortunately the fix of adding explicit brackets interferes with the detection of patterns "[0]*4" which is Power ISA pseudocode for "0b0000"
note that python operator precedence causes `(P | G) + G ^ P` to be correctly parsed as `((P | G) + G) ^ P`, so imho if that order of operations matches what pywriter wanted to generate, missing parenthesis is not a problem for the python interpreter (though imho it is a problem for readability -- but it's generated code so doesn't necessarily need to be read very often) https://docs.python.org/3/reference/expressions.html#operator-precedence + is higher precedence than ^