Construct circuit that implements truth table

Click For Summary

Discussion Overview

The discussion revolves around constructing a circuit that implements a specified truth table with two inputs (P and Q) and two outputs (K and A). Participants also explore how this circuit can be adapted to create a full adder for adding three 1-digit binary numbers. The conversation includes technical details about logic gates and circuit design.

Discussion Character

  • Technical explanation
  • Exploratory
  • Debate/contested

Main Points Raised

  • Some participants suggest that output K can be derived from an AND gate and output A from an XOR gate.
  • There is a proposal to create a circuit diagram using circles to represent logic gates and arrows for inputs and outputs.
  • Participants discuss the need for a truth table with three inputs (P, Q, R) for a full adder, raising questions about how to integrate the circuits.
  • Clarifications are made about how to visually represent the logic gates and their connections in a circuit diagram.
  • Some participants express uncertainty about how to connect inputs to the logic gates and whether the outputs should be combined in a single box.
  • There is a discussion about the significance of dots in circuit diagrams, indicating whether lines are connected or not.
  • Concerns are raised about potential short circuits if inputs are incorrectly connected.

Areas of Agreement / Disagreement

Participants generally agree on the basic functions of the logic gates but have differing views on the specifics of circuit construction and the integration of multiple circuits for the full adder. The discussion remains unresolved regarding the exact implementation details.

Contextual Notes

Participants express uncertainty about the correct representation of connections in circuit diagrams and the implications of connecting inputs directly. There are also unresolved questions about the overall design of the circuit for the full adder.

  • #31
We can add a third input R to the A we found, can't we?
And afterwards add both carries together? 🤔
 
Physics news on Phys.org
  • #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:
 
  • #36
evinda said:
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. 🤔

evinda said:
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
 
  • #37
Klaas van Aarsen said:
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:

Klaas van Aarsen said:
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)
 
  • #38
evinda said:
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$. 🤔

evinda said:
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?

evinda said:
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:
 
  • #39
Klaas van Aarsen said:
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


Klaas van Aarsen said:
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:
 
  • #40
evinda said:
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)

evinda said:
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)
 
  • #41
Klaas van Aarsen said:
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:
 
  • #42
evinda said:
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)
 
  • #43
Klaas van Aarsen said:
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:
 
  • #44
I have thought about it again... :unsure:

Is the desired circuit the following?

output.png
 
  • #45
evinda said:
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}
 
  • #46
Klaas van Aarsen said:
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)
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
1K
  • · Replies 18 ·
Replies
18
Views
4K
  • · Replies 17 ·
Replies
17
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
Replies
4
Views
2K
  • · Replies 3 ·
Replies
3
Views
1K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 9 ·
Replies
9
Views
3K
  • · Replies 16 ·
Replies
16
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K