Close

Implementing in hardware: dealing with component sourcing issues

A project log for C61

A 6-bit 2-stage pipelined RISC CPU that fits on a single page

julianJulian 06/20/2018 at 09:460 Comments

When designing my register file, I kept in mind that I'd want this to be implementable in (mostly) TTL.  I wanted to keep programmable logic to a minimum.  But I also wanted to have a useful, flexible architecture, which would be easiest to achieve by having a lot of registers.  I also wanted to keep the instruction set as minimal as possible, which was helped greatly by having addressable instruction pointer and link registers ... but that, along with wanting to be able to manage an instruction per cycle in the normal case, meant I needed to be able to update the registers at least 3 times per cycle.

The design I came up with was this:

The ideal choice for implementing the register banks was using the 74172 IC.  This chip has 8 registers, so with two banks would give me 16 total registers.  The registers are only 2 bits wide, which means 3 per bank.  And with a 20MHz cycle time, it'd be fast enough to potentially run the processor at a total of 10MHz, which is as fast as I'd hope to be able to get the rest of the design to work in any case.

Unfortunately, my usual sources for obsolete ICs have turned up blank on this one, leaving only the very expensive legacy spare parts suppliers (who seem to typically want around £5 per chip for these... and needing 6 of them for the design, that's a lot more than I want to spend here).

The more common 74670 won't do the job, because while it supports simultaneous read and write, it only has a single read port.  The only other option is the CD40108 or CD40208, but both of those are too slow for my ambitions (at 5V, access time = 300ns; I really don't want to have 15V hanging around, but even then I'd only get 100ns, plus setup and hold times of 40ns on the modification cycle, so probably I'd struggle to get 3MHz out of the whole system using this chip).

So, programmable logic is the only way forward for actually implementing this.  Fortunately, I've found a supply of cheap CPLDs.  Unfortunately, they're in TQFP100 packages, which is beyond the capabilities of my PCB production process (I usually use toner transfer, but don't reliably get thin enough traces for the pins on these packages), so I suspect I'm going to have to get some boards manufactured for this.  I've also never soldered a component with that many pins in such a small area before (I usually try to avoid anything < 1.27mm pin spacing, so basically SOIC/SOT packages are my usual limit, but these are 0.5mm).  But at least they're cheap.

I've put both banks into a single CPLD package.  And there were spare pins, so I also put the address increment circuit into the same package.  There are still a few pins left, and quite a few LEs, so I'm thinking about integrating more, too, although I'm not sure what exactly.  The design files are up on github.

Update

I decided to go ahead and move a few parts into the CPLD that could reduce the chip count substantially without needing many more pins on the CPLD: there are 3 muxes that are used to override register selections (for read port a in bank 0, allowing register 7 - the instruction pointer - to be selected, and port b in bank 1, allowing register 8 - the memory base address - to be selected) and the input to the write port for bank 0 (allowing the incremented instruction pointer address to override the usual instruction result bus).  I moved these three muxes into the CPLD, which will save 3 entire ICs in the design, but only needed 3 pins on the CPLD.  I still have some pins left, but not enough for any buses and there aren't any more easy wins, so will probably leave it at this.  Logically, this behaviour is all  directly related to register handling, so integrating it with the register file is sensible, although it's very specific to this design now.  I can live with this; I never intended this to be a TTL-purist project, and playing with CPLDs was on my list of things to do anyway. 

Github update to follow.

Discussions