54

Early single-chip silicon CPUs like the Zilog Z80 or MOS 6502 did not have a multiply instruction at all. Was this because the technology did not exist at the time to implement it, was it too expensive or was there simply no need for such an instruction (like FPUs for Amiga power users, the majority of people could and did get by without one)?

11
  • 27
    cpushack.com/2017/12/19/… what a multiplier looks like in the 70s. Sep 20, 2020 at 17:54
  • 1
    Have a look at how many transistors could fit on the silicon over time, and you might have an idea why 🙂 Sep 21, 2020 at 12:06
  • It made doing things that are naturally multiplicative much more challenging. I did a limited OCR system (that involved rotation) on a Z80. We created our spatial filters so that we could use a table driven, simple set of shift+add multiplication routines. We had a table we generated off-line that described trigonometric data (basically sine between 0 and 45 deg). If I remember correctly, there were only 4 bits per point (maybe 8) and it was an index into a table that described how points in the rotated rectangle were to be translated using the algorithm we had chosen/come up with.
    – Flydog57
    Sep 21, 2020 at 21:12
  • 4
    Lacking a hardware multiply only really affects the speed of performing a task - it doesn't prevent the task being done, just do it with a software function. There is a bit of a parallel with FPGAs, they didn't have hardware multiply in low-cost versions until 10-15 years ago, eg Xilinx Spartan 2 vs Spartan 3. Sep 21, 2020 at 23:15
  • 3
    I recall Motorola 68000 had a 16-bit × 16-bit multiply instruction, but it took 70 cycles. For comparison, adding two 16-bit numbers took two cycles. Multiplication is a pretty complex operation.
    – liori
    Sep 22, 2020 at 11:53

8 Answers 8

63

Fast multiplier circuits as used today take enormous amounts of logic, far beyond what would have been cost-effective (or perhaps even possible) in the mid-70s for an inexpensive microprocessor. Even slow multiplier circuits (as would appear later on chips like the 6809, 68000 or 8086) use a fair bit of logic and would have very considerably added to the cost, perhaps forcing a multi-chip design with all the complications that entails.

The first lines of microprocessors were primarily targeted at embedded control applications where rapid multiplication is rarely needed, so that was likely a factor too.

6
  • 10
    I think the last para explains something important fpr the OP: these weren't considered CPU's at the time; they weren't made to power microcomputers. They were microprocessors for "smart" devices. Sep 21, 2020 at 1:38
  • I am not convinced by the "not enough logic" argument. A "slow multiplier" can be implemented by iterative shifts and conditional adds. The amount of microcode and extra logic to do this is much less than handling interrupts. And yet, many chips chose to implement interrupt handling but not multiplication. Your last paragraph is more relevant: multiplication wasn't needed for most applications.
    – DrSheldon
    Sep 23, 2020 at 17:26
  • @DrSheldon The designers didn't even budget for 16 bit arithmetic on the 6502, or DSUB to DADD on the 8080. Numerous things seem missing from both designs in hindsight, and multiplication is one of them, but fairly far down the list.
    – RETRAC
    Sep 23, 2020 at 21:04
  • 2
    @RETRAC: The 6502 does perform 16-bit address arithmetic, including logic to skip the high-byte computation when adding or subtracting zero.
    – supercat
    Sep 29, 2020 at 20:19
  • @supercat: and yet they didn't have the transistor budget to connect most of that logic up to make it available in the instruction set. Which would come before a multiplier as a design priority in most cases, I figure.
    – RETRAC
    Sep 29, 2020 at 20:38
57

You don't need it

Multiplying two arbitrary bytes together has limited practical value. (If you want to multiply by a constant you can hardcode the optimal sequence of instructions to do so.)

Obviously it would be nice to have but the expense isn't worth it.

In an arcade game... you basically never need to multiply a thing. To draw lines or circles, you can use Bresenham's algorithms. For nonlinear control problems, values from 0-255 are of pretty limited accuracy and you probably want floating-point anyway.

For financial calculations (or things like pocket calculators), you want to use BCD to avoid rounding errors. For spreadsheets or graphing programs, you need floating-point.

In microcontrollers, sometimes lookup tables are actually better for "almost multiplication" problems because you can put fudge factors in them to deal with responses of the physical system—motors or whatever.

Special mention goes to Elite, which managed to do real-time 3D graphics in 1984... now that could have really used multiply and divide instructions.

7
  • 10
    +1 because I have been looking for years how to pick what pixels overlap with a perfect mathematical line but did not know it had a formal name: what Bresenham's algorithms.
    – DKNguyen
    Sep 21, 2020 at 1:57
  • I remember reading through the Atari 800's source code to see how diagonal lines were drawn - how could they do that without a division to figure out the slope? I remember it being very clever, but now I can't even remember how it was done. Sep 21, 2020 at 19:26
  • 4
    multiplication has its uses in arcade games. Atari wouldn't have developed their math box for their arcade machines unless they needed faster mathematics than the CPU could provide
    – scruss
    Sep 21, 2020 at 23:02
  • FWIW, a run-sliced Bresenham implementation has a lower per-pixel cost, but requires an integer divide during setup. Elite for the Apple II took a half-step, using their division table to simplify the error update step. Stellar 7 for the Apple II uses multiply and divide for its line clipping as well as its vertex transforms. Many games "faked" 3D (e.g. Epoch), but the free-moving wireframe games had to do the math.
    – fadden
    Sep 22, 2020 at 15:35
  • "For financial calculations (or things like pocket calculators), you want to use BCD to avoid rounding errors." - BCD have benefit of convertion to/from the string. I doubt anyone is using BCD nowadays for financial calculation as opposed to storing number of cents. Sep 23, 2020 at 6:20
11

