add carry handling to pia_res_to_output