16
\$\begingroup\$

I'd like to build the simplest possible computer. I don't care about speed or storage, indeed having slow speed and low storage is a huge advantage as I want to build it out of transistors (ideally relays!) and I want an LED for each state. It'll be programmed via a Raspberry Pi which will host a camera so that you can see each clock cycle executing (yes, it's going to run at Hz not GHz). It'll be an open design with the intention that schools can buy the parts, understand and improve on the design. So the total budget must be well under £400, preferably about £100.

I have researched this over many years and have good ideas for the CPU (minimal registers, microcode in DIP switches and bit serial logic/arithmetic operations to reduce the transistor count). What I can't figure out is how to get the memory, I'd like 1024 to 8096 bits.

The best I can come up with is two 6 bit one-of-n decoders giving access to 64 x 64 grid of capacitors. Either they have a charge in them or they don't, and reading would reinforce that state. There would be no LEDs on the capacitors as the refresh of this 'DRAM' would be in the order or minutes (which is a shame as this would be the only part not to show state).

Other ideas include some form of tape drive (compact cassette mechanism: great storage, too complex, no seek), drum memory (tape around a bean can: too hard to get the mechanics working), mechanical memory (bike wheel and ball bearings: too many bit errors), core memory (large hard ferrite cores: still very tricky to get right at the scale required), tape/card (can we still buy the tape readers), rotating disk with punched holes in binary order and some magnetic memory for storage (too complex to build).

Ultimately the aim is to publish a design that can be build in a school year where all parts of a CPU and memory are 'visible' and so you can see the instruction fetch, decode to microcode, and address decoding/register access/logic all happening over the course of minutes.

If anyone has ideas for really cheap memory (<<£100) where it's clear exactly how it works then please do let me know.

Tony

P.S. current state of play is at http://www.blinkingcomputer.org/

\$\endgroup\$
10
  • \$\begingroup\$ Just google around for people who already did this and similar things, the designs are there, you can make a BOM and find that you likely need a bit more money and time. \$\endgroup\$
    – PlasmaHH
    Commented Jan 7, 2016 at 20:14
  • \$\begingroup\$ I would suggest that going to the transistor level might be a bit much for a school project. I would think CMOS small and medium-scale integration would be much more do-able and probably more understandable (gates, registers, buffers, decoders, etc.). You could include something that demonstrates how gates are made from transistors, flip-flops are made from gates, etc.). \$\endgroup\$
    – Tut
    Commented Jan 7, 2016 at 20:36
  • 1
    \$\begingroup\$ Just an idea: You should make the (program) memory easily modifiable by hand, so people can "program" manually with their hands :-). \$\endgroup\$
    – oyvind
    Commented Jan 7, 2016 at 21:12
  • \$\begingroup\$ First decide what you want the computer to be able to do. That will determine how much memory you need and what the instruction set should be. \$\endgroup\$
    – Tony Ennis
    Commented Jan 7, 2016 at 23:46
  • \$\begingroup\$ Thanks all. PlasmaHH: Yes, it's a huge challenge to do this in money and time constraints, that's why nobody else has done it yet. Tut: I really want to be able to see each signal. People will then see how logic gates are built from transistors. oywind: Yes, it'll be programmable via a Raspberry Pi with a web interface that you can write your own code and see it running with a web cam. Tony Ennis: I want to build the simplest computer that shows every signal - this will demonstrate all aspects and necessitate non-standard architectures, such a bit-serial ALU. \$\endgroup\$ Commented Jan 8, 2016 at 4:50

7 Answers 7

10
\$\begingroup\$

There are many people who have built computers out of discrete transistors, ICs, relays, and even vacuum tubes. They range from 4-bit machines all the way up to 32-bit. The 4-bitters of course will be the simplest you can build and do anything. The very first microprocessor was Intel's 4-bit 4004.

I would start by searching Google for "home-brew 4-bit computers" (without the quotes).

Here's a board from a transistorized 4-bit computer:

enter image description here

As far as memory goes, some of these projects which otherwise are using discrete transistors "cheat" and use SRAM chips. They are incredibly cheap for moderate amounts of memory, 32KB is $3.28 and requires no clocks and no refresh.

Even if the rest of your computer uses relays, using them for memory will be prohibitively expensive.

