You must login before you can post a comment.

Adder subtractor Circuit detail explanation

0
Stars
13
Views

**Author: **
Yussif Mohamed g

**Forked from: **
Yussif Mohamed g/Adder subtractor Circuit detail explanation

**Project access type: **
Public

**Description: **

Circuit Verse should be used only to create the project – online simulator https://circuitverse.org/simulator

All screenshots should include clear evidence for the student names and the date and time taken.

Start building the 4-bit adder subtractor circuit from the half adder until you reach the final circuit results.

Build the 1-bit half adder circuit and convert it into symbol (block).

Build the 1-bit full adder circuit and convert it into symbol (block).

Build the 4-bit adder circuit and convert it into symbol (block).

Build the 4-bit adder subtractor and convert it into symbol (block).

Build the final circuit

Build the 1-bit half adder circuit and convert it into symbol (block).

Write a detailed explanation about the full adders.

Insert your screenshot and the explanation here

I want to sum 2 binary digits (A,B) and the sum of 2 binary numbers needs (at most) 2 output digits;

so from truth table:

A

B

Sum

Carry

0

0

0

0

0

1

1

0

1

0

1

0

1

1

0

1

Sum: S = (A.B’) + (A’.B) = A⨁ B

Carry: C = A.B

Build the 1-bit full adder circuit and convert it into symbol (block).

Write a detailed explanation about the full adders.

Insert your screenshot and the explanation here

I want to sum 3 binary digits (X ,Y , Cin) and the sum of 3 binary numbers needs (at most) 2 output digits (S , Cout).

X

Y

Cin

Sum

Carry

0

0

0

0

0

0

0

1

1

0

0

1

0

1

0

0

1

1

0

1

1

0

0

1

0

1

0

1

0

1

1

1

0

0

1

1

1

1

1

1

Sum = (X’ .Y’ .Cin) + (X’ .Y .Cin’) + (X .Y’ .Cin’) + (X .Y .Cin)

= X’ .((Y’ .Cin) + (Y .Cin’)) + X .((Y’ .Cin’) + (Y .Cin))

= X’ .(Y⨁ Cin) + X .(Y⨁ Cin)’

= X ⨁ Y ⨁ Cin

Carry = (X’ .Y .Cin) + (X .Y’ .Cin) + (X .Y .Cin’) + (X .Y .Cin)

= Cin .(X⨁ Y) + X .Y

since: Sum [from Full Adder (F.A.)] = X ⨁ Y ⨁ Cin

= Sum1 [from Half Adder (H.A.)] ⨁ Cin

Carry [from Full Adder (F.A.)] = X .Y + Cin .(X⨁ Y)

= Carry1 [from Half Adder (H.A.)] + Cin .(X⨁ Y)

I can use 1 Half Adder to get [Sum1 from H.A. = X⨁ Y] and [Carry1 from H.A. = X.Y]

then I can use anther 1 Half Adder with (first Sum form H.A. & Cin) to get:

===> Sum =[(Sum1 from H.A.) ⨁ Cin] = X ⨁ Y ⨁ Cin <=== that’s the final Sum

and Carry2 [from second Half Adder (H.A.)] = Cin .(X⨁ Y)

If I passed the two Carry outputs (Carry1 & Carry2) through OR gate; I will get the final Carry:

===> final Carry = Carry1 + Carry2 = X .Y + Cin .(X⨁ Y) <=== that’s the final Carry

So, we can use 2 H.A. & OR gate to construct Full Adder.

Build the 4-bit adder circuit and convert it into symbol (block).

Write a detailed explanation about how it works.

Insert your screenshot and the explanation here

since Half Adder Circuit (H.A.) can sum 2 digits

since Full Adder Circuit (F.A.) can sum 3 digits at once

It’s generally used Full Adder (F.A.) Circuits to sum 2 digits (1-digit from input x & 1-digit from input y) and add to them the carry (in the third input digit) from previous sum operation.

Ofcourse first 1-bit adder doesn’t need 3 input digits (because of there is no Carry);

So I used H.A. Circuit in first 1-bit Adder.

Build the 4-bit adder subtractor and convert it into symbol (block).

Write a detailed explanation about how it works.

Insert your screenshot and the explanation here

It’s preferred to subtract binary numbers (Z= X - Y) using the 2’s complement method; Which says that we find the 1’s complement to the -ve number (Y) and then add 1 to it;

After that we can use the new input of Y to sum it normally with X using a 4-bit Adder Circuit.

⇒ The complement of every digit of Y = Y’ ⇒ Y’ = {y0’ , y1’ , y2’ , y3’}

so every digit of Y enters on NOT gate to become Y’

⇒ Then add 1 (as a carry) to the Sum of first 1-bit Full Adder(F.A.)

∴The output Z = X - Y [but X must be >= Y]

Build the final circuit

Include screenshots with 4 different random examples and explain each one:

2 addition

2 subtraction

Write detailed explanation about how it works and how you did it.

Insert your screenshots and the explanation here

HOW I DID THIS CIRCUIT:

The Circuit works in 2 options. When I keep [selector = 0] the Circuit is a 4-bit Adder and when I keep [selector = 1] the circuit is a 4-bit Subtractor.

∵The difference between 4-bit adder & 4-bit subtractor is in

