Asm Algorithms 2 - DIV and Division Theorem

ZXNet echo conference «code.zx»

From Kirill Frolov To All 16 October 2001

================================================================================ * Forwarded by Kirill Frolov (500:812/1.507) * Area: talks.asm (talks.asm) * From : Aleksey Malov, 2:5052/30.8 (13 Oct 01 10:29) * To : Sashka Yackubtchick * Subj : Asm algorithms 2 - DIV and division theorem ================================================================================ Hi, Sashka! Sat 13 Oct 2001, at 05:39:04 Sashka Yackubtchick told Aleksey Malov about Asm Algorithms 2 - DIV and division theorem. SY> Thanks for the interesting example, Alexey. SY> Question regarding 98 bars: SY> Is this a purely theoretical calculation or did you take measurements? Purely theoretical calculation. On P-pro/II/III there are 3 people working in the conveyor parallel decoders (2 simple and one complex). Decoders convert commands microprocessor in microoperations, which are primitive commands that are executed by five parallel working executive microprocessor devices. Many simple commands are converted to single commands micro-operations (a simple decoder does this), and some commands are converted to a sequence of two or more (optimally 4) microoperations (this does complex decoder). The command decoder can generate up to 6 micro-operations per clock cycle. To achieve the best performance of decoders, it is necessary thattheir inputs received commands decoded by six micro-operations in sequences 4+1+1. If you believe the words described above, then my cycle of the division procedure will be at most be executed in 3 clock cycles, and since 32 loops, plus a couple more simple commands located outside the loop, the total is about 98 cycles. All the same, in In the vast majority of cases, column division is faster than cyclic division subtracting the divisor from the dividend. On processes where there is no division command (for example, Z80), that’s exactly what they do. To quickly multiply 8-bit numbers (without using the mul command), you can apply the so-called compositional multiplication: If you look closely at the formula (a+b)^2 = a^2 + 2*a*b + b^2, you will notice: (a+b)^2 - a^2 - b^2 a*b = -------------------- 2 If we first calculate the table of squares of 8-bit numbers (512 bytes), then multiplication can be done in a few clock cycles. Bye, Sashka. WBR, Vivid^Brainwave. -+- Lara Croft for $4.50. + Origin: http://brainwave.dax.ru (2:5052/30.8) ================================================================================ Press RESET immediately, All! About multiplication.