1
\$\begingroup\$

I've been reading up on older computers like the PDP-1 and TX-0. I'm fascinated with them and love the idea of making a CPU of my own using discrete resistors and transistors. Keep in mind, this is an educational project and I will be attempting to create a 4-bit CPU.

It appears the old way was to use multiple voltages. In several documents, I've noticed that they use -3, +3 and +10. I find this confusing, but I imagine that those older germanium transistors required a much higher voltage to saturate.

I would like to go with either 5V or possible 3.3 as it seems to be a common standard.

Bottom line, I'm trying to know what transistor values I am looking for. I have a stock of some 2N2222, but I'm not sure what the "gotchas" are with a project like this. I've successfully constructed logic gates with these based on some simple examples. My concern is whether or not they can handle large combinational logic circuits. I've also read that combining diodes can increase speed. I realize that this is ancient technology, and that I could simply use 7400' series TTL chips, but this seems fun.

Bear with me as I'm a software engineer, but learn circuits for fun.

\$\endgroup\$
  • \$\begingroup\$ Do you want to use BJTs? Because mosfets would be better, and you can still implement RTL of course. \$\endgroup\$ – Vladimir Cravero Jun 29 '14 at 7:06
  • 1
    \$\begingroup\$ @VladimirCravero I think you'll find fan-in with RTL gates made with MOSFETs would be inferior to BJTs, because most have a Vt >> 600mV. \$\endgroup\$ – Spehro Pefhany Jun 29 '14 at 15:58
  • \$\begingroup\$ I don't really understand what you mean, fan in is a static parameter and the only bad thing about mos is that they're capacitive loads... I really can't follow your reasoning with the threshold voltage. \$\endgroup\$ – Vladimir Cravero Jun 29 '14 at 16:00
3
\$\begingroup\$

Retro-computing projects like this are big fun, but also a lot of work. For a start, you must ask yourself a few questions:

  • how faithful do you want to restrict yourself to old technology? You say you want to build a CPU, that is a much more modest goal than building a computer! It is also much more interesting to design and build a CPU than a 10 x 10 x 10 x 10 array of single-bit RAM cells...

  • how faithfully do you want to be to the old architectures? With external RAM and ROM (cheap and plenty) you can cheat for instance by using a very wide instruction that contains the next instruction address, so you don't need hardware (or data paths) to increment the PC. (Note that some of the old architectures cheated in the same way by having their registers in RAM.)

  • what level of performance do you want to achieve? With 74-level TTL/CMOS chips 10 MHz might be possible, with discrete components I think 100 kHz is more realistic.

  • what level of effort and resources (money, time, volume) am I willing to spend?

Once you have made your (tentative) choices you should do some (reality-check) calculations:

  • how many transistors (or NAND gates, or 74-style chip pins, etc) do you need?
  • what is the cost, power consumption, volume, power dissipation, etc.
  • how long would it take to assemble the CPU?

Let's do some very rough calculations. The 4004 had 2300 transistors. It uses all tricks in the book to limit the number of transistors, some of which are not available for a discrete BJT design (charged logic, pass-transsistor multiplexing), and the designers were clever. So let's (IMO conservatively) assume that you need 10k transistors. Assume 10mA collector current, 5V power, 1 cm^2 per transistor.

Now get your back of the envelope (or napkin, beer carton, or whatever):

  • Assume half the transistors are conduction, the total current is 0.5 * 10k * 0.01 = 50A. At 5 V this is 250 W. You will need a few PC-style PSU's, heavy wiring, decoupling, etc.

  • At $ 0.10 per transistor the cost will be $500. Doable, but maybe you'll have to consult your wife. Note that you must add all other costs: resistors, breadboards, solder, wiring, etc.

  • Assuming a very conservative 1 cm^2 per transistor your minimum area will be 1 meter x 1 meter. With resistors, wiring, power distribution etc. 10 square meters might be a better guess.

  • Finally: assembly time. How long does it take to assemble 1 transistor (and all its associated circuitry)? My (optimistic) ballpark guess is 1 minute. For the 10k transistors that means 167 hours of soldering: about 4 full working weeks. Note that you are not allowed to make a mistake!

