How to Build a Computer 19: Logic Gates

 

Welcome back to How to Build a Computer. You recall where we’re at, right? Hah! Trick question. As if I’d stick to a rational sequence. Today we’re going over some of the details in how you go from electrical circuits doing whatever it is that electrical circuits do and turn that into logic. We’re talking Logical Gates

Logic gates! Each one more logical than the last.

Logic gates are transistor circuits that you can use to modify a signal. Let’s take the NOT gate as an example. If the input is on, the output is off. If the input is off, the output turns on. Whatever you put in, you get not-that coming out. Simple enough. Except the part where you’re creating energy out of nothing; what’s up with that? Well, not pictured you’ve got a five-volt source and a grounded drain. When you’re creating energy out of nothing you’re actually stealing it from that source. Those details make laying out your circuits more complicated but can generally be ignored when you’re drawing logic gates. Heck, as long as I’m recycling my drawings have another:

This hockey rink looking thing is actually a NOR gate. If either the “A” or “B” source is turned on the output (“O”) gets turned off.

There are eight basic logic gates. To keep track of them you use something called a truth table. It’s a collection describing what you put in and what you get out. The NOT gate is easiest to understand. Here’s it’s truth table:

If I was diagramming this with, I don’t know, pickles, you’d be paying more attention.

Actually, there’s one gate that’s simpler. It’s called a buffer. You ready for it?

The main problem with these suckers is what the heck you’d use it for.

So, a wire, right? I mean, if the output is off when the input is off then why the fancy symbol and all? Actually it’s not just a wire; typically these are built by sequencing two not gates together. The old double-negative. Fiendish! Why? It’s in the name ‘buffer’. It isolates one circuit from another. Keeps pesky physics things from interfering with your neat and clean logic. Speaking of which, let’s go over the other gates.

The rest of the gates transform two input signals into one output signal. Makes things more complicated. We’ll try an AND gate next:

and Dragons, that’s what.

Because you’ve got two input wires, each one which could be on (1) or off (0), you’ve got four possible combinations of ons and offs. An AND gate, as the name implies, only works when input A is on and input B is on. Makes sense. Slap a NOT gate on the end of that and you get a NAND gate (“not and” in case you hadn’t figured that part out.)

You’re on pins and needles waiting for me to make a Bill Gates joke, aren’t you? I hope you can live with yourself.

As long as both inputs aren’t on at the same time the output will be on. I think you’re getting this, so I’m going to do the remaining four all at once.

Abandon all hope ye who enter here. Well, go on; make with the abandoning!

If you tum either input on in an OR gate you’ll get the output on. It’s not picky. The XOR gate is on a diet; it’ll take either input, but if you offer it both it’s out. And again if you slap a not gate on the front of either of those you get the opposite effect. Matter of fact, if you want to get the opposite effect on any of those gates you put one of those stylish little circles on the front.

Okay, we’ve got all eight logic gates. Could we make more? Sure. These are either useless (two entry wires, whatever combination of on and off they are the output is always off. Dead end.) or they’re redundant. Lemme draw you a quick truth table:

00 0
01 1
10 0
11 1

That one’s different, right? No, not really. Actually, only the one input matters; when the second input is on the result is on, and when the second input is off both are off. What you’re actually looking at here is a digital buffer on the second gate and never mind the first. This one is a combination of redundant and useless, much like some people I could name.

Okay, the eight gates though. We can see how you’d be able to run electricity through them, and hey, we’re probably also good with actually figuring out the transistors for these gates. Just one thing; how do we actually get logic out? Join us next week when we cover that in “Crazy Eights and Even Crazier Eights” or “The Eights are on Prozac Now, They’re Feeling Much Better.”

This is part nineteen of my ongoing series on building a computer, the brandy old-fashioned way. You may find previous parts under the tag How to Build a Computer. This week’s post has been brought to you by Sam Elliot. Sometimes you eat the bar, and sometimes the bar, well, he eats you.

[First – Silicon] [Previous – Quantum Mechanics] [Next — Digital Watches]

Published in Science & Technology
This post was promoted to the Main Feed by a Ricochet Editor at the recommendation of Ricochet members. Like this post? Want to comment? Join Ricochet’s community of conservatives and be part of the conversation. Join Ricochet for Free.

There are 23 comments.

