NHacker Next
  • new
  • show
  • ask
  • jobs
  • submit
login
▲NANDputer Lives (2013)blog.kevtris.org
38 points by peter_d_sherman 58 days ago | 21 comments
Loading comments...
djmips 58 days ago [-]
https://www.nand2tetris.org/ for a full course.
dezmou 58 days ago [-]
for those who also want to build a computer with only nand gate, I recomend this awesome game https://nandgame.com/
bombcar 57 days ago [-]
Reminds me somewhat of the C complier that only emits MOV instructions: https://github.com/xoreaxeaxeax/movfuscator
weinzierl 58 days ago [-]
"What is a NANDputer? it’s a computer made out of nothing but NAND gates of course!"

Isn't any (reasonably modern) computer made out of nothing but NAND gates (discounting DRAM, power supply, etc)? Sure, it's not discrete components, but its NAND gates nevertheless.

Brian_K_White 57 days ago [-]
Nand gates are not the most efficient way to build all functions.

It's just that when you are merely drawing a schematic and treating all gate types as equivalent atomic particles, where a NAND is just a symbol like OR, and ignoring what they're actually made of, NAND is captivating because you can build anything else out of nand.

But the only reason you can build anything else out of nand in the first place is because a single nand gate does a lot, and is made of a lot of transistors and diodes, and you essentially waste some to get other functions.

For a basic example, if you need to simply invert a signal, you can just feed it to both inputs of a nand, and the output will be the opposite of the input.

But that is wasting 90% of the nand. NAND is just AND with an inverter added to the output. Feeding the same signal to both inputs of an AND is a no-op. So you just used a lot of transistors and diodes to do nothing at all, just to use the inverter on the output.

(edit to add real numbers: 4 transistors for the AND part, and 2 more transistors for the inverter, and really a single CMOS transistor is really two simpler transistors, so that's 12 classic transistors to make a single nand gate, and it also needs it's own power and ground connections to half of the transistors besides just the inputs and output, for each single nand gate.)

Building on that, OR is actually just AND with inverters on all inputs and outputs. NAND is half of that already, and above we know how to get an inverter by itself. So you can make an OR out of 3 nands, one to be the AND and inverter on output, and two more nands just to act as inverters for the inputs. So, that is a hugely wasteful way to get an OR.

NOR -> add another inverter on the output of OR, that's 4 NAND to make a NOR. And so on.

It is still actually useful for real manufacturing when you're talking about discrete parts with only a few gates. It's more efficient to have one part number than three different part numbers if you're only talking about a few, and you can eliminate items from the bom. 2 of the same nand part are cheaper than one nand and one or, just like it's worthwhile to use all the same size resistors, even if it means using more of them.

But there is no such advantage from uniformity for designing a larger ic like a cpu. In that case it would just be a huge waste of junctions (diodes and transistors).

mungoman2 57 days ago [-]
In CMOS you can pull off a NAND with 4 transistors. You get the inversion for free. An AND would be a NAND (4 transistors) + inverter (2 transistors).
svorakang 58 days ago [-]
No. Although you could, it is not as efficient as using more tailored gates. Search for cmos stick diagrams to get a feel for the optimizations that are possible.
imtringued 57 days ago [-]
You can build "AND" and other gates directly with a combination of n and p transistors. In fact you can even extend "AND" gates to accept an arbitrary number of inputs. If you wanted to build an equivalent multi input "AND" gate with "NAND" you would end up wasting a lot of transistors.
grizzles 57 days ago [-]
Homomorphic encryption is a real, somewhat scary practical application of something like this in VM form. Because most applied homomorphic research libraries just target the NAND gate and leave the rest of the 'problem' to computer engineers.
greenbit 57 days ago [-]
Curious about power requirements. I'd guess, seeing all those old school MSI DIPs it takes 5V .. but how many amps ?
rwmj 58 days ago [-]
He seems to enjoy wiring looms! Beautiful though they are, was 2013 before the era of ultra-cheap PCBs and Ki-CAD?
tyingq 57 days ago [-]
Not a finished product, but I thought this active breadboard that uses crosspoint switch ICs as virtual jumpers was a neat idea:

https://hackaday.io/project/180394-breadware

djmips 58 days ago [-]
wiring looms is faster and easier for prototyping than making PCBs with KI-CAD. Maybe when the design is finished and you want to 'mass' produce something then go to the PCB.
rwmj 58 days ago [-]
Really? I've done my time doing wirewrap on complicated boards, and I would never want to go back to that. It takes days to do one of those boards and when you inevitably made a mistake, more days to find it. (Not that I'm saying you shouldn't do it, it's kind of meditative as a hobby.)
hoosieree 57 days ago [-]
I've done wire wrap (and unwrap). It is kind of meditative, unless you're rewrapping that connection for the 3rd time..
charcircuit 58 days ago [-]
It's also faster easier and cheaper to use FPGAs instead.
greenbit 57 days ago [-]
Now we just need the NOR-puter, so they can have a race, and settle the old NAND-vs-NOR debate once and for all!
lonelygirl15a 57 days ago [-]
That's been done - the Apollo Guidance Computer that took people to the Moon was built from purely NOR gates.

https://en.wikipedia.org/wiki/Apollo_Guidance_Computer#Logic...

jecel 57 days ago [-]
That already went to the Moon (sort of - see the difference between Block I and Block II AGCs):

https://en.wikipedia.org/wiki/Apollo_Guidance_Computer

hoosieree 57 days ago [-]
Anyone golfed their assembler for part 6? My record so far is 714 bytes (Python3).
benj111 58 days ago [-]
Doom port in 3 2 1....