Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Post History

71%
+3 −0
Q&A 2 bit subtractor using full subtractor

We don't just give direct answers to homework (or homework-like) questions here, but can help you work thru the problem on your own. You might consider trying to synthesize a subtractor from scrat...

posted 2y ago by Olin Lathrop‭  ·  edited 2y ago by Olin Lathrop‭

Answer
#4: Post edited by user avatar Olin Lathrop‭ · 2021-08-07T14:46:04Z (over 2 years ago)
  • We don't just give direct answers to homework (or homework-like) questions here, but can help you work thru the problem on your own.
  • You might consider trying to synthesize a subtractor from scratch, just like you would an adder. The fundamental building block of an adder is the half-adder. It takes in two bits to add, and produces the sum and carry bits. Since there are only 4 possible combinations of inputs, a truth table nicely describes its operation exhaustively:
  • <pre>
  • In1 In2 Sum Car
  • --- --- --- ---
  • 0 0 0 0
  • 0 1 1 0
  • 1 0 1 0
  • 1 1 0 1
  • </pre>
  • That should be enough to create a circuit of basic logic gates to implement the half-adder. You then chain together two of these per bit to make the full adder. This process is well documented in many place out there, very likely in your textbook too.
  • Now consider doing the same thing for subtraction. You have two input bits, and two output bits. In this case the output bits are the difference and the borrow.
  • When you get done with this, it might be instructive to compare that result to constructing a subtractor by complementing one of the input numbers, adding it to the other input number, and adding 1 to the result. Note that adding 1 to the result is the same as if the carry input to the first bit were 1.
  • <hr>
  • <blockquote>I know how to make a full subtractor i just dont know how to connect multiple of them in order to make subtraction of 2 binary numbers with more than 1 bit</blockquote>
  • That makes little sense. If you really had a full subtractor, then you'd know what the input and output signals were, and then it would be obvious how to chain them to subtract wide numbers.
  • A full subtractor has three inputs and two outputs. The inputs are the two data bits to subtract, and the borrow input. The outputs are the resulting difference bit and the borrow output. You really should be able to figure out how to chain such blocks to subtract multi-bit numbers.
  • We don't just give direct answers to homework (or homework-like) questions here, but can help you work thru the problem on your own.
  • You might consider trying to synthesize a subtractor from scratch, just like you would an adder. The fundamental building block of an adder is the half-adder. It takes in two bits to add, and produces the sum and carry bits. Since there are only 4 possible combinations of inputs, a truth table nicely describes its operation exhaustively:
  • <pre>
  • In1 In2 Sum Car
  • --- --- --- ---
  • 0 0 0 0
  • 0 1 1 0
  • 1 0 1 0
  • 1 1 0 1
  • </pre>
  • That should be enough to create a circuit of basic logic gates to implement the half-adder. You then chain together two of these per bit to make the full adder. This process is well documented in many place out there, very likely in your textbook too.
  • Now consider doing the same thing for subtraction. You have two input bits, and two output bits. In this case the output bits are the difference and the borrow.
  • When you get done with this, it might be instructive to compare that result to constructing a subtractor by complementing one of the input numbers, adding it to the other input number, and adding 1 to the result. Note that adding 1 to the result is the same as if the carry input to the first bit were 1.
  • <hr>
  • <blockquote>I know how to make a full subtractor i just dont know how to connect multiple of them in order to make subtraction of 2 binary numbers with more than 1 bit</blockquote>
  • That makes little sense. If you really had a full subtractor, then you'd know what the input and output signals were, and then it would be obvious how to chain them to subtract wide numbers.
  • A full subtractor has three inputs and two outputs. The inputs are the two data bits to subtract, and the borrow input. The outputs are the resulting difference bit and the borrow output. You really should be able to figure out how to chain such blocks to subtract multi-bit numbers.
  • <hr>
  • <blockquote>I cant understand which pins to connect with which pins.</blockquote>
  • Pins of <i>what</i> exactly? What exactly do you think the pins of this thing are?
  • Again, we are not here to do your homework for you. You have to put in some effort and be trying to learn. Show a block diagram of this thing, its input and output signals, and explain what you think each of these signals do. You may realize how to hook it up in the process of trying to explain it. Or, if there is a misconception, we'll know better how to help you understand it.
  • This is getting away from the original question. Instead of adding this to your existing question (and thereby causing confusion), it is probably better to show the diagram, input and output signals, and ask about connecting up the block in a separate question.
