Welcome to our community

Be a part of something great, join today!

Construct circuit that implements truth table

evinda

Well-known member
MHB Site Helper
Apr 13, 2013
3,718
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:
 

Klaas van Aarsen

MHB Seeker
Staff member
Mar 5, 2012
8,714
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:
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. 🤔
 

evinda

Well-known member
MHB Site Helper
Apr 13, 2013
3,718
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:o_O
 

Klaas van Aarsen

MHB Seeker
Staff member
Mar 5, 2012
8,714
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:

evinda

Well-known member
MHB Site Helper
Apr 13, 2013
3,718
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:
 

Klaas van Aarsen

MHB Seeker
Staff member
Mar 5, 2012
8,714
We can add a third input R to the A we found, can't we?
And afterwards add both carries together? 🤔
 

evinda

Well-known member
MHB Site Helper
Apr 13, 2013
3,718
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:
 

evinda

Well-known member
MHB Site Helper
Apr 13, 2013
3,718
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
 

Klaas van Aarsen

MHB Seeker
Staff member
Mar 5, 2012
8,714
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? 🤔
 

evinda

Well-known member
MHB Site Helper
Apr 13, 2013
3,718
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:


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)

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:
 

Klaas van Aarsen

MHB Seeker
Staff member
Mar 5, 2012
8,714
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?
How about something like this:
\begin{tikzpicture}
\draw (0,0) rectangle (8,6);
\draw (0,5) -- +(-1,0) node[ left ] {P};
\draw (0,3) -- +(-1,0) node[ left ] {Q};
\draw (0,1) -- +(-1,0) node[ left ] {R};
\draw (8,4) -- +(1,0) node[ right ] {K};
\draw (8,2) -- +(1,0) node[ right ] {A};
\draw (2,2) node {+} +(-0.5,+0.2) -- +(-1,+0.2) +(-0.5,-0.2) -- +(-1,-0.2) +(0.5,+0.2) -- +(1,+0.2) +(0.5,-0.2) -- +(1,-0.2) +(-0.5,-0.5) rectangle +(0.5,0.5);
\draw (3,3.5) node {+} +(-0.5,+0.2) -- +(-1,+0.2) +(-0.5,-0.2) -- +(-1,-0.2) +(0.5,+0.2) -- +(1,+0.2) +(0.5,-0.2) -- +(1,-0.2) +(-0.5,-0.5) rectangle +(0.5,0.5);
\draw (6,1) node {+} +(-0.5,+0.2) -- +(-1,+0.2) +(-0.5,-0.2) -- +(-1,-0.2) +(0.5,+0.2) -- +(1,+0.2) +(0.5,-0.2) -- +(1,-0.2) +(-0.5,-0.5) rectangle +(0.5,0.5);
\draw (5,5) node {+} +(-0.5,+0.2) -- +(-1,+0.2) +(-0.5,-0.2) -- +(-1,-0.2) +(0.5,+0.2) -- +(1,+0.2) +(0.5,-0.2) -- +(1,-0.2) +(-0.5,-0.5) rectangle +(0.5,0.5);
\end{tikzpicture}
That leaves how to connect the lines so that all possible sums are summed correctly. 🤔

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?
What do you mean? o_O
 

evinda

Well-known member
MHB Site Helper
Apr 13, 2013
3,718
How about something like this:
\begin{tikzpicture}
\draw (0,0) rectangle (8,6);
\draw (0,5) -- +(-1,0) node[ left ] {P};
\draw (0,3) -- +(-1,0) node[ left ] {Q};
\draw (0,1) -- +(-1,0) node[ left ] {R};
\draw (8,4) -- +(1,0) node[ right ] {K};
\draw (8,2) -- +(1,0) node[ right ] {A};
\draw (2,2) node {+} +(-0.5,+0.2) -- +(-1,+0.2) +(-0.5,-0.2) -- +(-1,-0.2) +(0.5,+0.2) -- +(1,+0.2) +(0.5,-0.2) -- +(1,-0.2) +(-0.5,-0.5) rectangle +(0.5,0.5);
\draw (3,3.5) node {+} +(-0.5,+0.2) -- +(-1,+0.2) +(-0.5,-0.2) -- +(-1,-0.2) +(0.5,+0.2) -- +(1,+0.2) +(0.5,-0.2) -- +(1,-0.2) +(-0.5,-0.5) rectangle +(0.5,0.5);
\draw (6,1) node {+} +(-0.5,+0.2) -- +(-1,+0.2) +(-0.5,-0.2) -- +(-1,-0.2) +(0.5,+0.2) -- +(1,+0.2) +(0.5,-0.2) -- +(1,-0.2) +(-0.5,-0.5) rectangle +(0.5,0.5);
\draw (5,5) node {+} +(-0.5,+0.2) -- +(-1,+0.2) +(-0.5,-0.2) -- +(-1,-0.2) +(0.5,+0.2) -- +(1,+0.2) +(0.5,-0.2) -- +(1,-0.2) +(-0.5,-0.5) rectangle +(0.5,0.5);
\end{tikzpicture}
That leaves how to connect the lines so that all possible sums are summed correctly. 🤔
You mean that we conctruct for example a circuit that contains each logic gate of the above circuit twice? :unsure: :unsure:

