Stories
Slash Boxes
Comments

SoylentNews is people

posted by janrinok on Friday March 24, @06:33PM   Printer-friendly

http://www.righto.com/2023/03/8086-multiplication-microcode.html

While programmers today take multiplication for granted, most microprocessors in the 1970s could only add and subtract — multiplication required a slow and tedious loop implemented in assembly code. One of the nice features of the Intel 8086 processor (1978) was that it provided machine instructions for multiplication,2 able to multiply 8-bit or 16-bit numbers with a single instruction. Internally, the 8086 still performed a loop, but the loop was implemented in microcode: faster and transparent to the programmer. Even so, multiplication was a slow operation, about 24 to 30 times slower than addition.

In this blog post, I explain the multiplication process inside the 8086, analyze the microcode that it used, and discuss the hardware circuitry that helped it out.3 My analysis is based on reverse-engineering the 8086 from die photos. The die photo below shows the chip under a microscope. I've labeled the key functional blocks; the ones that are important to this post are darker. At the left, the ALU (Arithmetic/Logic Unit) performs the arithmetic operations at the heart of multiplication: addition and shifts. Multiplication also uses a few other hardware features: the X register, the F1 flag, and a loop counter.


Original Submission

 
This discussion was created by janrinok (52) for logged-in users only, but now has been archived. No new comments can be posted.
Display Options Threshold/Breakthrough Mark All as Read Mark All as Unread
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
  • (Score: 2) by Rich on Saturday March 25, @08:55PM

    by Rich (945) on Saturday March 25, @08:55PM (#1298147) Journal

    The article explains that newer CPUs use hardware multipliers modeled after "Wallace trees" or the "Dadda multiplier". I've never put much thought into it, but I was unter the (now seemingly wrong) assumption that hardware multiplication is a "byproduct" of the barrel shifter the more modern CPUs have where the barrel shifter has a bit of additional hardware to sum simultaneous shifts from the first factor, selected by the second factor.

    Starting Score:    1  point
    Karma-Bonus Modifier   +1  

    Total Score:   2