Building Circuits with Words: Difference between revisions

From Turing Complete
m (added last missing pictures)
mNo edit summary
Line 1: Line 1:
=== Introduction ===
=== Introduction ===
<p style="width:640px;line-height:1.3em">
This small guide is for players who are completely new to binary logic. It shows how the names of the  gates correspond to words in a sentence and how they can be used to create circuits by simply describing what you see in a truth table.
This small guide is for players who are completely new to binary logic. It shows how the names of the  gates correspond to words in a sentence and how they can be used to create circuits by simply describing what you see in a truth table.
</p>


<p style="width:640px;line-height:1.3em">
This concept might be perceived as obvious for people with background knowledge, but is still something that each of us had to learn at some point.
This concept might be perceived as obvious for people with background knowledge, but is still something that each of us had to learn at some point.
</p>


=== Step 1: Describe the green outputs ===
=== Step 1: Describe the green outputs ===
<p style="width:640px;line-height:1.3em">
Let's take a look at the XOR level and its truth table
Let's take a look at the XOR level and its truth table
</p>


[[File:XOR_Gate_TruthTable.png]]
[[File:XOR_Gate_TruthTable.png]]


<p style="width:640px;line-height:1.3em">
'''We want to describe each combination, that turns the desired output''' {{On}}
'''We want to describe each combination, that turns the desired output''' {{On}}
</p>


<p style="width:640px;line-height:1.3em">
What's the idea? If we make sure that our circuit outputs {{On}} in all relevant cases, then it automatically outputs {{Off}} in all other cases. So we only have to focus on the {{On}} and get the {{Off}}s for free.
What's the idea? If we make sure that our circuit outputs {{On}} in all relevant cases, then it automatically outputs {{Off}} in all other cases. So we only have to focus on the {{On}} and get the {{Off}}s for free.
</p>


<p style="width:640px;line-height:1.3em">
Start like this:
Start like this:
</p>


[[File:Guide_words_description1.png]]
[[File:Guide_words_description1.png]]


<p style="width:640px;line-height:1.3em">
There are 2 columns, that turn the desired output to {{On}}.
There are 2 columns, that turn the desired output to {{On}}.
</p>


<p style="width:640px;line-height:1.3em">
Let's start with the first and expand our descriptive sentence.
Let's start with the first and expand our descriptive sentence.
</p>


[[File:XOR_Gate_TruthTable_Column1.png]]
[[File:XOR_Gate_TruthTable_Column1.png]]
Line 25: Line 41:
[[File:Guide_words_description2.png]]
[[File:Guide_words_description2.png]]


<p style="width:640px;line-height:1.3em">
Nice! Okay that's the first column - now let's add the second.
Nice! Okay that's the first column - now let's add the second.
</p>


[[File:XOR_Gate_TruthTable_Column2.png]]
[[File:XOR_Gate_TruthTable_Column2.png]]
Line 31: Line 49:
[[File:Guide_words_description3.png]]
[[File:Guide_words_description3.png]]


<p style="width:640px;line-height:1.3em">
We now have a complete description when our circuit outputs {{On}}
We now have a complete description when our circuit outputs {{On}}
</p>


=== Step 2: Replace 'Red' with 'Not Green' ===
=== Step 2: Replace 'Red' with 'Not Green' ===
<p style="width:640px;line-height:1.3em">
We only focus on {{On}} signals, that's why we try to avoid using the {{Off}} symbol in our description.
We only focus on {{On}} signals, that's why we try to avoid using the {{Off}} symbol in our description.
</p>


<p style="width:640px;line-height:1.3em">
Here is the trick: When something is {{Off}}, we can also say it is '''<nowiki>'</nowiki>not {{On}}<nowiki>'</nowiki>'''.  
Here is the trick: When something is {{Off}}, we can also say it is '''<nowiki>'</nowiki>not {{On}}<nowiki>'</nowiki>'''.  
</p>


<p style="width:640px;line-height:1.3em">
So let's replace every {{Off}} symbol:
So let's replace every {{Off}} symbol:
</p>


[[File:Guide_words_description4.png]]
[[File:Guide_words_description4.png]]


=== Step 3: Highlight the gate names ===
=== Step 3: Highlight the gate names ===
<p style="width:640px;line-height:1.3em">
The connecting words in our sentence are also the name of gates!
The connecting words in our sentence are also the name of gates!
</p>


<p style="width:640px;line-height:1.3em">
Let's highlight all words, that are also names of gates and see what it looks like:
Let's highlight all words, that are also names of gates and see what it looks like:
</p>


[[File:Guide_words_description5.png]]
[[File:Guide_words_description5.png]]


<p style="width:640px;line-height:1.3em">
''Notice, that i also added some brackets, since AND is a stronger connection than OR.''
''Notice, that i also added some brackets, since AND is a stronger connection than OR.''
</p>