If you can get by with 1K bits, you could build one with transistorized flip-flops; 2048 2N3904's will cost 3¢ apiece ($60 altogether, plus the other components which will be even cheaper -- resisters for 1/2 a cent etc). You can get PCB's made for $10 apiece, then hire a kid to stuff them.

Relay computers date all the way back to the late 1930's, and one of the first was the Harvard Mark I. It's where the name Harvard architecture comes from (separate program space and data, compared to von Neumann architecture that combines the two).

The most famous home-brew relay computer is one built by Harry Porter.

enter image description here

Check out the videos of the computer running. Reminds me of an old electromechanical telephone exchange.

Here's a portion of another home-brew relay computer called Zusie:

enter image description here

Lots of blinking lights.

And finally, here's a link to a video of a 4-bit adder, made up of 24 relays. Adders like this are the heart of the ALU (arithmetic logic unit) in a computer.

\$\endgroup\$
3
  • \$\begingroup\$ Sorry, the "I have researched this over many years" was buried in the second paragraph. I've edited the title of the post to clearly state it's the memory I care about.If you can get by with 1K bits, you could build one with transistorized flip-flops; 2048 2N3904's will cost 3¢ apiece ($60 altogether, plus the other components which will be even cheaper -- resisters for 1/2 a cent etc). You can get PCB's made for $10 apiece, then hire a kid to stuff them. \$\endgroup\$ Commented Jan 8, 2016 at 4:07
  • \$\begingroup\$ ctd... this is closer than I'd guestimated, but you do need the address decoding and I'd put in more transistors per memory cell. Maybe a one transistor one capacitor 'DRAM' memory cell is also possible within budget. \$\endgroup\$ Commented Jan 8, 2016 at 4:17
  • \$\begingroup\$ @TonyRobinson I did try to address the memory isuse (as you acknowledged) but I was also trying to provide information re your desire to make a computer out of discrete transistors and/or relays, and to illustrate that several have been successful at this. Good luck in your endeavors. \$\endgroup\$
    – tcrosley
    Commented Jan 8, 2016 at 6:13
6
\$\begingroup\$

If you want simple memory, then look no farther than a flip-flop. With two transistors and four resistors, you can have a whole bit of memory. You can also make a flip-flop with two cross-coupled NOR gates, or just buy an IC with a bunch of flip-flops in it already.

In fact, the very fast CPU cache is basically a bunch of flip-flops, integrated into the CPU.