#3: Post edited by user avatar Olin Lathrop‭ · 2021-08-06T19:49:39Z (over 2 years ago)
  • We don't just give direct answers to homework (or homework-like) questions here, but can help you work thru the problem on your own.
  • You might consider trying to synthesize a subtractor from scratch, just like you would an adder. The fundamental building block of an adder is the half-adder. It takes in two bits to add, and produces the sum and carry bits. Since there are only 4 possible combinations of inputs, a truth table nicely describes its operation exhaustively:
  • <pre>
  • In1 In2 Sum Car
  • --- --- --- ---
  • 0 0 0 0
  • 0 1 1 0
  • 1 0 1 0
  • 1 1 0 1
  • </pre>
  • That should be enough to create a circuit of basic logic gates to implement the half-adder. You then chain together two of these per bit to make the full adder. This process is well documented in many place out there, very likely in your textbook too.
  • Now consider doing the same thing for subtraction. You have two input bits, and two output bits. In this case the output bits are the difference and the borrow.
  • When you get done with this, it might be instructive to compare that result to constructing a subtractor by complementing one of the input numbers, adding it to the other input number, and adding 1 to the result. Note that adding 1 to the result is the same as if the carry input to the first bit were 1.
  • We don't just give direct answers to homework (or homework-like) questions here, but can help you work thru the problem on your own.
  • You might consider trying to synthesize a subtractor from scratch, just like you would an adder. The fundamental building block of an adder is the half-adder. It takes in two bits to add, and produces the sum and carry bits. Since there are only 4 possible combinations of inputs, a truth table nicely describes its operation exhaustively:
  • <pre>
  • In1 In2 Sum Car
  • --- --- --- ---
  • 0 0 0 0
  • 0 1 1 0
  • 1 0 1 0
  • 1 1 0 1
  • </pre>
  • That should be enough to create a circuit of basic logic gates to implement the half-adder. You then chain together two of these per bit to make the full adder. This process is well documented in many place out there, very likely in your textbook too.
  • Now consider doing the same thing for subtraction. You have two input bits, and two output bits. In this case the output bits are the difference and the borrow.
  • When you get done with this, it might be instructive to compare that result to constructing a subtractor by complementing one of the input numbers, adding it to the other input number, and adding 1 to the result. Note that adding 1 to the result is the same as if the carry input to the first bit were 1.
  • <hr>
  • <blockquote>I know how to make a full subtractor i just dont know how to connect multiple of them in order to make subtraction of 2 binary numbers with more than 1 bit</blockquote>
  • That makes little sense. If you really had a full subtractor, then you'd know what the input and output signals were, and then it would be obvious how to chain them to subtract wide numbers.
  • A full subtractor has three inputs and two outputs. The inputs are the two data bits to subtract, and the borrow input. The outputs are the resulting difference bit and the borrow output. You really should be able to figure out how to chain such blocks to subtract multi-bit numbers.
#2: Post edited by user avatar Olin Lathrop‭ · 2021-08-06T16:54:40Z (over 2 years ago)
  • We don't just give direct answers to homework (or homework-like) questions here, but can help you work thru the problem on your own.
  • You might consider trying to synthesize a subtractor from scratch, just like you would an adder. The fundamental building block of an adder is the half-adder. It takes in two bits to add, and produces the sum and carry bits. Since there are only 4 possible combinations of inputs, a truth table nicely describes its operation exhaustively:
  • <pre>
  • In1 In2 Sum Car
  • --- --- --- ---
  • 0 0 0 0
  • 0 1 1 0
  • 1 0 1 0
  • 1 1 1 1
  • </pre>
  • That should be enough to create a circuit of basic logic gates to implement the half-adder. You then chain together two of these per bit to make the full adder. This process is well documented in many place out there, very likely in your textbook too.
  • Now consider doing the same thing for subtraction. You have two input bits, and two output bits. In this case the output bits are the difference and the borrow.
  • When you get done with this, it might be instructive to compare that result to constructing a subtractor by complementing one of the input numbers, adding it to the other input number, and adding 1 to the result. Note that adding 1 to the result is the same as if the carry input to the first bit were 1.
  • We don't just give direct answers to homework (or homework-like) questions here, but can help you work thru the problem on your own.
  • You might consider trying to synthesize a subtractor from scratch, just like you would an adder. The fundamental building block of an adder is the half-adder. It takes in two bits to add, and produces the sum and carry bits. Since there are only 4 possible combinations of inputs, a truth table nicely describes its operation exhaustively:
  • <pre>
  • In1 In2 Sum Car
  • --- --- --- ---
  • 0 0 0 0
  • 0 1 1 0
  • 1 0 1 0
  • 1 1 0 1
  • </pre>
  • That should be enough to create a circuit of basic logic gates to implement the half-adder. You then chain together two of these per bit to make the full adder. This process is well documented in many place out there, very likely in your textbook too.
  • Now consider doing the same thing for subtraction. You have two input bits, and two output bits. In this case the output bits are the difference and the borrow.
  • When you get done with this, it might be instructive to compare that result to constructing a subtractor by complementing one of the input numbers, adding it to the other input number, and adding 1 to the result. Note that adding 1 to the result is the same as if the carry input to the first bit were 1.
#1: Initial revision by user avatar Olin Lathrop‭ · 2021-08-06T16:52:52Z (over 2 years ago)
We don't just give direct answers to homework (or homework-like) questions here, but can help you work thru the problem on your own.

You might consider trying to synthesize a subtractor from scratch, just like you would an adder.  The fundamental building block of an adder is the half-adder.  It takes in two bits to add, and produces the sum and carry bits.  Since there are only 4 possible combinations of inputs, a truth table nicely describes its operation exhaustively:

<pre>

  In1   In2   Sum   Car
  ---   ---   ---   ---
    0     0     0     0
    0     1     1     0
    1     0     1     0
    1     1     1     1
</pre>

That should be enough to create a circuit of basic logic gates to implement the half-adder.  You then chain together two of these per bit to make the full adder.  This process is well documented in many place out there, very likely in your textbook too.

Now consider doing the same thing for subtraction.  You have two input bits, and two output bits.  In this case the output bits are the difference and the borrow.

When you get done with this, it might be instructive to compare that result to constructing a subtractor by complementing one of the input numbers, adding it to the other input number, and adding 1 to the result.  Note that adding 1 to the result is the same as if the carry input to the first bit were 1.