Slow multiplication implementations made with conventional ALUs and microprograms had another problem. There are a lot of machine cycles to execute a command. So much so that it becomes noticeable with intensive interrupt work. And for 8-bit microprocessors, with the exception of the case with the Atari 2600, working with interrupts generated by the graphics subsystem logic was very relevant.

A useful article about one of the first massively available single-chip 16 by 16 multipliers - here.

2
  • I remember using first the TRW parts and then the ADSP1010 MAC chip. The big problem with the TRW devices was the heat output. They had a massve lump of aluminium stuck to the top of the packace to help with the cooling. They were replaced in the end by general purpose programmable DSPs.
    – uɐɪ
    Sep 21, 2020 at 12:43
  • This is a great point. I suspect it's why there weren't many sophisticated microcoded instructions on any of the 8 bit processors. (The Z80's LDIR depends only on register state, for example, so can it be easily interrupted.) Something like a multiply microcode routine could fit easily enough on chip, but the logic to support interrupting it would require full exception handling which is far too much logic for those little designs to fit.
    – RETRAC
    Oct 7, 2021 at 21:11
4

From the beginning of electronic computation, this was a common design decision when building a computer using minimal circuitry. The Manchester Baby, operational in 1948, had no multiplication hardware. Later, low end minicomputers such as the PDP-8 lacked hardware multiplication. For some, like the PDP11/20, there was an add-on peripheral for it.

4
  • The multiply unit on the PDP-8 was optional.
    – Erik Eidt
    Sep 21, 2020 at 15:01
  • 2
    The question was "why" Sep 21, 2020 at 17:24
  • 2
    @OmarL And the "why" was minimal circuitry.
    – John Doty
    Sep 21, 2020 at 17:41
  • 3
    Well, come to that, the Baby didn't have an addition instruction either. (What it had was 'load negated' and 'subtract' instructions). And definitely the reasons why were: they didn't want to add more circuitry, and it wasn't needed. Sep 21, 2020 at 20:19
4

It seems to be purely arbitrary (or pragmatic) choice of the designers, one of the main factors being the size of microcode ROM or PLA. As an example, I'll take soviet K1801VM1 CPU. Its latest modification, VM1G, does support multiplication. The only change is microcode, not even the size of microcode ROM or PLA. For the reference, look at this reverse-engineered verilog of the CPUs: https://github.com/1801BM1/cpu11/tree/master/vm1, specifically, cpu11/vm1/hdl/wbc/rtl/vm1_plm.v (two microcode versions in two modules).

Another example, though not an early one, is MC68HC05 embedded CPU. Being otherwise simplistic, it does support multiplication too.

4
  • How do you know that the вм1г is only change is microcode? Are the microcode listings available? Sep 21, 2020 at 12:51
  • Yes, the listings are available. I've updated the answer with the link to the reverse-engineered к1801вм1а and к1801вм1г.
    – lvd
    Sep 21, 2020 at 13:03
  • Another answer pointed out interrupt latency as a reason not to provide a slow microcoded multiply. So it's not purely arbitrary, especially if your microcode can't abort the calculation on external interrupt. Sep 22, 2020 at 18:20
  • 1
    It is NOT a reason, actually. Given a slow non-interruptable multiply, you are NOT obliged to use it, especially knowing you'd need fast interrupt response :)
    – lvd
    Sep 22, 2020 at 21:34
3

Prior to microprogrammed/PLA-programmed processors, it took an enormous amount of control logic to manage a simple multiply (and forget about even trying floating point). Especially with early single-chip designs there simply was not enough chip space for the control logic.

With the invention of microprogrammed processors it became more practical to include multiply/divide and even floating point operations.

Only when graphics, etc, created a demand (and chip density improved) did hardware-ifying the operations become economically attractive.

(I worked on a microprogrammed processor for RCA in the early 70s. We were basically duplicating the 360 instruction set on an early LSI-based system, and it was a bear working out the microprogram logic.)

0

cost tradeoff vs time to compute faster

that is why the 8086 was that way and they had the 8087 if you wanted faster math

z80 was just a newer slightly better version of the 8080

2
  • 2
    Welcome to Retrocomputing Stack Exchange! Can you elaborate a little on this answer? (It's okay as it is, but I get the feeling you know more about this topic.)
    – wizzwizz4
    Sep 23, 2020 at 6:34
  • The 8086 does have an integer multiply instruction. The 8087 is a floating-point unit, not an ALU. Oct 10, 2020 at 7:30
0

I want to boil down this answer to engineering decisions (as are many choices made in engineering).

A good engineer works with limits. One limit at the time was cost for producing the chip. More transistors leads to larger chip size leads to lower yield in the production and quickly increasing costs. In order to keep costs down you remove the "expensive" parts, such as multiplication and division circuits.

Did it work? Well, rumors has it that the 6502 was used in Apple computers instead of 6800 because it had a lower cost. So, yes, lower cost worked.

If we, playing with numbers here, assume that a 6502 with multiplication would cost 3 times as much -- would it be used? Probably not is my guess.

2
  • A generic ‘well, it was cheaper’ answer is pretty useless. I’d wager it is still cheaper to produce a CPU without a multiplication instruction now, and yet most contemporary designs do feature it. A real answer would address what factors actually went into the trade-off besides just cost. Oct 10, 2020 at 7:32
  • @user3840170 You are of course right. But price is often one of very most important limitations. I would really like to have a luxury BMW but cannot afford it. Fortunately there are a lot of less expensive cars to buy. These, less expensive, are made with less expensive materials and less expensive components -- in effect designed towards a lower target price. The same goes for most engineering projects. Possible exception might be the Apollo program, sending people to the Moon.
    – ghellquist
    Oct 10, 2020 at 9:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .