Common Computer Science References
At the end of this lesson, you will be able to:
build a 4-bit full adder/subtractor
go over two complement subtraction
remember, to subtract a two's complement number, flip every bit and do addition, plus add 1.
we know how to flip every bit, it is called a NOT gate
if you want to flip or not, you can use an XOR gate
Bit, control and output
then there is the problem of understanding overflow and underflow:
So here is something to notice: if we have 1 positive and 1 negative number, then there is actually no way to get an overflow (the number will always fit in our bits). If we have both negative or both positive numbers we can have an overflow (or underflow).Â
So the rule is: ONLY if both number are the same magnitude (ie. they both have 1s or both have 0s in the most significant digit), AND the most significant digit (the leftmost digit of the answer, not the carry out!) of the answer is different, is the flag set to 1 (some error, overflow or underflow).
That is because if both are 0s, that means we started with a positive number. If we end with a left bit of 1, that means the answer is negative. That would be impossible!
nil
circuit - "4-bit full Adder/subtractor"
add the XOR and carry in bit to the control and create a full adder/subtractor
join with another student if you want to (they already have a full adder!)
just ground your Carry In, so that it is always zero
build the circuit on your breadboard
once working, call me over to check
take a picture of your completed breadboard and upload it to your notebook
Note: you should be uploading 2 things to your notebook:
truth table
picture of a completed real-world breadboard
nil