What do you mean? o_O
I meant that these are the possible operations that we could have, given that we take into consideration the sum of three one-digit binary numbers... Or am I wrong? (Thinking)(Thinking)
 

Klaas van Aarsen

MHB Seeker
Staff member
Mar 5, 2012
8,714
You mean that we conctruct for example a circuit that contains each logic gate of the above circuit twice?
I meant that we have a 'global' $K$ and $A$ as output, and we have to figure out how to get them.
We might also call them $K_{\text{3 digit sum}}$ and $A_{\text{3 digit sum}}$ to make it more explicit.
Actually, let's make them $K_3$ and $A_3$ for short. 🤔

I've simplified the circuit we are supposed to use as a building block by representing it as a square with a $\boxed{+}$ sign in it.
The $\boxed{+}$ represents the combination of the AND gate and the XOR gate. 🤔

I think we can also assume that we will start with adding $P$ and $Q$ together, can't we?
If we do, then perhaps we can call its intermediate outputs $K_1$ and $A_1$. 🤔

I meant that these are the possible operations that we could have, given that we take into consideration the sum of three one-digit binary numbers... Or am I wrong?
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?
Did you mean "any possible order of $0,1$ at the first sum"?
That is, we treat (1+0)+R the same as (0+1)+R? :unsure:

If so, isn't $(1+0)+1$ missing then? :unsure:
 

evinda

Well-known member
MHB Site Helper
Apr 13, 2013
3,718
I meant that we have a 'global' $K$ and $A$ as output, and we have to figure out how to get them.
We might also call them $K_{\text{3 digit sum}}$ and $A_{\text{3 digit sum}}$ to make it more explicit.
Actually, let's make them $K_3$ and $A_3$ for short. 🤔

I've simplified the circuit we are supposed to use as a building block by representing it as a square with a $\boxed{+}$ sign in it.
The $\boxed{+}$ represents the combination of the AND gate and the XOR gate. 🤔

I think we can also assume that we will start with adding $P$ and $Q$ together, can't we?
If we do, then perhaps we can call its intermediate outputs $K_1$ and $A_1$. 🤔
So is the desired circuit the following? :unsure: Then the sum P+Q+R is $A_4$.

A_4.png

Did you mean "any possible order of $0,1$ at the first sum"?
That is, we treat (1+0)+R the same as (0+1)+R?

If so, isn't $(1+0)+1$ missing then? :unsure:
So at the first step the possible sums are 0+0, 0+1 and 1+0, 1+1 and then at the second step the possible sums are the results of these + 0 or 1, right? :unsure:
 

Klaas van Aarsen

MHB Seeker
Staff member
Mar 5, 2012
8,714
So is the desired circuit the following? Then the sum P+Q+R is $A_4$.
What about the carry?
Shouldn't we have $K_4$ as output then as well? 🤔

Suppose $+Q+R=0+1+1=10$. Then we get $A_4=1$ don't we? (Worried)

So at the first step the possible sums are 0+0, 0+1 and 1+0, 1+1 and then at the second step the possible sums are the results of these + 0 or 1, right?
Yep. (Nod)
 

evinda

Well-known member
MHB Site Helper
Apr 13, 2013
3,718
What about the carry?
Shouldn't we have $K_4$ as output then as well? 🤔

Suppose $+Q+R=0+1+1=10$. Then we get $A_4=1$ don't we? (Worried)
Oh yes, right... :unsure::unsure: So do we have to add an other circuit in order to include $K_4$? :oops:
 

Klaas van Aarsen

MHB Seeker
Staff member
Mar 5, 2012
8,714
Oh yes, right... So do we have to add an other circuit in order to include $K_4$?
We already have $K_4$ don't we?

But I think the circuit is not correct yet.
If we have $P+Q+R=0+1+1$ we should get $10$ shouldn't we? That is, $K_4=1$ and $A_4=0$.
But don't we get $K_4=0$ and $A_4=1$? (Worried)
 

evinda

Well-known member
MHB Site Helper
Apr 13, 2013
3,718
We already have $K_4$ don't we?

But I think the circuit is not correct yet.
If we have $P+Q+R=0+1+1$ we should get $10$ shouldn't we? That is, $K_4=1$ and $A_4=0$.
But don't we get $K_4=0$ and $A_4=1$? (Worried)
Oh yes, you are right!! (Wasntme) I have noticed that the second circuit gives the right result...
Does this happen for any possible case? So is $A_2$ with carry $K_2$the desired sum? :unsure::unsure:
 

evinda

Well-known member
MHB Site Helper
Apr 13, 2013
3,718
I have thought about it again..... :unsure:

Is the desired circuit the following?

output.png
 

Klaas van Aarsen

MHB Seeker
Staff member
Mar 5, 2012
8,714
I have thought about it again.....

