Unsigned 32bx16b multiply subroutine
HydraHacker
Posts: 77
in Propeller 2
Hello,
I thought that I would post a short 32bx16b unsigned multiply subroutine that is only 7 instructions long, not counting the return, which runs in 14 clocks.
Please note that the multiplicand is destroyed upon subroutines exit.
HydraHacker
I thought that I would post a short 32bx16b unsigned multiply subroutine that is only 7 instructions long, not counting the return, which runs in 14 clocks.
Please note that the multiplicand is destroyed upon subroutines exit.
HydraHacker
Unsgnd32x16Mul getword pl, mc, #1 ' get high word of mc into pl mul pl, mp ' multiply high word of pl with low word of the mp getword ph, pl, #1 ' shift product in pl and ph left by 16 bits shl pl, #16 mul mc, mp ' multiply low word of mc by the low word of the mp add pl, mc wc ' add mc into pl addx ph, #0 ' add carry to ph ret mc res 1 ' multiplacand mp res 1 ' multiplier pl res 1 ' product low ph res 1 ' product high
Comments
My routine returns a 48 bit result
Can the Cordic use that for a QDIV/QFRAC? I think it might.
Hydrahacker