N bit Binary adder-subtractor discussion with `circuit` and `example.`

Introduction:-

Binary addition or subtraction can be implemented using a single circuit as discussed below. With this implementation any length (no of bits = N) of binary numbers can be used to calculate the results by using N number of full-adders and N number of XOR gates.

Circuit is very similar to binary adder circuit except of a XOR gate at second input to full-adders.

Next, we will draw a circuit for adder-subtractor.

LTE - 4G Wireless Technology

Digital fundamentals.

Interview Questions.

As we have already discussed that full-adders are essentail builiding block for addition and subtraction operations. The ciruit below will employ xor gate to simply change `A+B` to `A-B` operations. In other words invert the Input B. Check this interview puzzle to understand xor gate as inverter.

Switch Mode (SM) is a control input to the circuit to switch between addition or subtraction operations.

When SM = 0 the circuit is equivalent to Binary Adder.
B (bit ) XOR 0 = B (bit)

Subtractor:
When SM = 1 the circuit is equivalent to Binary subtractor.
B (bit ) XOR 1 = invert(B (bit))
‘B’ input become’s and inverted in this case.  The carry of 1 in this case results in 2's complement operations.

Some `Examples` Discussed next.

Tutorials `@fullchipdesign.com`

Verilog Tutorial.

LTE Tutorial.

Memory Tutorial.

Hope you liked! this page. Don't forgot to access relevant `previous and next sections ` with links below.