Become a member to join the conversation. Or sign in if you're already a member.
  1. Qoumidan Coolidge
    Qoumidan
    @Qoumidan

    Hank Rhody, Red Hunter:

    We’re talking Logical Gates

    Logic gates! Each one more logical than the last.

    Logic gates are transistor circuits that you can use to modify a signal.

    This reminds me of a kids computer game from the mid 80s, Robot Odyssey.  It was fun but we never were able to beat it, probably because we were illogical kids.

    • #1
  2. Gary McVey Contributor
    Gary McVey
    @GaryMcVey

    Hank Rhody gives brains a good name, and it’s about time someone did. This man could take a handful of sand and turn it into a billion transistors that allow us to see Scarlett Johansson’s naked selfies. That’s a key evolutionary skill that must never be lost. 

    Seriously, what a series. Good for a membership all by itself. Everyone who writes about science or engineering should study Hank’s style. I know I do. 

    Ignorant question: I vaguely recall that neural networks were once considered to have the hopeless flaw of being unable to execute the Exclusive-OR (XOR) function. True? Or propaganda from the Von Neumann wing of history? 

    • #2
  3. RightAngles Member
    RightAngles
    @RightAngles

    Gary McVey (View Comment):

    Hank Rhody gives brains a good name, and it’s about time someone did. This man could take a handful of sand and turn it into a billion transistors that allow us to see Scarlett Johansson’s naked selfies. That’s a key evolutionary skill that must never be lost.

    Seriously, what a series. Good for a membership all by itself. Everyone who writes about science or engineering should study Hank’s style. I know I do.

    I know! I Like these even though the only words I understand are “the” and “and.”

    • #3
  4. Judge Mental Member
    Judge Mental
    @JudgeMental

    The different symbols you use to represent the different types of gates… are those by convention, or do they represent the physicality of how they are constructed?  Or both?  Or, I guess, neither?

    From my perspective, this all falls into the category of ‘hardware problem’.

    • #4
  5. Qoumidan Coolidge
    Qoumidan
    @Qoumidan

    Judge Mental (View Comment):

    The different symbols you use to represent the different types of gates… are those by convention, or do they represent the physicality of how they are constructed? Or both? Or, I guess, neither?

    From my perspective, this all falls into the category of ‘hardware problem’.

    Those symbols are in the game I played so I wonder about that too.  

    • #5
  6. GLDIII Reagan
    GLDIII
    @GLDIII

    We were promised no backdoor sneak to Boolean algebra, and there is no cheese….who moved our cheese

     -NYT review

    • #6
  7. Al French, sad sack Moderator
    Al French, sad sack
    @AlFrench

    If it isn’t illustrated with cheese, I’m not reading it.

    • #7
  8. Gary McVey Contributor
    Gary McVey
    @GaryMcVey

    How about thin slices of Wiener Schnitzel mit Ei, alternating with slices of pickle? Base/acid, should work. 

    • #8
  9. Hank Rhody, Red Hunter Contributor
    Hank Rhody, Red Hunter
    @HankRhody

    Qoumidan (View Comment):

    Judge Mental (View Comment):

    The different symbols you use to represent the different types of gates… are those by convention, or do they represent the physicality of how they are constructed? Or both? Or, I guess, neither?

    From my perspective, this all falls into the category of ‘hardware problem’.

    Those symbols are in the game I played so I wonder about that too.

    Yeah, the symbols are by convention. If I were making it up I probably would have carved them out of cheese or something.

    • #9
  10. DonG Coolidge
    DonG
    @DonG

    Gary McVey (View Comment):
    Ignorant question: I vaguely recall that neural networks were once considered to have the hopeless flaw of being unable to execute the Exclusive-OR (XOR) function. True? Or propaganda from the Von Neumann wing of history? 

     

    I don’t know why that would be.  Neural networks move computation from binary to analog (between 0 and 1). 

     

    A few comments on gates.  As implied the negation gates (not, nor, nand) require fewer transistors.  Gates also require very little power when steady (leakage) and bit more with each transition.  Gates also scale horizontally efficiently nand3 (3 input), nand4, nand5,…

    • #10
  11. Major Major Major Major Member
    Major Major Major Major
    @OldDanRhody

    GLDIII (View Comment):

    We were promised no backdoor sneak to Boolean algebra, and there is no cheese….who moved our cheese

    -NYT review

    Just this once, for you, pal.

    Image result for logic network diagram

    • #11
  12. Misthiocracy, Joke Pending Member
    Misthiocracy, Joke Pending
    @Misthiocracy

    Hank Rhody, Red Hunter: The main problem with these suckers is what the heck you’d use it for.

    I assume it’s kinda like a diode?  The point is to make sure the current is only going in one direction?

    • #12
  13. RightAngles Member
    RightAngles
    @RightAngles

    At last I can add to this discussion! Because I found this clever life hack! You can thank me later!

    • #13
  14. Hank Rhody, Red Hunter Contributor
    Hank Rhody, Red Hunter
    @HankRhody

    Misthiocracy, Joke Pending (View Comment):

    Hank Rhody, Red Hunter: The main problem with these suckers is what the heck you’d use it for.

    I assume it’s kinda like a diode? The point is to make sure the current is only going in one direction?

    Sort of. Transistors enforce the direction of current too, and any time you’re talking gates you’re going to have a lot of transistors hanging about. The reason given to me (and I’m not an expert in this; you might have better luck asking DonG or The Major) is that it functions to isolate one device from another. Semiconductors after all are only semi conductors; they have a higher resistance than you’d expect out of a copper wire. You’d expect some attenuation over a number of devices. Since a NOT gate doesn’t actually transmit the incoming signal (it shunts a new one down from the 5v source) then you wouldn’t get the signal attenuation.

    • #14
  15. SParker Member
    SParker
    @SParker

    You should probably point out–just for functional completeness–that you don’t need 8 gates.  Any function you want can be done with one or more NAND gates, or–if you’re out of those–one or more NOR gates.  Simple logic.  And fewer inventory headaches.

    • #15
  16. Hank Rhody, Red Hunter Contributor
    Hank Rhody, Red Hunter
    @HankRhody

    SParker (View Comment):

    You should probably point out–just for functional completeness–that you don’t need 8 gates. Any function you want can be done with one or more NAND gates, or–if you’re out of those–one or more NOR gates. Simple logic. And fewer inventory headaches.

    Myself I usually think in terms of AND, OR, and NOT. Gets the job done.

    • #16
  17. SParker Member
    SParker
    @SParker

    Hank Rhody, Red Hunter (View Comment):

    SParker (View Comment):

    You should probably point out–just for functional completeness–that you don’t need 8 gates. Any function you want can be done with one or more NAND gates, or–if you’re out of those–one or more NOR gates. Simple logic. And fewer inventory headaches.

    Myself I usually think in terms of AND, OR, and NOT. Gets the job done.

    Sensible.  It’s a difference between design notation and implementation.  Reading (or drawing) a schematic with NAND (or NOR) equivalents would be a major pain in the ass.  Unless you’re implementing the circuit in discrete transistors as our primitive ancestors did,  you’re probably going to want to take advantage of the equivalence.  If you’re manufacturing Programmable Logic Devices you are almost certainly going to do it as a sea of uniform gates on a chip and provide compilers for whatever notations your customers want.  I think that’s how they do it, anyway.

    There’s a similar thing in propositional calculus (boolean algebra, zero-order logic–mathematicians just love changing up names for the same thing).  A NOT and oneof(AND, OR) gets you there, but you’re probably going to want a nice symbol for material implication ( NOT a OR b) if you’re doing proofs.  And also remember what the nice symbol really means.

    • #17
  18. Major Major Major Major Member
    Major Major Major Major
    @OldDanRhody

    SParker (View Comment):
    Unless you’re implementing the circuit in discrete transistors as our primitive ancestors did,

    Hey!

    • #18
  19. GLDIII Reagan
    GLDIII
    @GLDIII

    Major Major Major Major (View Comment):

    SParker (View Comment):
    Unless you’re implementing the circuit in discrete transistors as our primitive ancestors did,

    Hey!

    Yeah hey!

    • #19
  20. Gary McVey Contributor
    Gary McVey
    @GaryMcVey

    GLDIII (View Comment):

    Major Major Major Major (View Comment):

    SParker (View Comment):
    Unless you’re implementing the circuit in discrete transistors as our primitive ancestors did,

    Hey!

    Yeah hey!

    Hey Hey Hey!

    • #20
  21. Matt Balzer, Straw Bootlegger Member
    Matt Balzer, Straw Bootlegger
    @MattBalzer

    GLDIII (View Comment):

    Major Major Major Major (View Comment):

    SParker (View Comment):
    Unless you’re implementing the circuit in discrete transistors as our primitive ancestors did,

    Hey!

    Yeah hey!

    • #21
  22. RightAngles Member
    RightAngles
    @RightAngles

    Matt Balzer, Straw Bootlegger (View Comment):

    GLDIII (View Comment):

    Major Major Major Major (View Comment):

    SParker (View Comment):
    Unless you’re implementing the circuit in discrete transistors as our primitive ancestors did,

    Hey!

    Yeah hey!

    Hahaha Minnesooota

    • #22
  23. GLDIII Reagan
    GLDIII
    @GLDIII

    Gary McVey (View Comment):

    GLDIII (View Comment):

    Major Major Major Major (View Comment):

    SParker (View Comment):
    Unless you’re implementing the circuit in discrete transistors as our primitive ancestors did,

    Hey!

    Yeah hey!

    Hey Hey Hey!

    What little circuit work I did back in the late 70 was with “discrete transistors”, I got lost track so fast trying to follow the outputs when it we started in on the integrated circuits. My “analog thinking” mind just rebelled at the magic that came from a string of IC’s.

    Forget Heisenberg, the world we live in is analog, not digital.

    Go Newton!

    • #23
Become a member to join the conversation. Or sign in if you're already a member.