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 571555
To read all comments associated with this story, please click here.
4 Bit ALU's
by shotsman on Sat 7th Sep 2013 11:54 UTC
shotsman
Member since:
2005-07-22

Back in the day were pretty common.
The first MicroProcessor I got my hands on was an IMP-16p (National Semiconductor). This was made up of 4 x 4bit ALU's chained together. I found this very strange at the time as I was coming from a PDP-11/40.

LAter on, I got involved with developing interfaces for DEC. Our CPU of choice for many of these was the 2901. This was another 4 bit slice device. On the TSU05 Tape controller, we had 4 of these connected together giving us basically, a 16-bit word CPU.

It does not surprise me that the Z80 has a 4bit ALU one little bit.

Reply Score: 5

This Might Explain A Few Things
by Pro-Competition on Sat 7th Sep 2013 18:36 in reply to "4 Bit ALU's"
Pro-Competition Member since:
2007-08-20

This isn't talking about chained 4-bit units - it's a single 4-bit unit, where the slices are processed serially, not in parallel.

Actually, this probably helps to explain the high number of clock cycles the Z-80 used to perform operations. I'm not sure if this was a good design trade-off or not.

(I always admired the rich instruction set of the Z-80 in comparison to the 6502 I was working with on the VIC-20 / C-64. But then I looked at the timing data and wasn't quite so jealous. ;^) )

P.S. I remember reading about those bit-slice processors in data books as kid. (Yes, I was a nerdy kid.) I think that was an elegant solution at the time.

Reply Parent Score: 6

moondevil Member since:
2005-07-08

We were all nerdy back then.

I got my ZX Spectrum compatible (Timex 2068) at the age of 10 and started coding around the age of 12.

Reply Parent Score: 3

shotsman Member since:
2005-07-22

I did say that 4bit ALU's were common in those days.
The IC technology available then was by today's standards pretty crude so making 8,12 or even 16 bit ALU's was for a while impossible.
I went on to give some examples of some other uses for them
The 2901 could be used on its own. It didn't have to be used with others.
A lot of engineers quickly realised that 4bits was very limiting especially as many of the other CPU's(non microprocessor) around in those days had far longer word lengths. could this be why we chained 4bit devices together?
Intel realised this as well. How long did the 4004 last before they came out with the 8008?

Reply Parent Score: 4

puenktchen Member since:
2007-07-27

This isn't talking about chained 4-bit units - it's a single 4-bit unit, where the slices are processed serially, not in parallel.


Doesn't that make the Z80 count as a 4-bit CPU?

Reply Parent Score: 3