Building Circuits with Words: Difference between revisions

From Turing Complete
(Replaced On pictures with {{On}} template)
No edit summary
Line 9: Line 9:
[previewimg=31167771;sizeOriginal;xor.png][/previewimg]
[previewimg=31167771;sizeOriginal;xor.png][/previewimg]


[b]We want to describe each combination, that turns the desired output [/b]<nowiki>{{On}}</nowiki>
[b]We want to describe each combination, that turns the desired output [/b]{{On}}


What's the idea? If we make sure that our circuit outputs <nowiki>{{On}}</nowiki> in all relevant cases, then it automatically outputs [previewicon=31168262;sizeOriginal,inline;off.png][/previewicon] in all other cases. So we only have to focus on the <nowiki>{{On}}</nowiki> and get the [previewicon=31168262;sizeOriginal,inline;off.png][/previewicon]s for free.
What's the idea? If we make sure that our circuit outputs {{On}} in all relevant cases, then it automatically outputs [previewicon=31168262;sizeOriginal,inline;off.png][/previewicon] in all other cases. So we only have to focus on the {{On}} and get the [previewicon=31168262;sizeOriginal,inline;off.png][/previewicon]s for free.


Start like this:
Start like this:
Line 17: Line 17:
[previewimg=31168005;sizeOriginal;desc1.png][/previewimg]
[previewimg=31168005;sizeOriginal;desc1.png][/previewimg]


There are 2 columns, that turn the desired output to <nowiki>{{On}}</nowiki>.
There are 2 columns, that turn the desired output to {{On}}.


Let's start with the first and expand our descriptive sentence.
Let's start with the first and expand our descriptive sentence.
Line 31: Line 31:
[previewimg=31168205;sizeOriginal;desc3.png][/previewimg]
[previewimg=31168205;sizeOriginal;desc3.png][/previewimg]


We now have a complete description when our circuit outputs <nowiki>{{On}}</nowiki>
We now have a complete description when our circuit outputs {{On}}


== Step 2: Replace 'Red' with 'Not Green' ==
== Step 2: Replace 'Red' with 'Not Green' ==
We only focus on <nowiki>{{On}}</nowiki> signals, that's why we try to avoid using the [previewicon=31168262;sizeOriginal,inline;off.png][/previewicon] symbol in our description.
We only focus on {{On}} signals, that's why we try to avoid using the [previewicon=31168262;sizeOriginal,inline;off.png][/previewicon] symbol in our description.


Here is the trick: When something is [previewicon=31168262;sizeOriginal,inline;off.png][/previewicon], we can also say it is [b]'not <nowiki>{{On}}</nowiki>'[/b].  
Here is the trick: When something is [previewicon=31168262;sizeOriginal,inline;off.png][/previewicon], we can also say it is [b]'not {{On}}'[/b].  


So let's replace every [previewicon=31168262;sizeOriginal,inline;off.png][/previewicon] symbol:
So let's replace every [previewicon=31168262;sizeOriginal,inline;off.png][/previewicon] symbol:
Line 63: Line 63:


== More phrases ==
== 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 <nowiki>{{On}}</nowiki> 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...


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

Revision as of 13:03, 28 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

[previewimg=31167771;sizeOriginal;xor.png][/previewimg]

[b]We want to describe each combination, that turns the desired output [/b]

What's the idea? If we make sure that our circuit outputs in all relevant cases, then it automatically outputs [previewicon=31168262;sizeOriginal,inline;off.png][/previewicon] in all other cases. So we only have to focus on the and get the [previewicon=31168262;sizeOriginal,inline;off.png][/previewicon]s for free.

Start like this:

[previewimg=31168005;sizeOriginal;desc1.png][/previewimg]

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

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

[previewicon=31168099;sizeOriginal;xor1.png][/previewicon]

[previewimg=31168159;sizeOriginal;desc2.png][/previewimg]

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

[previewicon=31168184;sizeOriginal;xor2.png][/previewicon]

[previewimg=31168205;sizeOriginal;desc3.png][/previewimg]

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 [previewicon=31168262;sizeOriginal,inline;off.png][/previewicon] symbol in our description.

Here is the trick: When something is [previewicon=31168262;sizeOriginal,inline;off.png][/previewicon], we can also say it is [b]'not '[/b].

So let's replace every [previewicon=31168262;sizeOriginal,inline;off.png][/previewicon] symbol:

[previewimg=31168354;sizeOriginal;desc4.png][/previewimg]

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:

[previewimg=31168895;sizeOriginal;desc5.png][/previewimg]

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

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:

[previewimg=31169306;sizeOriginal;circuit.png][/previewimg]

This technique works for every truth table.

[hr][/hr]

The structure of the resulting circuit is called [i]Canonical Disjunctive Normal Form (CDNF)[/i] 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:

[h3]NOR gate[/h3]

[previewimg=31675797;sizeOriginal;NOR_circ.png][/previewimg]

[h3]XOR gate[/h3]

Phrases like [i]"...different values"[/i] or [i]"...not the same"[/i] translate into an [b]XOR[/b] gate

[previewimg=31675802;sizeOriginal;XOR_circ.png][/previewimg]

[h3]XNOR gate[/h3]

Phrases like [i]"...equal values"[/i] or [i]"...the same"[/i] translate into an [b]XNOR[/b] gate

[previewimg=31675808;sizeOriginal;XNOR_circ.png][/previewimg]

[h3]Conditions[/h3]

Phrases like [i]"...under the condition that..."[/i] or [i]"If...then"[/i] translate into an [b]AND[/b] gate or a [b]SWITCH[/b]

[previewimg=31675984;sizeOriginal;COND_circ.png][/previewimg]