Tabur
Newbie level 1
Hi there!
I'm trying to build a "simple calculator". It is supposed to be able to add or subtract any two 7bit numbers (be it positive or negative numbers).
until now, I have most of it already done:
First of all, both 7bit number (A and B from now on) have another bit that tells the system whether its a positive (0) or negative (1) number. If its negative, then It makes the compliment of 2. If not, It just goes into the Full Adder. Same for the B number.
Also, theres a switch (X) that tells the system if it should add (0) or subtract (1) B to A. For instance, if the switch is 1 and both A[8] and B[8] are 0, its the same as A - B, or, A + Bcomp2.
All of that is already made, now, heres my 2 problems:
1.- I dont know how to catch Overflow ( I need a LED display to light when theres overflow)
2.- I dont know when to compliment the Result (S) of the addition when its negative. I know I can just use an 8bit number comparator and if the first is smaller than the second and I'm subtracting, then compliment again, but I'm SURE theres a simpler way (I need to fit this into a protoboard and to make this as simple as possible).
Could you help me getting this right???
I'll upload the schematics I have until now
Thanks!
I'm trying to build a "simple calculator". It is supposed to be able to add or subtract any two 7bit numbers (be it positive or negative numbers).
until now, I have most of it already done:
First of all, both 7bit number (A and B from now on) have another bit that tells the system whether its a positive (0) or negative (1) number. If its negative, then It makes the compliment of 2. If not, It just goes into the Full Adder. Same for the B number.
Also, theres a switch (X) that tells the system if it should add (0) or subtract (1) B to A. For instance, if the switch is 1 and both A[8] and B[8] are 0, its the same as A - B, or, A + Bcomp2.
All of that is already made, now, heres my 2 problems:
1.- I dont know how to catch Overflow ( I need a LED display to light when theres overflow)
2.- I dont know when to compliment the Result (S) of the addition when its negative. I know I can just use an 8bit number comparator and if the first is smaller than the second and I'm subtracting, then compliment again, but I'm SURE theres a simpler way (I need to fit this into a protoboard and to make this as simple as possible).
Could you help me getting this right???
I'll upload the schematics I have until now
Thanks!