6 ms·
Why the Z-80's data pins are scrambled
- ableal 12y ago> I have been reverse-engineering the Z-80 processor using images and data from the Visual 6502 team. Many moons ago, I heard a seventh-hand rumor that the guy doing the layout of the Z-80 chip had a nervous breakdown, because of the difficulty of the work. I have no idea if there was any truth whatsoever to that, but I'm glad to find it's not a Langford Blit thing which maddens those who see it ;-)
- kens 12y agoThe Computer History Museum's oral history of the Z-80 has some interesting stories about the layout (but doesn't mention any nervous breakdown). The Z-80 project hired some layout draftsmen, but they were slow and the chip was running behind schedule. So CEO Federico Faggin starts helping with the layout and ends up doing 3/4 of the chip layout himself after 3 1/2 months of 80-hour weeks. "You know, a CEO doing layout draftsman job was not something that would be normal, but that’s what I had to do, and I did it." By comparison, the simpler 8080 took six months of layout. http://archive.computerhistory.org/resources/text/Oral_History/Zilog_Z80/102658073.05.01.pdf http://archive.computerhistory.org/resources/text/Oral_Histo...
- ctdonath 12y agoHaving laid out a chip by hand, I can see that happening.
- joezydeco 12y agoAmazing analysis. Another reminder we're all standing on the shoulders of giants every time we whip out our phones carrying billions upon billion of gates...
- rbanffy 12y agoIt's giants all the way down.
- raverbashing 12y agoSo, I'm thinking I think to connect a memory chip you just don't care and you can swap them as you want (as long as you connect the 8 data pins to 8 data pins in the memory) For IO you care, of course, or you "just" shuffle all data that you want to write (which is a sure way of making someone go crazy)
- analog31 12y agoFor old fashioned RAM and ROM chips, you'd be OK, and you're probably generally OK with data pins. Address pins are another matter. The Z80 had a built in static RAM refresh circuit, and there is some schtick about which addresses are refreshed as a group (rows or columns, I forget which). So, rearranging the address bus might result in some nasty surprises. And it might get even more interesting with more modern memory devices, which are way over my head. On a whim, I got the Howard Sams book on the Z80 while I was in high school, around 1981, and I devoured it.
- tryp 12y agoModern DDR2 SDRAM busses are a bit more involved. They use the address lines as a command word for putting the chips in the correct "link trainging" mode at startup, selecting burst access lengths, enabling self-refresh mode, setting on-die termination values, &cetera so they may not be swapped. Each "byte lane" of 8 data lines is allowed to have a different signal path length difference between clock and data (that is measured during training for compensation during operation) and signals may be swapped arbitrarily within the byte lanes. Furthermore, the high-performance DDR3+ controllers typically hash the data word with the address so that when a repetitive data stream is transmitted it doesn't generate more EMI. (Some controllers also hash with a random seed gaining resilience against chilling the DIMMs of a running machine and reading them out on another machine in search of sensitive data.) I find it really cool that any time you change the DIMMs in your computer, it essentially has to measure the length of the wires to the ICs on it. (I've found it less cool to have to manipulate timing values to compensate for deviation from PCB design rules, but thankful that it's possible. The fun of board bring-up.) If your BIOS has a "fast boot" option, mostly that means it remembers the wire lengths from last time so it doesn't have to do the measurement again every boot.
- bluecmd 12y agoWhile layouting an full-custom SPI bus for an IC I had to do the same thing. It simply made sense to sacrifice programming model in that case to layout simplicity.
- analog31 12y agoBack in the days of hand made printed circuits, I randomly assigned both data and address pins on a microprocessor circuit, and got everything onto a single side with just one or two jumpers. I felt so clever. Then I remembered that the program in the ROM assumed a particular bit numbering, literally while my board was bubbling away in the ferric chloride. Oops. Rather than re-design the board, I thought about writing a program to rearrange my binaries, or make a socket adapter for the EEPROM programmer. The socket adapter won out.
- kens 12y agoThat's kind of how the TMS1000 microcontroller (used in the Speak n Spell) works. Instead of incrementing the program counter on each instruction (like every normal processor), they saved a few gates by using a linear feedback shift register. The result is the program counter goes through a pseudo-random but predictable sequence. So they just program the code into the ROM in the same sequence and everything works just fine. (Some day I'll write a blog post about this, since it's interesting to look at the silicon that does this.)
- analog31 12y agoThat sounds killer. I can't wait to see what you post. One of the things I find fascinating is the limitations that each generation of engineers deals with in order to get the next problem solved, or the next product out the door. Those were the days when bits and megahertz were expensive.
- yzzxy 12y agoThis is a very weird and specific question I know, but I figured I'd ask anyway because you seem to have experience with this chip. In 'Halt and Catch Fire,'[0] one of the characters loads his children's names onto a Speak n Spell's memory. He's portrayed as a very talented engineer, and a lot of the show seems to be pretty true to the tech. My question is, would this be possible for someone with a lot of patience, experience, and a home workshop at that point, or is it an apocryphal story? [0] A last TV season about an early PC startup in the 80s
- ohazi 12y agoThere was a JPL probe years ago (can't remember which, and can't seem to find a reference) that had a radiation hardened memory IC with error correcting codes and a system to detect and correct the bit flips that were expected due to cosmic rays. After launch, the number of unrecoverable errors (due to multiple bits flipped within the same codeword) was higher than expected. It turned out that someone had swapped some combination of address or data lines, which ended up changing the physical grouping of bits within the codewords. Some of the bits within a logical codeword were so close together that a single event was able flip both of them, causing the error correction to fail.
- userbinator 12y agoThe motivation behind splitting the data bus is to allow the chip to perform activities in parallel. For instance an instruction can be read from the data pins into the instruction logic at the same time that data is being copied between the ALU and registers. Essentially pipelining, several years before the RISC movement popularised it? Could the Z80 have been one of the first pipelined single-chip CPUs? That was a very interesting article. I've tried staring at the Visual6502 chip images for a long time, and although I understand the principles behind how diffusion/polysilicon/metal layers are put together to form transistors, for some reason I feel absolutely lost trying to follow the connections and find the borders between the regions especially when one layer is hidden beneath another. Even looking at the NOR gate with its layout side-by-side I can't see much beyond the metal layer, despite it being partially transparent. I have no problems with transistor-level schematics, however. Is there some sort of trick to being able to easily read and follow the circuitry in die images and layout-level diagrams? It's like some people can read these and visualise/draw the schematic immediately.
- vidarh 12y agoThe 6502 also has a similar 1-stage pipeline, and the concept was old already at that point, though not used much commercially outside of Cray's designs for CDC.
- reisgabrieljoao 12y agoEssentially pipelining, several years before the RISC movement popularised it? Could the Z80 have been one of the first pipelined single-chip CPUs? I don't think you can call it a pipeline, they only state that the different parts of the instruction are being decoded in parallel. For instance, which instruction will be executed and the register associated with the operation. There is no instruction pipeline.