In my lab, we successfully built a 4-bit binary parallel adder and were able to display the results of some tests on the 7 segment display.
But our TA asked us to try something: subtract 1-9, and we got 7. Why is that?
Electrical Engineering Stack Exchange is a question and answer site for electronics and electrical engineering professionals, students, and enthusiasts. It only takes a minute to sign up.
Sign up to join this communityIn my lab, we successfully built a 4-bit binary parallel adder and were able to display the results of some tests on the 7 segment display.
But our TA asked us to try something: subtract 1-9, and we got 7. Why is that?
So basically whenever you do 1-9 in binary that looks like
00001 (1) - 01001(9)
however since most of the subtraction is done by twos complement it is actually
00001 + 10110 => 10111
Your display will only display the bottom four bits which are 0111, which is seven.
Cheers!
in binary:
1: 0001
Subtracting 9 times 1:
0000 (-1)
1111 (-2)
1110 (-3)
1101 (-4)
1100 (-5)
1011 (-6)
1010 (-7)
1001 (-8)
1000 (-9)
I would expect 1000, which is 8.