Construct circuit that implements truth table

In summary: I just cant seem to get it right. :(It's not that hard, actually. Just follow these steps: 1. Draw a circle for each input.2. Draw a line from the circle to the input port.3. Draw another line from the output port to the circle.4. Draw an arrow from the input port to the circle.5. Draw an arrow from the output port to the output port.That's it. :)It's not that hard, actually. Just follow these steps: 1. Draw a circle for each input.2. Draw a line from the circle to the input port.3. Draw another line from the output port to the
  • #1
evinda
Gold Member
MHB
3,836
0
Hello! (Wave)

I want to construct a circuit that implements the following truth table:\begin{equation*}
\begin{array}{c|c|c|c|c}
P(Input) & Q(Input) & K(Output) & A(Output) \\
\hline
1 & 1 & 1 & 0 \\
1 & 0 & 0 & 1 \\
0 & 1 & 0 & 1 \\
0 & 0 & 0 & 0
\end{array}
\end{equation*}In addition, I want to use the above circuit to construct a full adder, i.e. a circuit that adds three 1-digit binary numbers.Could you help me to construct the wanted circuit that implements the truth table? :unsure:
 
Physics news on Phys.org
  • #2
Hey evinda!

Isn't output K the result of an AND port?
And output A the result of a XOR port?
Can we construct a circuit from those? 🤔

To add three 1-digit binary numbers, we need a truth table with inputs P, Q, R, and outputs K, A, don't we? 🤔
 
  • #3
Klaas van Aarsen said:
Hey evinda!

Isn't output K the result of an AND port?
And output A the result of a XOR port?
Can we construct a circuit from those? 🤔

The XOR port gives $1$ when the input of true inputs is odd and $0$ otherwise, right? (Wasntme)

Can you help me construct the desired circuit? Do we create circles that represent the AND and XOR port and create arrows representing each possible input and ending at the output of the port? Or do we do something else? :unsure::unsure:
 
  • #4
evinda said:
The XOR port gives $1$ when the input of true inputs is odd and $0$ otherwise, right?

Yep. (Nod)

evinda said:
Can you help me construct the desired circuit? Do we create circles that represent the AND and XOR port and create arrows representing each possible input and ending at the output of the port? Or do we do something else?

The are usually drawn as shown in the wiki article about Logic Gates. 🤔
 
  • #5
Klaas van Aarsen said:
The are usually drawn as shown in the wiki article about Logic Gates. 🤔

So you mean we construct the circuits as follows?

circuits.PNG
If so, does this mean that the we distinguish the circuits, i.e. what they represent, by taking into consideration the form ? :unsure::unsure::unsure:
 
  • #6
evinda said:
So you mean we construct the circuits as follows?

Yep. :)

evinda said:
If so, does this mean that the we distinguish the circuits, i.e. what they represent, by taking into consideration the form ?

What do you mean? o_O
Distinguish which circuits?
Consider which form?
 
  • #7
Klaas van Aarsen said:
What do you mean? o_O
Distinguish which circuits?
Consider which form?

I meant the boxes that take the input. Do we look at the form of the boxes to see which logical operation we have? :unsure: For example, at the above circuits the only difference is the sumbol of the output and the form of the box... Isn't it? :unsure::unsure:
 
  • #8
evinda said:
I meant the boxes that take the input. Do we look at the form of the boxes to see which logical operation we have? For example, at the above circuits the only difference is the sumbol of the output and the form of the box... Isn't it?
Yes, the shapes of the boxes identify the operations.
And the letters identify the inputs and the outputs. (Nod)
 
  • #9
Klaas van Aarsen said:
To add three 1-digit binary numbers, we need a truth table with inputs P, Q, R, and outputs K, A, don't we? 🤔

We need to get the outputs K,A in order to use thae above circuit? :unsure:

Also do we put the two circuits into one box so that it is joined-up? (Thinking)
 
  • #10
evinda said:
We need to get the outputs K,A in order to use thae above circuit?

Also do we put the two circuits into one box so that it is joined-up?
Yes, put the two logic gates into 1 box, which will have inputs P and Q, and outputs K and A.
Afterwards I guess we'll have to reuse that box multiple times to achieve adding 3 binary bits. 🤔
 
  • #11
Klaas van Aarsen said:
Yes, put the two logic gates into 1 box, which will have inputs P and Q, and outputs K and A.

So we just draw a box including the both circuits above? Then the circuits would be independent one an other... Or do we connect them somehow? :unsure:
 
  • #12