\$\endgroup\$
4
  • 2
    \$\begingroup\$ DRAM is more power consuming as it needs to be constantly refreshed whereas SRAM uses only a small quiescent current when idle. The reason for using capacitors is because it only requires one transistor per bit, so allows much higher memory densities. \$\endgroup\$ Commented Jan 7, 2016 at 22:16
  • \$\begingroup\$ You're right -- I had in mind simple RTL flip-flops. I'll edit to clarify. \$\endgroup\$
    – Phil Frost
    Commented Jan 8, 2016 at 3:05
  • 1
    \$\begingroup\$ ICs are out - they hide what's really happening. I want every signal to be exposed as far as possible. I really don't care about power - I can't see power being a problem, it'll be wired to a Raspberry Pi so power is available. One transistor DRAM may be a much better way to go than my array of capacitors ideas as the earlier post suggested - I'll have to work out what transistors are needed for that to keep the charge leakage low enough (I need refresh times in the order of minutes). Else, yes, flip flops look like the next best idea. \$\endgroup\$ Commented Jan 8, 2016 at 4:22
  • \$\begingroup\$ @TonyRobinson "It'll be wired to a Raspberry Pi so power is available." - ...maybe. Depends on the maximum power available through a Raspberry Pi, and which logic family you plan to use. (I'd expect that an average bench PSU would be able to supply quite a bit more power, though) \$\endgroup\$ Commented Jan 8, 2016 at 8:44
3
\$\begingroup\$

I agree that it would be pretty cool to have a complete computer system with an LED for every bit of state, visible to the human eye.

The TIM 8 relay computer uses 8 capacitors, 2 diodes, and one SPDT relay per byte in its 12 bytes of RAM main memory (data memory). (The TIM 8 has 16 bytes of variable memory if you include registers).

The TIM 8 relay computer uses punch tape for its program memory.

enter image description here

enter image description here

Is it possible to replace those diodes with LEDs, so there's a brief pulse showing the data going in or out of a byte of RAM? Perhaps if the system does DRAM refresh rapidly enough, scanning though every byte of RAM, then every bit of state would appear to be visible at those LEDs (although technically only one byte of LEDs would be activated at any one instant). (Those would have to be pretty high-current LEDs if we want to LOAD and STORE data from those capacitors to relay-based registers).

Is it possible to put a resistor and a LED across each bit-storage capacitor, truly simultaneously showing every bit of state? (Those would have to be pretty low-current LEDs and physically large capacitors if we want the capacitor to hold the data long enough for a reasonable refresh rate. Some LEDs can be easily seen with only 1 mA of current. With a 1 second refresh cycle and (guesstimating) capacitors initially charged to 12 V even though (guesstimating) a charge of 7 V on the capacitor is enough to charge the downstream hardware, then the capacitor needs a rating of C ~= i*t/V = 1 mA * 1 s / (12 V - 7 V) = 200 uF. ).

This will, of course, be vastly larger and take more human labor to assemble than pretty much any integrated-circuit-based main memory.

\$\endgroup\$
1
\$\begingroup\$

Why don't you just use a simple 8 bit CPU (e.g. 6502) & a very small amount of memory (CPU registers, IC RAM, & a very small amount of external storage (e.g.: FD, HD, or flash disk, etc.) & then just explain with slides the following:

  1. The hardware components, sub-components, & their functions
  2. The operating system, system programs, & user programs
  3. Load & execution of a simple program to add 2 numbers together, store the result in each type of memory & display it on a video display.

If you want to keep the device as simple & inexpensive as possible, use a micro controller development system as your base system or even an Arduino is simple & inexpensive enough. None of the students are going to build a simple relay or vacuum-tube computer--nor should anyone really want them to do so. They should start out with a good book & an Arduino for basic understanding of programming. Then later, if they want to get into reading/controlling external devices, they can delve into specific programming or into engineering.

Here's a good project for you to consider for ideas:
http://www.instructables.com/id/How-to-Build-an-8-Bit-Computer/?ALLSTEPS

\$\endgroup\$
3
  • \$\begingroup\$ Although nowadays we call it the "W65C02S" \$\endgroup\$ Commented Jan 7, 2016 at 20:56
  • \$\begingroup\$ Thanks, I come from 6502 days (BBC micro but also I worked on the ZX80). I agree that there's a lot to learn at that level, indeed I was just rereading the BBC Microcomputer Advanced User Guide. I really want to be a level below that, you see a 5-bit instruction come in, it jumps through a small set of microcode that set a few bit registers and bus lines and calls a bit serial ALU so that you can see all logic happening bit by bit. That's why it'll be the slowest ever. \$\endgroup\$ Commented Jan 8, 2016 at 4:36
  • \$\begingroup\$ Yeah--that will be slower. Did you look through the detail at this url: instructables.com/id/How-to-Build-an-8-Bit-Computer/?ALLSTEPS It's actually quite good & allows for some unique customization for your system. \$\endgroup\$
    – DIYser
    Commented Jan 8, 2016 at 9:06
1
\$\begingroup\$

I agree that it would be pretty cool to have a complete computer system with an LED for every bit of state, visible to the human eye, rather than hidden inside a mysterious black box.

You might consider using a more-or-less standard bit-parallel memory bus -- perhaps something like the STEbus (IEEE-1000 bus).

You might consider using a bunch of ICs like 74HC273 or 74LS373 or 74HC564 to store the data so the current state of the data inside the chip is always visible on LEDs connected to the parallel-output pins. Then use octal 3-state buffers (such as the 74HC241 or 74LS245) or muxes, also connected to those parallel output pins, to funnel the data into the bus. You end up with a few one-of-N decoder chips and 2 chips per 8 bits of storage. "This allows you... to view what data is actually stored in each byte of RAM." -- Pong Guy's SAP-1 Simple as Possible Computer with Discrete Component RAM. The same arrangement is used for the registers in Jaromir's Fourbit CPU or the registers in Kyle's 8 bit spaghetti CPU.

Current (2016) prices from Mouser.com are about $0.11/bit in qty 10 for such an arrangement (one octal storage latch plus one octal 3-state buffer per 8 bits), and $0.05/bit for new LEDs in qty 500. For 2^9 bytes = 512 bytes = 2^12 bits = 4096 bits, that's (very roughly)

  • $205 in LEDs
  • $450 in storage and buffer chips
  • $??? the 1-of-N decoder chips to select the appropriate storage or buffer chip; the cost of boards, wire, labor, and etc.

Perhaps you could build (very roughly) 64 bytes of data memory (the same amount of data memory as an Atmel ATTINY13 or a Microchip PIC16F570) for roughly $90 ( which may fit within your $150 ~= £100 budget).

You can see why it's tempting to replace all those storage and buffer chips and most of the decoder chips with an off-the-shelf 32Kx8 parallel SRAM chip giving you far more storage for less than $10. (Alliance AS6C1008-55PCN, Cypress CY7C199CN-15PXC, etc.)

This may be why most home-brew CPUs, from the tiny Nibbler 4 Bit CPU to the impressive RC-3 Relay Computer http://www.computerculture.org/2012/09/rc-3-relay-computer/ http://www.computerculture.org/projects/rc3/ , are hooked up to a black-box SRAM chip for main memory.

With something like a standard memory bus, perhaps you could have several different memory boards connected to the CPU at the same time:

  • A few bytes of completely visible variable storage, and a few bytes of completely visible hard-wired program ROM, which should be enough for some interesting demo programs.
  • A SRAM chip that can be occasionally plugged in for holding programs or data or both when you haven't yet built enough completely visible memory to store them.
\$\endgroup\$
1
\$\begingroup\$

If you want program memory that’s relatively cheap then there’s exactly one solution that will fit your budget: HP 9100A state machine electromagnetic printed circuit ROM. Since the drive and sense line planes need to be very close together, you need either a 4-layer board and have the two inner layers used for it, or the thinnest PCB you can find - and prototype it first to make sure your drivers and sense amps work well. And of course you’ll need to write a script to generate the KiCaD PCB file for it, since you won’t want to draw tens of thousands of trace segments by hand.

Alternatively, if you feel like doing lots of manual winding, then you can do rope memory similar to the HP 9100A control ROM. That calculator had two ROMs at quite different physical scales, both electromagnetic. The rope memory there used toroidal cores with dedicated sense windings. That’s different from the Apollo Guidance Computer where cores had no dedicated windings - there was a global sense line.

So, if you can afford the time to do lots of toroid core winding then you could have a core-based ROM like 9100’s control store, and that ends up being cheap per bit if your time is free. You could even use reed relays as sense “amplifiers” for this, with an impedance matching transformer, but such memory makes even more economical sense for transistorized systems.

If you want to build a relay computer from relays you buy from mainstream distributors, ie. parts that would be reasonably available to anyone else building it, then a £400 budget won’t go very far. For example, 4-pole form C relays will cost you £5 each or thereabouts - so that’s <100 relays and <400 poles.

What I’ve found is that you can definitely buy thousands of small and fast relays on eBay for <£100/thousand but you never know which ones you’ll get. I’ve got 6,000 SPST reeds for <$500 total but that is not necessarily a representative outcome, and those thousands were spread across three, no, four (!) different part types, all having different coil power ratings and different coil voltages. My ongoing project has grown from 7,000 to well over 10,000 relays at this point and it’d cost more than £40k for someone to just go and buy same relays at distributor prices. Never mind the other parts that aren’t cheap but are called for in thousands, like the hexadecimal rotary dip switches for the PROMs. Or the inconvenient fact that one of the key relays I use is only made to order and the minimum order size is 100k pieces, and they still cost well over a dollar. So even if you wanted to buy them “new”, it’d have to be a group buy for a big bunch of people all building the same computer, and willing to sit down and solder thousands of relays.

Needless to say this scale is out of reach of hobbyists without scouting for serious eBay deals, being lucky, and then basing the design on what parts were available for cheap vs. any preexisting design. And my budget was most definitely hobbyist in that regard. And yes, it took unreasonable amounts of time to literally scroll across thousands - more likely tens of thousands at this point - of eBay listings just to find the “long tail” of the deals - the ones that were mislabeled enough to stay outside of mainstream search results. Buying 1,000 Hamlin reeds for $40 shipped to my door is a Pyrrhic victory if it takes 12 hours to locate the listing (it took me a bit over that in fact). I looked in my notes just now and I averaged about 6 hrs of eBay searching per 1,000 relays, and with other parts I needed I’d already put in about 100 hours just in eBay time. That’s not engineering or design or anything - just staring at results and looking for outliers. Finding relays en masse at $1 each is easy. “relay lot” in eBay search, sort highest price first, 200 results per page, and you’ll find at least a couple listings right this very moment that could be used in any reasonable relay computer project, if you got thousands of dollars in spending money for it, that is. Finding them for over an order of magnitude less is a whole another story, given the prevalence of junk they get mixed in with, even if eBay search allows some degree of fine-tuning and additive/subtractive terms. So that’s the less-than-glamorous side of such projects, and probably why many people lose interest at some point: the iron will of follow-through determines success, and you must have the ample time available to dedicate to it or it won’t happen.

I was very much driven by the specs of the available parts, and e.g. having reeds that respond in ~0.3ms made a big difference in what I could do, since complex and multi-layered combinatorial logic became possible that still had propagation times measured in single milliseconds. Eg. an 8x8 integer multiplier that produces a result in under 5ms. But if I didn’t have those fast reed relays then I’d have implemented a wider and slower pipelined multiplier, and there’d be no way to target sub-10ms clock cycles. Same goes for RAM and registers - if I didn’t have so many bistable relays, I couldn’t have implemented low power densely packed memory. Astable relay memory is extremely power hungry and requires lots of airflow to stay cool enough not to diminish relay life, never mind that it’d just all melt together if an “all ones” memory state was permitted with relays in physical contact with no gap. But with bistable relays that’s no problem at all, since only relatively few coils are active at any given time, and one can lay them out so that adjacent bits in a word don’t come near each other, so that no typical acces pattern would produce a hot spot on the board.

Large relay projects that use physically small relays need to pay very close attention to fanout and to keeping the contact loads under control. The scale of popular relay computer projects like Harry Porter’s is not sufficient to make this a driving factor. But once you’re past a couple thousand relays, and don’t use diodes for switching, then fan-out trees and contact load management become constraints that drive the entire design, and require out-of-the-box thinking. Therefore a corollary: making relay computers out of physically large relays that can carry 2-8 Amps per contact is a whole different ballgame than making relay computers out of relays that will have long life only if you keep the contact loads under 100mA, ideally at 50mA or less. Eg. Harry Porter’s popular design can’t be used as-is with such relays, never mind that none of the implementations use relay memory, which really would drive the point about fan-out home. In my case, the design was built around memory, with memory being designed first, as it proved most challenging. The first kilobit was the hardest to design, and in my case there were different designs since I didn’t have huge lots of the same type of relay. I’d have a kilobit of memory done all from the same relay type, two if I was lucky. Sometimes buying the 1,000 relays of a given type cost as much as buying the remaining 30 or so needed to finish the given kilobit (there always seems to be one or two bad ones per thousand in those eBay lots - I have no idea why).

I’ve been investigating the cheapest way to build a homebrew discrete computer and the transistors give you the best “bang for the buck”, especially that you can then use very cost effective PROM, and a computer without a PROM is not much use. Now I admit that my application was such that there was no need to change the code – essentially a calculator with lots of fixed code used to implement math functions. But even for a machine that targets lots of user programmability, a solid library of functions will shrink the size of user programs and place less demand for scarce RAM. Speaking of RAM: no surprise there; core memory is very cost efficient if you’re willing to thread the cores yourself and consider your time free. That can be an order of magnitude cheaper than bipolar static RAM, since that uses two transistors per cell, and also some resistors and capacitors. If you’re OK with dynamic RAM then a diode steered capacitor array can also be very economical, but relatively slow, since the capacitors have to be much larger than the capacitance of diode junctions, and power consumption becomes critical as well.

\$\endgroup\$
0
\$\begingroup\$

Here's another suggestion for a similar project that might be worthwhile - build a Turing Machine.It's about the simplest computing machine possible

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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