7 ms·
How the Z80’s 4-bit ALU works (2013)
- 0xcde4c3db 10y agoI seem to remember that the 68000 does something similar, using a 16-bit ALU to implement an ISA with 32-bit registers; part of the performance gain upgrading to the 68020 was shaving off the extra cycle from a bunch of instructions thanks to an actual 32-bit ALU.
- kens 10y agoGood point about the 68000. It has three 16-bit processing sections: low address, high address, and data. So it can compute a 32 bit address at once, but takes two steps for a 32 bit ALU operation.
- andars 10y agoAnother interesting fact: If I'm remembering correctly, some models of the PDP8 had only a 1 bit ALU to reduce the purchase price. I thought this was pretty wild when I first heard it, but I guess the performance hit was ok if you could gain access to a computer at all.
- kens 10y agoThe PDP-8/S was the serial model. Serial processors weren't uncommon in the "old days". Other examples are the F-14 CADC (an early MOS processor) and the Datapoint 2200 (whose architecture was turned into the 8008). Many of the early aerospace computers were serial because of weight constraints, such as the Arma Micro (on the Atlas), IBM ASC-15 (on the Saturn I and Titan) and the Autonetics D-37 (on the Minuteman). And then there's the Motorola MC14500B, which was genuinely a 1-bit microprocessor. It was used for simple control operations to replace relay logic.
- userbinator 10y agoThe CDP1802 also used a serial ALU: http://www.visual6502.org/wiki/index.php?title=RCA_1802E http://www.visual6502.org/wiki/index.php?title=RCA_1802E Each instruction took either 16 or 24 clock cycles due to this, and although other operations were done in parallel and could have been significantly faster, I guess performance was not much of a concern back then as making the microsequencer as simple as possible.
- white-flame 10y agoDiscrete "bit slice" ALU chips were common in early IC computers, tackling only a few bits of the ALU each. Hardware designers could chain those together to get as wide a hardware ALU as necessary, within the timing constraints. https://en.wikipedia.org/wiki/74181 https://en.wikipedia.org/wiki/74181
- qwertyuiop924 10y ago...well that helps explain the famous 4x speed difference between the Z80 and the 6502.
- andars 10y agoFamous? Are you referring to performance or just clock frequency? The Z80 takes more cycles to do the same operation as the 6502, but it also (typically) had a higher max clock frequency, mostly making up for it.
- qwertyuiop924 10y agoI was referring to the fact that a 1MHz 6502 could match a 4MHz Z80. >but it also (typically) had a higher max clock frequency, mostly making up for it. That used to be true. It is no longer true nowadays, so 65C02 beats the Z80 speed-wise.
- cmrdporcupine 10y agoExcept Zilog came out with successors to the original Z80 that were far more cycle efficient. For example the eZ80, which can clock up to 50mhz.
- avhon1 10y agoNot exactly "more cycle efficient", just more modern manufacturing processes. There are also 6502s available for up to 200 MHz. They are not easily available to hobbyists, though - the modern DIP modules are only guaranteed up to 20MHZ, but they can be run at 25MHz.
- vanderZwan 10y agoIt got a few more upgrades than just better miniaturisation: > The eZ80 has a 3-stages pipeline. Available at up to 50 MHz (2004), the performance is comparable to a Z80 clocked at 150 MHz if fast memory is used (i.e. no wait states for opcode fetches, for data, or for I/O) or even higher in some applications (a 16-bit addition is 11 times as fast as in the original). The eZ80 also supports direct continuous addressing of 16 MB of memory without a memory management unit, by extending most registers (HL, BC, DE, IX, IY, SP, and PC) from 16 to 24 bits. In order to do so, the CPU works in a Z80-compatible mode or a full 24-bit address mode. https://en.wikipedia.org/wiki/Zilog_eZ80 https://en.wikipedia.org/wiki/Zilog_eZ80 Note the pipelining, and the 24 bit ALU
- em3rgent0rdr 10y agoI seem to remember Intel first implemented one of the SIMD instructions as two sequential operations operating on half the size of the full SIMD register. Then later refinement of the chip (maybe after transistor size shrunk) they then could do the entire SIMD operation at once in parallel instead of sequentially. But this was all hided under the ISA, so you wouldn't know unless checking the clock cycles.
- userbinator 10y agoI'm not sure if you're referring to something different or just confused it with the ALUs on the P4 (NetBurst), which were divided into two 16-bit halves and took one more clock cycle (actually a half, because these were effectively "DDR" clocked) to obtain the full result if there was a carry between them. http://www.realworldtech.com/isscc-2001/7/ http://www.realworldtech.com/isscc-2001/7/ https://gmplib.org/~tege/x86-timing.pdf https://gmplib.org/~tege/x86-timing.pdf
- johntb86 10y agohttp://arstechnica.com/gadgets/2006/04/core/4/ http://arstechnica.com/gadgets/2006/04/core/4/ has an explanation of how the P6's data buses were only 64 bits wide.
- em3rgent0rdr 10y agothanks! That's what I was remembering: "The P6 core's internal data buses for floating-point arithmetic and MMX are only 64 bits wide. Thus the data input ports on the SSE execution units could only be 64 bits wide, as well. In order to execute a 128-bit instruction using its 64-bit SSE units, the P6 must first break down that instruction into a pair of 64-bit instructions which can be executed on successive cycles."
- caf 10y agoAccording to Agner the Skylake puts the top-half of the 256-bit AVX execution units to sleep when they're not in use, and during the warm-up period when you first start using them again, 256-bit operations are done by using the bottom 128-bits of the XUs twice. http://www.agner.org/optimize/blog/read.php?i=415 http://www.agner.org/optimize/blog/read.php?i=415
- faragon 10y agoCould be that the reason of the 6502 being, clock per clock, faster than the Z80? P.S. please consider adding "(2013)" to the title
- ptaipale 10y agoSure (though not the only reason). I'd also expect it is one of the reasons why the Z80 was able to achieve significantly higher clock speeds than 6502 or 6510.
- bogomipz 10y agoIs there a reason to implement decode logic in a PLA as opposed to ROM?
- kens 10y agoA PLA is much more efficient than a ROM because it can take advantage of "don't care" entries. Specifically, the 6502 has a 130x21 PLA = 2730 entries. A ROM would need 11 inputs (instruction + timing) and 130 outputs, so 130*2^11 = 266240 entries plus the decoding logic. (You could reduce the ROM size by using tricks such as multiple levels of ROM or partially decoded ROMs.) Instruction sets are usually defined so groups of bits have meanings and can be decoded separately. This makes the PLA a good fit. For a specific example, the 6502 PLA decodes instructions matching 100XX1XX to the control line STY (ignoring the timing bits for simplicity). This takes 1 row in the PLA, but it would take 16 entries in a ROM. More info on the 6502 PLA: http://visual6502.org/wiki/index.php?title=6507_Decode_ROM http://visual6502.org/wiki/index.php?title=6507_Decode_ROM
- bogomipz 10y agoThanks for the excellent answer and the link! I thought ROM had something similar to "don't care" bit which was a 0 was represented by the absence of a transistor. Or does "don't care" mean something else?
- visarga 10y agoZ80 - my first CPU.
- raverbashing 10y agoRemember, these processors were designed either by hand or with very primitive CAD tools (6502 was designed and taped 100% by hand) Positioning and routing between thousands of transistors was a daunting task. I believe a lot of simplifications were done because of that as well