From these figures my conclusion would be: you shouldn't want to do this. Use a higher-level building block (NAND gate, 74HC-style MSI or LSI chip, or even FPGA) instead. If you want to get a feel for really building a CPU from first principles:

  • build a small part (let's say a 1-bit full adder, 4 bits if you are a masochist) from transistors and resistors. Now you have show that you can make gates and do logic.

  • build a larger part (maybe the full 4-bit ALU) from NAND gates.

  • build your CPU from MSI and LSI 74HCs-style chips, RAM and (Flash) ROM.

\$\endgroup\$
  • \$\begingroup\$ Steve Wozniak's floppy drive controller (late 1970s) stored for each "instruction" the address of the next instruction rather than using a counter, so the trick would only be considered a "modern cheat" if the quantity of extra ROM required was vast compared to the amount of circuitry saved. Given that the Woz machine used a total of 2048 bits of ROM, he clearly wasn't wasting much. \$\endgroup\$ – supercat Jun 30 '14 at 21:33
  • \$\begingroup\$ IMO the (Integrated) Woz Machine is the type of cheat I am talking about. It was made in a time when, compared to the old CPU's like the PDP-1, the price balance between memory and random logic had shifted considerably. \$\endgroup\$ – Wouter van Ooijen Jul 1 '14 at 5:38
  • \$\begingroup\$ It sounded like you were regarding such tricks as being less than faithful to old architectures. I would say "faithfulness" should depend upon the amount of extra ROM used for the circuitry saved. Using 4MB of ROM and two 8-bit latches to do a job that could be done with 256 bytes and a half-dozen chips would be a "modern cheat", but the Woz machine was simply clever. I think the Woz Machine was "Integrated" into other chip functions in the Apple IIgs, but the original was just the Woz Machine. \$\endgroup\$ – supercat Jul 1 '14 at 15:36
  • \$\begingroup\$ I'm sure there are great hacks of the era, but IMHO the Woz Machine (floppy controller) and the Atari 2600 are two truly great examples of how closely-fitting hardware and software can work together in ways vastly more efficient than would be possible if the hardware weren't designed around the "exact" capabilities of the software. \$\endgroup\$ – supercat Jul 1 '14 at 15:38
  • \$\begingroup\$ I totally agree that the woz machine was an example of good (or more than that) engineering. But what I was pointing out is that if you want to stay true to the design realities of let's say the PDP-1 area, then basing your CPU design on memory (RAM or ROM) being cheap is a kind of cheating. \$\endgroup\$ – Wouter van Ooijen Jul 1 '14 at 16:04
2
\$\begingroup\$

That's a lotta transistors. I don't see any reason 2n2222 wouldn't work. I'd personally go for packages of transistors so that you can save space while still having full control. You would also use less current/power in general by going with packages of transistors since they usually have lower current carrying capabilities.

I'm also curious as to why you don't go ahead with CMOS rather than RTL. It would use less power, be capable of higher clock speeds, and likely be more compact. Maybe you're just figuring out RTL though, which is fine.

The 300S14-U is a package of 4 transistors all in one package if you want to stick with BJT's. That'll help save space..

Something like the package of mosfets ALD1106 would give you 4 in a package and make it easier to breadboard up if that's what you're using.

Mosfets would waste less power and likely switch faster. Fanout with mosfets would only be a speed/timing issue, whereas fanout with bjt's require calculating current required from the resistor.

\$\endgroup\$
  • \$\begingroup\$ -1 because you didn't check whether the CA-3083 is available (non-stock item at both Digi-Key and Mouser). \$\endgroup\$ – tcrosley Jun 29 '14 at 17:06
  • \$\begingroup\$ @tcrosley Ah, good point. I used them in labs at college and didn't realize they'd been retired/obsoleted already. I've replaced it with a 4 transistor version available at least at mouser. \$\endgroup\$ – horta Jun 30 '14 at 18:11
  • \$\begingroup\$ Resistor-transistor logic can get by with amazingly few components if one doesn't mind wasting and having to dissipate a lot of power. CMOS requires more components, which would likely in turn mean more soldering. It would be helpful if there existed a two-terminal device whose resistance would increase with current over a certain threshold (not quite a constant-current source, but closer than a resistor would be), since replacing many resistors with such a thing would cut heat dissipation considerably. \$\endgroup\$ – supercat Jul 1 '14 at 15:44
  • \$\begingroup\$ @supercat Yeah that's true. I see people's example of the simplest current source as a jfet with a resistor. It'd add a component to each leg of Resistor-transistor logic, but it would use less power. I wonder if you could use mosfet current sources rather than resistors to save power. If the sources are all based off of one transistor, you wouldn't add many components at all. \$\endgroup\$ – horta Jul 1 '14 at 22:07
  • \$\begingroup\$ @horta: All based off one voltage source you mean? If you chose a suitable FET, and they were reasonably well matched, it could work quite well. A couple resistors and a pot to set the gate bias (which would source/sink zero current) would suffice. The MOSFETs would cost a little more than resistors, and would have three solder connections rather than two, but from a component-count standpoint they'd be perfect. \$\endgroup\$ – supercat Jul 1 '14 at 22:13
0
\$\begingroup\$

Cheapest kind will do if you're only interested in functionality.

MMBT3904/6 are about 1.7 cents if you buy a reel of 3,000 ($51) NPN/PNP, SMT.

Cheapest through hole parts I see at digikey are 3.2 cents each in 2,500 ($80) 2N3904

Guaranteed beta of 70 at 1mA should work for you. The older 2N2222 have lower guaranteed gain and are more expensive so I don't see the attraction. If you happen to find a barrel of the TO-18 version they're probably worth more on eBay than buying new 2N3904 or 2N4401.

Those are Digikey prices, you can do better. Arrow has ON semi MMBT3904 for 0.94 cent if you buy 10k ($94). E14 has NXP MMBT3904s for $33 for a reel of 3,000. Of course shipping will cause total cost to vary once you're down in the "almost free" region under $100. Sub-1 cent through hole parts are easily available in China.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.