evinda said:
So we just draw a box including the both circuits above? Then the circuits would be independent one an other... Or do we connect them somehow?
The surrounding box should have only 2 inputs.
Inside the box those inputs should be split and go to both of the logic gates. 🤔
 
  • #13
Klaas van Aarsen said:
The surrounding box should have only 2 inputs.
Inside the box those inputs should be split and go to both of the logic gates. 🤔

You mean that the circuit has the following form? :unsure:

circ.PNG


Or do I have to change something? :unsure::unsure:
 
  • #14
P and Q should not be connected to each other should they? (Worried)

Instead each of them should go separately to each logic gate. 🤔
 
  • #15
Klaas van Aarsen said:
P and Q should not be connected to each other should they? (Worried)

Instead each of them should go separately to each logic gate. 🤔

I have tried several times to draw such a circuit, but can it happen that the arrows of P and Q do not meet? :unsure: :unsure:
 
  • #16
How about:
[TIKZ]
\usetikzlibrary{shapes.gates.logic.US}
\tikzstyle{branch}=[fill,shape=circle,minimum size=3pt,inner sep=0pt]

\node (P) at (-1,2) {P};
\node (Q) at (-1,1) {Q};
\coordinate (Pbranch) at (0.5,2) {};
\coordinate (Qbranch) at (1,1) {};

\node[and gate US, draw, logic gate inputs=nn] at (2,2) (And1) {};
\node[xor gate US, draw, logic gate inputs=nn] at (2,1) (Xor1) {};

\draw (P) -- (Pbranch) node[branch] {};
\draw (Q) -- (Qbranch) node[branch] {};
\draw (Pbranch) |- (And1.input 1);
\draw (Pbranch) |- (Xor1.input 1);
\draw (Qbranch) |- (And1.input 2);
\draw (Qbranch) |- (Xor1.input 2);
\draw (And1.output) -- +(2,0) node[ right ] { K };
\draw (Xor1.output) -- +(2,0) node[ right ] { A };

\draw[thick] (0,0) rectangle (3,3);
[/TIKZ]
🤔
 
  • #17
Klaas van Aarsen said:
How about:
[TIKZ]
\usetikzlibrary{shapes.gates.logic.US}
\tikzstyle{branch}=[fill,shape=circle,minimum size=3pt,inner sep=0pt]

\node (P) at (-1,2) {P};
\node (Q) at (-1,1) {Q};
\coordinate (Pbranch) at (0.5,2) {};
\coordinate (Qbranch) at (1,1) {};

\node[and gate US, draw, logic gate inputs=nn] at (2,2) (And1) {};
\node[xor gate US, draw, logic gate inputs=nn] at (2,1) (Xor1) {};

\draw (P) -- (Pbranch) node[branch] {};
\draw (Q) -- (Qbranch) node[branch] {};
\draw (Pbranch) |- (And1.input 1);
\draw (Pbranch) |- (Xor1.input 1);
\draw (Qbranch) |- (And1.input 2);
\draw (Qbranch) |- (Xor1.input 2);
\draw (And1.output) -- +(2,0) node[ right ] { K };
\draw (Xor1.output) -- +(2,0) node[ right ] { A };

\draw[thick] (0,0) rectangle (3,3);
[/TIKZ]
🤔

Seems reasonable... (Thinking) What do the dots represent? :unsure::unsure:
 
  • #18
evinda said:
Seems reasonable... What do the dots represent?
A dot shows that the lines are connected. It's like they are soldered together.
Without a dot the lines cross without connection. 🧐
 
  • #19
Klaas van Aarsen said:
A dot shows that the lines are connected. It's like they are soldered together.
Without a dot the lines cross without connection. 🧐

What would it be if the dots would be missing at the specific case? So that I understand it better... :unsure:
 
  • #20
evinda said:
What would it be if the dots would be missing at the specific case? So that I understand it better...
The same thing since in this particular case since the lines are not crossing where the dots are.
So they are connected anyway. In this case we could leave out the 2 dots. They merely clarify that the line crossings are not connected. 🧐
 
Last edited:
  • #21
