Linked by Thom Holwerda on Sat 7th Sep 2013 09:54 UTC
Hardware, Embedded Systems

The 8-bit Z-80 processor is famed for use in many early personal computers such the Osborne 1, TRS-80, and Sinclair ZX Spectrum, and it is still used in embedded systems and TI graphing calculators. I had always assumed that the ALU (arithmetic-logic unit) in the Z-80 was 8 bits wide, like just about every other 8-bit processor. But while reverse-engineering the Z-80, I was shocked to discover the ALU is only 4 bits wide! The founders of Zilog mentioned the 4-bit ALU in a very interesting discussion at the Computer History Museum, so it's not exactly a secret, but it's not well-known either.

I have been reverse-engineering the Z-80 processor using images from the Visual 6502 team. The image below shows the overall structure of the Z-80 chip and the location of the ALU. The remainder of this article dives into the details of the ALU: its architecture, how it works, and exactly how it is implemented.

Ken Shirrif's blog is an absolute must for fans of ultra-low-level hardware stuff. This goes way over my head, but interesting nonetheless.

Thread beginning with comment 571630
To view parent comment, click here.
To read all comments associated with this story, please click here.
Member since:

The architecture defines the width of a processor, not the internal design.

I alway thought the internal design was part of the architecture. And that the meaning of 8/16/32/64 bitness changed over the years with a little help by marketing. So the width of the processor is defined by the instruction set, not by the data path or registers or .. ?

Reply Parent Score: 3

Drumhellar Member since:

It's defined by the instruction set, and not the actual implementation

Z80 is an 8-bit architecture because you add two 8-bit registers to get a result. The fact that behind the scenes, it's breaking it down into multiple 4-bit adds is inconsequential. They could change it at a later point to give it a true 8-bit ALU and nobody would know the difference.

Same about data buses. The 8086 had a 16-bit system bus, while the 8088 had an 8-bit bus. This wouldn't make the 8088 an 8-bit chip, since the you were doing 16-bit math in 16-bit registers.

But, there was time when it was reasonable to assume that 8-bit chips had 8-bit buses and 16-bit chips had 16-bit buses, but as time progressed the ISA became further and further divorced from the actual implementation.

Reply Parent Score: 4

bartgrantham Member since:

Just playing devil's advocate, but the Z-80 could also do 16-bit adds and substracts the the HL/BC/DE register pairs. Wouldn't that make it a 16-bit CPU by your definition (width of operands)?

Reply Parent Score: 5

ElCabri2 Member since:

It's a fuzzy definition really. Bit-ness of technology can refer to the size of the address bus, the size of the word operated on by the arithmetic instructions, or actual architectural details ... When all this was fluctuating fast from generation to generation in the 1980s and 1990s, there were some creative labeling for marketing reasons. That's why we had for example a "16/32 bits" processors like the Motorola 68000, or why some claims of "128 bits" video game systems have emerged in the late 90s. Mainframe and HPC architectures were even more exotic. Let's mention also the "Saturn" architecture of HP's high-end calculators, which had 64bit registers, with sub-fields of various length aligned on 4-bit boundaries, 4-bit addressable RAM ("nybles") and 20-bits (four nybles) addresses...

Reply Parent Score: 1