Wednesday, March 15, 2017

Non-standard addressing...

Non-standard addressing...  This blog post by national geek treasure Ken Shirriff details how the Intel 8008 designers saved a few then-precious gates by addressing a stack with a sequence that wasn't in the usual binary numerical order.  Long-time readers may know that the 8008 has a special place in my professional life: it was the heart of the first microcomputer that I designed and built myself.  Until I read Ken's post, I had no idea that the 8008 addressed its stack this way – as a user of the 8008, there was no way to detect that.

That general technique, though, I've used myself, back in the '70s and '80s when I was designing a lot of digital hardware.  I got there in two steps.

The first step was a mental leap I made when wire-wrapping a Z80 prototype that included some dynamic RAM and an EPROM.  The way the chips were oriented on the board, to connect the Z80's address lines to the eight RAM chips and PROM chip in the ordinary way (that is, A0 to A0, A1 to A1, etc.) would have caused the wires to cross over each other twice in an aesthetically annoying way.  It dawned on me as I thought about my stupid problem that the RAM chips really didn't need the address lines to be connected in the ordinary way at all – I could connect them in any way that was convenient, and it wouldn't change the operation of them.  In fact, the address lines could be differently connected to each individual RAM chip (though that wasn't convenient or neat) and even that would still work just fine.  All that really mattered is that the 12 bits (4k RAMs) of address all be connected, so that each possible address presented a different state of address lines to each RAM.  The EPROM was a slightly harder case, as it might be in either of two places: the Z80 board itself, or the EPROM programmer.  The programmer's address pins were wired in the usual way, so if I wired my board in an unusual way the addresses wouldn't match.  But that problem was easily solved, too: a simple little program would “scramble” the sequence of the bytes I wanted to program in the EPROM so that they'd match how I'd wired my Z80 board.  Unconventional, but it would work – and I built my board that way, along with several later boards that made it to printed circuit boards where the layout convenience actually saved us a layer.

The second step happened when I was building a piece of test equipment for the Marines.  There are a lot of good stories in that experience. :)  This piece of gear was based on a Z80, but had lots of discrete TTL logic associated with it.  One requirement included 16 bit address counters for some RAM that collected state information.  There were 32 channels of information, so 32 of these 16 bit counters were needed.  Extensible 4 bit counters were standard TTL parts, and the obvious choice – but I'd have needed 128 of them for the job.  Extensible 8 bit shift registers were also standard TTL parts, so if I could figure out how to use them I'd only need 64 of them, saving a hefty pile of parts in my design.  Remembering the lessons I'd learned above about “scrambling” the address lines, it occurred to me that there was no requirement for a standard binary sequence.  I was already familiar with using shift registers and a few gates to generate pseudo-random sequences for noise generators, so I jumped right to that as a design solution.  I ended up taking 2.5 parts (shift registers plus gates) to build each of those “address counters”, a very nice parts count reduction from the original approach that took 4 parts. 

It did cause a bit of an issue when my design went through an independent design review, though.  The engineer doing the review had never seen a pseudo-random sequence generator, so I had to spend quite a bit of time in the review convincing him that they actually worked.  Then he flat-out didn't believe the RAMs would still do the job if not addressed in sequential address order.  I actually had to step him through a chalkboard example of a 3 bit address memory to convince him.  My customer was quite discomfited by all the back-and-forth between the reviewer and I.  The reviewer had a reputation in San Diego for being a top-notch digital designer.  What kind of a weird design had I made, that this guy was so puzzled by it?  Fortunately for me, when the review was over (and my design approved with no changes) that reviewer went out of his way to say what a great design it was, and that he'd learned several things he expected to apply himself.  With that sort of endorsement, I was hopeful that I'd get more business from the Marines.  I would have, too, had I been willing to do the work – but it took nearly a year for me to get the check for the first work I did.  Not many small businesses can afford that sort of payment delay.  The Marines approached me several more times with projects they wanted me to do, but I turned them down.  I wanted to get paid!  :)

No comments:

Post a Comment