=== Step 4: Build the circuit ===
=== Step 4: Build the circuit ===
<p style="width:640px;line-height:1.3em">
Now we can build a circuit that exactly matches our description, using the same gates that we highlighted in our sentence:
Now we can build a circuit that exactly matches our description, using the same gates that we highlighted in our sentence:
</p>


[[File:XOR_Gate_Circuit1.png]]
[[File:XOR_Gate_Circuit1.png|650px]]


<p style="width:640px;line-height:1.3em">
This technique works for every truth table.
This technique works for every truth table.
</p>


----
----


<p style="width:640px;line-height:1.3em">
The structure of the resulting circuit is called ''Canonical Disjunctive Normal Form (CDNF)'' which can usually be optimized to require fewer gates (there are several techniques to achieve this).
The structure of the resulting circuit is called ''Canonical Disjunctive Normal Form (CDNF)'' which can usually be optimized to require fewer gates (there are several techniques to achieve this).
</p>


=== More phrases ===
=== More phrases ===
<p style="width:640px;line-height:1.3em">
By using phrases that contain only AND, OR, and NOT, you can build any circuit you want, by simply describing each combination for each {{On}} output. But there is more...
By using phrases that contain only AND, OR, and NOT, you can build any circuit you want, by simply describing each combination for each {{On}} output. But there is more...
</p>


<p style="width:640px;line-height:1.3em">
You can use the following phrases and translate them into gates:
You can use the following phrases and translate them into gates:
</p>


==== NOR gate ====
==== NOR gate ====
Line 73: Line 115:
==== XOR gate ====
==== XOR gate ====


<p style="width:640px;line-height:1.3em">
Phrases like ''"...different values"'' or ''"...not the same"'' translate into an '''XOR''' gate
Phrases like ''"...different values"'' or ''"...not the same"'' translate into an '''XOR''' gate
</p>


[[File:XOR_Gate_TruthTable_Description_Circuit.png]]
[[File:XOR_Gate_TruthTable_Description_Circuit.png]]
Line 79: Line 123:
==== XNOR gate ====
==== XNOR gate ====


<p style="width:640px;line-height:1.3em">
Phrases like ''"...equal values"'' or ''"...the same"'' translate into an '''XNOR''' gate
Phrases like ''"...equal values"'' or ''"...the same"'' translate into an '''XNOR''' gate
</p>


[[File:XNOR_Gate_TruthTable_Description_Circuit.png]]
[[File:XNOR_Gate_TruthTable_Description_Circuit.png]]
Line 85: Line 131:
==== Conditions ====
==== Conditions ====


<p style="width:640px;line-height:1.3em">
Phrases like ''"...under the condition that..."'' or ''"If...then"'' translate into an '''AND''' gate or a '''SWITCH'''
Phrases like ''"...under the condition that..."'' or ''"If...then"'' translate into an '''AND''' gate or a '''SWITCH'''
</p>


[[File:COND_Description_Circuit.png]]
[[File:COND_Description_Circuit.png]]

Revision as of 11:24, 31 October 2023

Introduction

This small guide is for players who are completely new to binary logic. It shows how the names of the  gates correspond to words in a sentence and how they can be used to create circuits by simply describing what you see in a truth table.

This concept might be perceived as obvious for people with background knowledge, but is still something that each of us had to learn at some point.

Step 1: Describe the green outputs

Let's take a look at the XOR level and its truth table

We want to describe each combination, that turns the desired output

What's the idea? If we make sure that our circuit outputs in all relevant cases, then it automatically outputs in all other cases. So we only have to focus on the and get the s for free.

Start like this:

There are 2 columns, that turn the desired output to .

Let's start with the first and expand our descriptive sentence.

Nice! Okay that's the first column - now let's add the second.

We now have a complete description when our circuit outputs

Step 2: Replace 'Red' with 'Not Green'

We only focus on signals, that's why we try to avoid using the symbol in our description.

Here is the trick: When something is , we can also say it is 'not '.

So let's replace every symbol:

Step 3: Highlight the gate names

The connecting words in our sentence are also the name of gates!

Let's highlight all words, that are also names of gates and see what it looks like:

Notice, that i also added some brackets, since AND is a stronger connection than OR.

Step 4: Build the circuit

Now we can build a circuit that exactly matches our description, using the same gates that we highlighted in our sentence:

This technique works for every truth table.


The structure of the resulting circuit is called Canonical Disjunctive Normal Form (CDNF) which can usually be optimized to require fewer gates (there are several techniques to achieve this).

More phrases

By using phrases that contain only AND, OR, and NOT, you can build any circuit you want, by simply describing each combination for each output. But there is more...

You can use the following phrases and translate them into gates:

NOR gate

XOR gate

Phrases like "...different values" or "...not the same" translate into an XOR gate

XNOR gate

Phrases like "...equal values" or "...the same" translate into an XNOR gate

Conditions

Phrases like "...under the condition that..." or "If...then" translate into an AND gate or a SWITCH