I want to implement unsigned subtraction using 2's complement. I arrived to this, where if I have 2 4-bit binary numbers A and B, I transform B to 2's complement (let us name it B' so we don't get confused) and then add A to B'and I get the result C. This was the easy part for me.
Then if the final carry out is "0" I should transform C to 2's complement and add a "-" sign, but if the carry out is "1" I just don't adjust anything. And this is where it got me. I don't know how to implement it and I should put a led in the final result to let know if the sign is "+/-".
I think I should put a 2-to-1 multiplexer where the select input will be the carry out of the circuit I posted.
And by the way, my implementation is correct, whenever I put random values and then calculate those by hand I get the same result.
Thank you in advance.
(The program I used is called "logicCircuit".
So this is what I got to.(After editing my post)
The circuit above is my main circuit.
These 2 pictures above are just zoomed in photos of the circuit
Now my question is, can I do something so I can get only one result. For example if the carry is "0" The multiplexer gives me the correct result, but in the same time I am getting a result in the upper part of my circuit which is the part that should give me a result whenever the carry is "1" and vice versa.
The gray bubble are leds so when the result is 1, the led lights up.