Klaas van Aarsen said:
The same thing since in this particular case since the lines are not crossing where the dots are.
So they are connected anyway. In this case we could leave out the 2 dots. They merely clarify that the line crossings are not connected. 🧐
And what would happen if we would place dots at the point where the arrows of P and Q intersect? o_O I am confused right now... :(
 
  • #22
evinda said:
And what would happen if we would place dots at the point where the arrows of P and Q intersect? I am confused right now...
Then those lines would be connected and current can flow directly between the inputs P and Q.
It means we have a short circuit and if there are any fuses around they will blow up.
Or otherwise a fire will be started.
It is bad. 🧨 🎆🔥(Bandit)👩‍🚒🧯
 
  • #23
Klaas van Aarsen said:
Then those lines would be connected and current can flow directly between the inputs P and Q.
It means we have a short circuit and if there are any fuses around they will blow up.
Or otherwise a fire will be started.
It is bad. 🧨 🎆🔥(Bandit)👩‍🚒🧯

So in this case we just draw them in order to emphasize the different directions that the inputs go, they do not represent anything about the intersection of the different inputs, right? (Thinking)

Also, according to what you said , in any circuit of the logical expressions, we don't have dots at the intersection points. Or am I wrong? :unsure::unsure:
 
  • #24
evinda said:
So in this case we just draw them in order to emphasize the different directions that the inputs go.

Yes... :unsure:

evinda said:
They do not represent anything about the intersection of the different inputs, right?

Different inputs should never intersect. It would mean we have a short circuit. (Worried)

evinda said:
Also, according to what you said , in any circuit of the logical expressions, we don't have dots at the intersection points. Or am I wrong?

We can have dots... I guess it may be a matter of preference...
The important thing is that there is no ambiguity... 🧐

Here's a different way to eliminate any ambiguity.
\begin{tikzpicture}
\usetikzlibrary{shapes.gates.logic.US}

\node[ and gate US, draw, logic gate inputs=nn ] at (2,2) (And1) {};
\node[ xor gate US, draw, logic gate inputs=nn ] at (2,1) (Xor1) {};

\draw (And1.input 1) -- +(-2.5,0) node[ left ] {P} +(-1.5,0) |- (Xor1.input 1);
\draw (Xor1.input 2) -- +(-2.5,0) node[ left ] {Q} +(-1,0) -- +(-1,0.09) arc (-90:90:0.08) |- (And1.input 2);;
\draw (And1.output) -- +(2,0) node[ right ] {K};
\draw (Xor1.output) -- +(2,0) node[ right ] {A};

\draw[ thick ] (0,0) rectangle (3,3);
\end{tikzpicture}
There are no dots, but now there is a hoop in one of the connections to show that the lines are not connected. 🤔
 
  • #25
Klaas van Aarsen said:
Yes... :unsure:
Different inputs should never intersect. It would mean we have a short circuit. (Worried)
We can have dots... I guess it may be a matter of preference...
The important thing is that there is no ambiguity... 🧐

Here's a different way to eliminate any ambiguity.
\begin{tikzpicture}
\usetikzlibrary{shapes.gates.logic.US}

\node[ and gate US, draw, logic gate inputs=nn ] at (2,2) (And1) {};
\node[ xor gate US, draw, logic gate inputs=nn ] at (2,1) (Xor1) {};

\draw (And1.input 1) -- +(-2.5,0) node[ left ] {P} +(-1.5,0) |- (Xor1.input 1);
\draw (Xor1.input 2) -- +(-2.5,0) node[ left ] {Q} +(-1,0) -- +(-1,0.09) arc (-90:90:0.08) |- (And1.input 2);;
\draw (And1.output) -- +(2,0) node[ right ] {K};
\draw (Xor1.output) -- +(2,0) node[ right ] {A};

\draw[ thick ] (0,0) rectangle (3,3);
\end{tikzpicture}
There are no dots, but now there is a hoop in one of the connections to show that the lines are not connected. 🤔

I see... (Wasntme)
 
  • #26
Klaas van Aarsen said:
Afterwards I guess we'll have to reuse that box multiple times to achieve adding 3 binary bits. 🤔
So we make the truth table for the sum of two inputs and then we find the truth value for the sum of the result that we find with a third input?

Or do we calculate directly the truth table of the sum of three inputs? :unsure:
 
  • #27
evinda said:
So we make the truth table for the sum of two inputs and then we find the truth value for the sum of the result that we find with a third input?

Or do we calculate directly the truth table of the sum of three inputs?
We could do either, but your problem statement says:
evinda said:
In addition, I want to use the above circuit to construct a full adder, i.e. a circuit that adds three 1-digit binary numbers.
So I believe we need to build a circuit from blocks that sum two inputs. 🤔
 
  • #28
Klaas van Aarsen said:
We could do either, but your problem statement says:

So I believe we need to build a circuit from blocks that sum two inputs. 🤔
If we want to add two 1-digit binary numbers, we could give them as input at the circuit we created and the sum will be the value of K, won't it?

And then we could use the K above as the one input and the remaining 1-digit binary number and the new K that we will get will be the result of the sum of the three 1-digit binary numbers, right? :unsure:

But is this that what we want ? Because the exercise asks to construct a circuit that adds three 1-digit binary numbers... And the way I said it we implement twice a circuit, i.e. it is not a joined-up circuit and so there is no continuity... :unsure:eek:_O
 
  • #29
evinda said:
If we want to add two 1-digit binary numbers, we could give them as input at the circuit we created and the sum will be the value of K, won't it?

And then we could use the K above as the one input and the remaining 1-digit binary number and the new K that we will get will be the result of the sum of the three 1-digit binary numbers, right?

But is this that what we want ? Because the exercise asks to construct a circuit that adds three 1-digit binary numbers... And the way I said it we implement twice a circuit, i.e. it is not a joined-up circuit and so there is no continuity...
Isn't A what we get if we add P and Q together?
Except if P and Q are both 1, in which case we get the 2-digit number 10 that is represented by K and A together? 🤔
K is then the so called carry.
 
Last edited:
  • #30
Klaas van Aarsen said:
Isn't A what we get if we add P and Q together?
Except if P and Q are both 1, in which case we get athe 2-digit number 10 that is represented by K and A together? 🤔
K is then the so called carry.

Ah I see! (Blush) So with this circuit we can find the sum of two 1-digit binary numbers, right? :unsure: What can we do to add also an other 1-digit binary number ?
Do we just implement again the operations of the circuit? Because the digits of A appear also at P... Or do we do it somehow else? :unsure::unsure:
 
  • #31
We can add a third input R to the A we found, can't we?
And afterwards add both carries together? 🤔
 
  • #32
Klaas van Aarsen said:
We can add a third input R to the A we found, can't we?
And afterwards add both carries together? 🤔

You mean that we pick the outputs of the circuit as inputs at an other circuit? Or do we add the third input R at the existing circuit? :unsure:
 
  • #33
So is it somehow as below? If so, what do we do with the carries? Why do we add them? And also, if we use the sum, don't they have to be connected somehow at the circuits? :unsure: :unsure:

circuit-2.png
 
  • #34
evinda said:
So is it somehow as below?

If so, what do we do with the carries? Why do we add them? And also, if we use the sum, don't they have to be connected somehow at the circuits?

Shouldn't the block in the left top be the same as the one at the right bottom? (Worried)
I'll assume that it is, since otherwise it won't work.

Suppose we calculate $P+Q+R=1+1+0=10$.
Then we would get the outputs $K=1$, $K_2=0$, and $A_2=0$, wouldn't we?
How are those supposed to represent the result? o_O
Shouldn't we have just 2 outputs? 🤔
 
  • #35
Klaas van Aarsen said:
Shouldn't the block in the left top be the same as the one at the right bottom? (Worried)
I'll assume that it is, since otherwise it won't work.

Oh yes, sorry! That's what I wanted to draw :oops:
Klaas van Aarsen said:
Suppose we calculate $P+Q+R=1+1+0=10$.
Then we would get the outputs $K=1$, $K_2=0$, and $A_2=0$, wouldn't we?

Yes (Nod)

Klaas van Aarsen said:
How are those supposed to represent the result? o_O
Shouldn't we have just 2 outputs? 🤔

We do not get the result because the carries are not added, right?

Should we have in general only two outputs? So do we connect the arrows of the first circuit directly with the second circuit? Also do we have to connect in the second circuit the results $K_1$ and $K_2$ in order to get the right carry as output?

In general, the only possible results are $1+0+0=1$, $1+1+0=0$ with carry $1$ and $1+1+1=1$ with carry $1$ and we can get it with any possible order of $0,1$ at the sum, right? :unsure::unsure:
 

Similar threads

  • Set Theory, Logic, Probability, Statistics
Replies
2
Views
933
  • Set Theory, Logic, Probability, Statistics
Replies
18
Views
3K
  • Set Theory, Logic, Probability, Statistics
Replies
3
Views
804
  • Set Theory, Logic, Probability, Statistics
Replies
17
Views
1K
  • Set Theory, Logic, Probability, Statistics
Replies
2
Views
1K
  • Set Theory, Logic, Probability, Statistics
Replies
16
Views
1K
  • Set Theory, Logic, Probability, Statistics
Replies
4
Views
804
Replies
3
Views
951
Replies
5
Views
2K
  • Set Theory, Logic, Probability, Statistics
Replies
9
Views
2K
Back
Top