Is the desired circuit the following?
Looks good to me! (Nod)

Just for fun, I made a drawing as well. (Blush)

\begin{tikzpicture}
\usetikzlibrary{shapes.gates.logic.US}
\tikzset{
add/.pic = {
\draw[thick] (-0.8,-0.8) rectangle (0.8,0.8);
\node[and gate US,draw] at (0,0.35) (And1) {};
\node[xor gate US,draw] at (0,-0.35) (Xor1) {};
\path
(And1.input 1)+(-1,0) coordinate (-in 1)
(Xor1.input 2)+(-1,0) coordinate (-in 2)
(And1.output)+(1,0) coordinate (-K)
(Xor1.output)+(1,0) coordinate (-A);

\draw (-in 1) -- (And1.input 1) +(-0.35,0) |- (Xor1.input 1);
\draw (-in 2) -- (Xor1.input 2) +(-0.2,0) |- (And1.input 2);
\draw (And1.output) -- (-K);
\draw (Xor1.output) -- (-A);
}
}

\node[draw,minimum width=10cm,minimum height=5cm] (Block) {};

\draw (-3.5,1) pic (Add1) {add};
\draw (-0.5,-1) pic (Add2) {add};
\draw (2.5,0.5) pic (Add3) {add};

\path
(Add1-in 1 -| Block.west)+(-1,0) coordinate[label=left: P] (P)
(Add2-in 2 -| Block.west)+(-1,0) coordinate[label=left:R] (R)
(Add2-A -| Block.east)+(1,0) coordinate[label=right:A] (A)
(Add3-A -| Block.east)+(1,0) coordinate[label=right:K] (K)
(P) -- node[shape=coordinate,label=left:Q] (Q) {} (R)
;

\draw (P) -| (Add1-in 1);
\draw (Q) -| (Add1-in 2);
\draw (R) -| (Add2-in 2);
\draw (Add1-A) -| (Add2-in 1);
\draw (Add1-K) -| (Add3-in 1);
\draw (Add2-A) -| (A);
\draw (Add2-K) -| (Add3-in 2);
\draw (Add3-A) -| (K);

\node[above] at (Add1-A) {$A_1$};
\node[above] at (Add1-K) {$K_1$};
\node[above] at (Add2-A) {$A_2$};
\node[above] at (Add2-K) {$K_2$};
\node[above] at (Add3-A) {$A_3$};
\node[above] at (Add3-K) {$K_3$};

\end{tikzpicture}
 

evinda

Well-known member
MHB Site Helper
Apr 13, 2013
3,718
Looks good to me! (Nod)

Just for fun, I made a drawing as well. (Blush)

\begin{tikzpicture}
\usetikzlibrary{shapes.gates.logic.US}
\tikzset{
add/.pic = {
\draw[thick] (-0.8,-0.8) rectangle (0.8,0.8);
\node[and gate US,draw] at (0,0.35) (And1) {};
\node[xor gate US,draw] at (0,-0.35) (Xor1) {};
\path
(And1.input 1)+(-1,0) coordinate (-in 1)
(Xor1.input 2)+(-1,0) coordinate (-in 2)
(And1.output)+(1,0) coordinate (-K)
(Xor1.output)+(1,0) coordinate (-A);

\draw (-in 1) -- (And1.input 1) +(-0.35,0) |- (Xor1.input 1);
\draw (-in 2) -- (Xor1.input 2) +(-0.2,0) |- (And1.input 2);
\draw (And1.output) -- (-K);
\draw (Xor1.output) -- (-A);
}
}

\node[draw,minimum width=10cm,minimum height=5cm] (Block) {};

\draw (-3.5,1) pic (Add1) {add};
\draw (-0.5,-1) pic (Add2) {add};
\draw (2.5,0.5) pic (Add3) {add};

\path
(Add1-in 1 -| Block.west)+(-1,0) coordinate[label=left: P] (P)
(Add2-in 2 -| Block.west)+(-1,0) coordinate[label=left:R] (R)
(Add2-A -| Block.east)+(1,0) coordinate[label=right:A] (A)
(Add3-A -| Block.east)+(1,0) coordinate[label=right:K] (K)
(P) -- node[shape=coordinate,label=left:Q] (Q) {} (R)
;

\draw (P) -| (Add1-in 1);
\draw (Q) -| (Add1-in 2);
\draw (R) -| (Add2-in 2);
\draw (Add1-A) -| (Add2-in 1);
\draw (Add1-K) -| (Add3-in 1);
\draw (Add2-A) -| (A);
\draw (Add2-K) -| (Add3-in 2);
\draw (Add3-A) -| (K);

\node[above] at (Add1-A) {$A_1$};
\node[above] at (Add1-K) {$K_1$};
\node[above] at (Add2-A) {$A_2$};
\node[above] at (Add2-K) {$K_2$};
\node[above] at (Add3-A) {$A_3$};
\node[above] at (Add3-K) {$K_3$};

\end{tikzpicture}
Nice, thanks a lot!!! (Party)