1)the input Y (which is converted to Y’ in a 4-bit Subtractor)

2)& the third input digit in the first bit Full adder.

∴For input Y problem:

we need to find the equation that converts Y to Y’ (the 1’s complement) when the [selector = 1]. (i’ll use y0 digit to explain on)

selector

y0

f(y0)

0

0

0

0

1

1

1

0

1

1

1

0

f(y0) = selector ⨁ y0

⇒ ∴the problem of Y is solved when we connect every digit of Y with selector using X-OR gate.

∴For the problem of the third input digit in the first 1-bit Full adder:

we need to keep [the third input digit = 0] when the wanted operation is sum (selector=0) and keep [third input digit = 1] when the operation is subtraction (selector=1)

⇒ ∴ The third input digit in first bit Full adder = selector

Screenshot 1

When the input X=(0101) :{x3=0 , x2=1 , x1=0 , x0=1}

& when the input Y=(0111) : {y3=0 , y2=1 , y1=1 , y0=1}

∵ selector = 0 ∴ The operation is summing (Z = X + Y)

∴ Z0 = sum of three input digits (x0 , y0 , Cin)

Z0= x0 + y0 + selector = 1 + 1 + 0 = 0 [& 1-carried to next bit Full Adder]

Z1= x1 + y1 + Cin = 0 + 1 + 1(carry)= 0 [& 1-carried to next bit Full Adder]

Z2= x2 + y2 + Cin = 1 + 1 + 1(carry)= 1 [& 1-carried to next bit Full Adder]

Z3= x3 + y3 + Cin = 0 + 0 + 1(carry)= 1 [& no carry]

Z4= last carry = 0

∴ Z = 01100

Screenshot 2

When the input X=(1111) :{x3= 1 ,x2= 1 ,x1= 1 ,x0= 1}

& when the input Y=(1111) : {y3= 1 ,y2= 1 ,y1= 1 ,y0= 1}

∵ selector = 0 ∴ The operation is summing (Z = X + Y)

∴ Z0 = sum of three input digits (x0 , y0 , Cin)

Z0= x0 + y0 + Cin = 1 + 1 + selector = 0 [& 1-carried to next bit Full Adder]

Z1= x1 + y1 + Cin = 1 + 1 + 1(carry) = 1 [& 1-carried to next bit Full Adder]

Z2= x2 + y2 + Cin = 1 + 1 + 1(carry) = 1 [& 1-carried to next bit Full Adder]

Z3= x3 + y3 + Cin = 1 + 1 + 1(carry) = 1 [& 1-carried to next bit Full Adder]

Z4= last carry = 1

∴ Z = 11110

Screenshot 3

When the input X=(1111) :{x3= 1 ,x2= 1 ,x1= 1 ,x0= 1}

& when the input Y=(0101) : {y3= 0 ,y2= 1 ,y1= 0 ,y0= 1}

∵ selector = 1 ∴ The operation is subtract (Z = X - Y)

the circuit Subtracts using 2’s complement method:

∴ 1’s complement of Y = Y’ = 1010: {y3’= 1 ,y2’= 0 ,y1’= 1 ,y0’= 0}

∴ Z0 = sum of three input digits (x0 , y0’ , Cin)

Z0= x0 + y0’ + Cin = 1 + 0 + selector = 0 [& 1-carried to next bit Full Adder]

Z1= x1 + y1’ + Cin = 1 + 1 + 1(carry) = 1 [& 1-carried to next bit Full Adder]

Z2= x2 + y2’ + Cin = 1 + 0 + 1(carry) = 0 [& 1-carried to next bit Full Adder]

Z3= x3 + y3’ + Cin = 1 + 1 + 1(carry) = 1 [& 1-carried to next bit Full Adder]

Z4= last carry = 1 (note: we ignore last bit (Z4) in subtract operation & it have to = 1)

when [Z4 = 1] that means [X>=Y]

∴ Z = 1010

Screenshot 4

When the input X=(0111) :{x3= 0 ,x2= 1 ,x1= 1 ,x0= 1}

& when the input Y=(0111) : {y3= 0 ,y2= 1 ,y1= 1 ,y0= 1}

∵ selector = 1 ∴ The operation is subtract (Z = X - Y)

the circuit Subtracts using 2’s complement method:

∴ 1’s complement of Y = Y’ = 1000: {y3’= 1 ,y2’= 0 ,y1’= 0 ,y0’= 0}

∴ Z0 = sum of three input digits (x0 , y0’ , Cin)

Z0= x0 + y0’ + Cin = 1 + 0 + 1(selector)= 0 [& 1-carried to next bit Full Adder]

Z1= x1 + y1’ + Cin = 1 + 0 + 1(carry) = 0 [& 1-carried to next bit Full Adder]

Z2= x2 + y2’ + Cin = 1 + 0 + 1(carry) = 0 [& 1-carried to next bit Full Adder]

Z3= x3 + y3’ + Cin = 0 + 1 + 1(carry) = 0 [& 1-carried to next bit Full Adder]

Z4= last carry = 1 (note: we ignore last bit (Z4) in subtract operation & it have to = 1)

when [Z4 = 1] that means [X>=Y]

∴ Z = 0000

**Created: **
Dec 30, 2023

**Updated: **
Dec 30, 2023

## Comments