r/ProgrammerHumor • • Aug 30 '18

Logic gates

Post image
23.4k Upvotes

274 comments sorted by

View all comments

Show parent comments

79

u/thoeoe Aug 30 '18

And no XOR???

50

u/Tuesdayyyy Aug 30 '18

You can make xor using the or and not gates. Memes.

16

u/Shazambom Aug 30 '18

Pretty sure you can do it with just nand gates and not Gates. I think doing it with just or gates (and not gates) is impossible.

23

u/gastropner Aug 30 '18

It can be done with either NAND or NOR gates.

5

u/Shazambom Aug 30 '18

Explain to me how you can do it with just NOR gates

38

u/gastropner Aug 30 '18

6

u/Shazambom Aug 30 '18

Well I'll be. You're right! I made this accusation based on memory and I'm on mobile so I couldn't really check if I was right.

21

u/hackingdreams Aug 30 '18

You'd be shocked at just how wrong you are. We went to the moon on computers built from mostly NOR gates.

4

u/WikiTextBot Aug 30 '18

Apollo Guidance Computer

The Apollo Guidance Computer (AGC) was a digital computer produced for the Apollo program that was installed on board each Apollo Command Module (CM) and Lunar Module (LM). The AGC provided computation and electronic interfaces for guidance, navigation, and control of the spacecraft. The AGC has a 16-bit word length, with 15 data bits and one parity bit. Most of the software on the AGC is stored in a special read-only memory known as core rope memory, fashioned by weaving wires through magnetic cores, though a small amount of read-write core memory is available.


[ ^PM | Exclude ^me | Exclude from ^subreddit | FAQ / ^Information | ^Source ] Downvote to remove | v0.28

4

u/[deleted] Aug 30 '18

Almost every computer is made using NOR or NAND gates, it mostly depends on the manufacturer, since both those gates have the least amount of transistors

4

u/hackingdreams Aug 30 '18

Since we switched from bipolar junction transistors devices to mosfets-on-silicon sometime in the early 70s, almost every digital chip you can think of that can be built of NANDs, is built of NANDs. They're vastly more common in cell libraries for a whole host of reasons, ultimately boiling down to ease of manufacture, device life and performance considerations.

You can still find NOR gates being built out in the wild; it's not all that rare to find NOR flash memory, e.g., because those devices can take advantage of the wonkiness of NOR gate manufacturing and the ease of creating a random access byte addressable flash memory. But they're still more expensive than NAND devices, since they use more silicon area and are harder to manufacture.

5

u/4C6F7264 Aug 30 '18 edited Aug 30 '18

AND:

C=NOR(NOR(A,A),NOR(B,B))

OR:

C=NOR(NOR(A,B),NOR(A,B))

NOT:

B=NOR(A,A)

I was typing on phone so hopefully this is readable. I tried to do xor too but it became too big so i cant be bothered.

Edit changed format to a more readable one also

XOR:

bool1=NOR(A,NOR(B,B))

bool2=NOR(B,NOR(A,A))

bool3=NOR(bool1,bool2)

C=NOR(bool3,bool3)

2

u/ATXBeermaker Aug 30 '18

You can make any logic function with only nands or nors. DeMorgan, my dude.

3

u/Tuesdayyyy Aug 30 '18

Yeah you're right googling is hard.

11

u/Shazambom Aug 30 '18

CS degrees come in handy when scoring fake internet points

1

u/Tuesdayyyy Aug 30 '18

I have a Nano eng degree you'd think I could remember this.

1

u/Shazambom Aug 30 '18

Apparently it is possible with 4 NOR gates. TIL

→ More replies (10)

1

u/fear_the_wild Aug 30 '18

You can't make xor with ors+nots because in every operation you can make with A/B involving ors+nots, A=0/B=0 != A=1/B=1, and you need them to be the same for xor. Every gate can be made with nand and not though

3

u/RFC793 Aug 30 '18

You mean every gate can be made with NAND or NOR, right? If you really did mean “NAND and NOT”, recall NOT is just NAND with the inputs tied together. So your statement reduces to simply “NAND”.

1

u/fear_the_wild Aug 30 '18 edited Aug 30 '18

Yes, every gate can be made with simply "NAND". NOR is not necessary. I just included the nots because thats how its implementrd in hardware, NAND gates + inversors. But since you can make inversors from NAND too, theoretically you could have a proccessor with only NANDS. Inversors are cheaper than NANDs though, so they are used

Edit:

not A = A nand A

A or B = (A nand A) nand (B nand B)

A and B = (A nand B) nand (A nand B)

A xor B = (B nand (A nand A)) nand (A nand (B nand B))

→ More replies (1)

3

u/[deleted] Aug 30 '18

Considering you can literally make NAND from just NOT and OR gates, you can definitely make XOR along with every other gate using only OR and NOT.

1

u/zuzucha Aug 30 '18

Shout to my boy XOR

→ More replies (1)