Welcome to our site! EDAboard.com is an international Electronic Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.
A simple logic wil be to implement it directly as we do in straight forward hand calculations..
First complement every bit using an inverter and feed it to shift registers(if you want 4 bit,then use 4 shift registers..).. Now they wil be storing the 1's complement in them.. Feed it to an adder with the 1's complement as one input and 1 as another input.. The adder result wil be your 2's complement!
1. Using an X-OR gate (it is a controlled inverter) pass logic 1 into one pin and the data (say pin B) in the other if you want to invert the data. If you pass logic 0 then no inversion occurs.
2. Then using an adder circuit using add 1 to the output from the X-OR gates and apply 0 to the other input (say pin A)
3. This way you will have an adder/subtractor circuit.