Ch10L1-"Microcontrollers....", Raj Kamal, from Pearson Education, 2005. 3.
Outline. • Half Adder. • Full Adder. • Addition of two 4-bit numbers. • Addition
using a ...
Chapter 10
BINARY ARITHMETIC, DECODING AND MUX LOGIC UNITS
Lesson 1
Binary Addition and Subtraction
Ch10L1-"Microcontrollers....", Raj Kamal, from Pearson Education, 2005
2
Outline • • • • •
Half Adder Full Adder Addition of two 4-bit numbers Addition using a MSI IC Subtraction Ch10L1-"Microcontrollers....", Raj Kamal, from Pearson Education, 2005
3
Half adder • Cy'0 —carry bit obtained at an output of adder circuit, • S — sum bit obtained at another output • Circuit is called half adder (H.A.) if A add B = S plus Cy’0
Ch10L1-"Microcontrollers....", Raj Kamal, from Pearson Education, 2005
4
Half Adder 2 inputs and 2 outputs Inputs A B 0 0 1 1
0 1 0 1
Outputs S Cy’0 0 1 1 0
0 0 0 1
Ch10L1-"Microcontrollers....", Raj Kamal, from Pearson Education, 2005
5
Half Adder • Circuit Cy’0 S A B Ch10L1-"Microcontrollers....", Raj Kamal, from Pearson Education, 2005
6
Outline • • • • •
Half Adder Full Adder Addition of two 4-bit numbers Addition using a MSI IC Subtraction Ch10L1-"Microcontrollers....", Raj Kamal, from Pearson Education, 2005
7
Full adder • Cyi–1 and Cyi —carry bits at the input and output of adder circuit at ith place, • S — sum bit obtained at another output • Circuit is called full adder (H.A.) if Cyi–1 add A add B = S plus Cyi' • Place from right most to the leftmost in a number — 0 to n–1 Ch10L1-"Microcontrollers....", Raj Kamal, from Pearson Education, 2005
8
Full Adder 2 inputs and 2 outputs A 0 0 0 0 1 1 1 1
Inputs B Cyi–1
Outputs S Cyi
0 0 0 0 0 1 1 0 1 0 1 0 1 1 0 1 0 0 1 0 0 1 0 1 1 0 0 1 1 1 1 20051 Ch10L1-"Microcontrollers....", Raj Kamal, from Pearson Education,
9
Full Adder • Circuit Cy’0
A B Cyi–1
S
Ch10L1-"Microcontrollers....", Raj Kamal, from Pearson Education, 2005
10
Outline • • • • •
Half Adder Full Adder Addition of two 4-bit numbers Addition using a MSI IC Subtraction Ch10L1-"Microcontrollers....", Raj Kamal, from Pearson Education, 2005
11
4-bit Adder A3 B3 A2 B2 A1 B1 A0 B0 Cy3
Cy2
Cy1
Cy0
Cy-1
F.A
F.A
F.A
F.A
S3
S2
S1
S0
Ch10L1-"Microcontrollers....", Raj Kamal, from Pearson Education, 2005
0
12
Outline • • • • •
Half Adder Full Adder Addition of two 4-bit numbers Addition using a MSI IC Subtraction Ch10L1-"Microcontrollers....", Raj Kamal, from Pearson Education, 2005
13
4-bit Adder circuit MSI IC S3 S2 S1 S0 7483
Cyi-1
A3B3A2B2A1B1A0B0 Ch10L1-"Microcontrollers....", Raj Kamal, from Pearson Education, 2005
14
Outline • • • • •
Half Adder Full Adder Addition of two 4-bit numbers Addition using a MSI IC Subtraction Ch10L1-"Microcontrollers....", Raj Kamal, from Pearson Education, 2005
15
Subtraction • Subtraction of B from A is addition of binary number A and two’s complement of B • Two’s complement of B is addition of 1 with 1’s complement of B. • A method to find 1’s complement of a bit is using an XOR at which one of the input = 1 Ch10L1-"Microcontrollers....", Raj Kamal, from Pearson Education, 2005
16
B3
A3 Cy3
B0
B1
B2 A2 Cy2
A1 Cy1
A0 Cy0
Cy-1
F.A
F.A
F.A
F.A
S3
S2
S1
S0
= 0 for Add = 1 for subtract
4-bit Adder Cum subtractor Ch10L1-"Microcontrollers....", Raj Kamal, from Pearson Education, 2005
17
4-bit Adder/Subtractor circuit MSI IC 7483
S3 S2 S1 S0 Cyi-1
Add/subtract A3B3A2B2A1B1A0B0 Ch10L1-"Microcontrollers....", Raj Kamal, from Pearson Education, 2005
18
Summary
Ch10L1-"Microcontrollers....", Raj Kamal, from Pearson Education, 2005
19
Addition • Full adder takes two bits in input and outs sum bit and carry bit • Full adder takes carry and two bits in input and outs sum bit and carry bit • XOR gate generates carry • 3-AND- 1-OR array generated Sum Ch10L1-"Microcontrollers....", Raj Kamal, from Pearson Education, 2005
20
Subtraction • Second input of full adder is through an XOR • XOR connects other input to Sub/Add control signal and when 1 then full adder implements subtractor.
Ch10L1-"Microcontrollers....", Raj Kamal, from Pearson Education, 2005
21
End of Lesson 1 on
Binary Addition and Subtraction
Ch10L1-"Microcontrollers....", Raj Kamal, from Pearson Education, 2005
22
THANK YOU
Ch10L1-"Microcontrollers....", Raj Kamal, from Pearson Education, 2005
23