Subtractors - PowerPoint PPT Presentation

1 / 18
About This Presentation
Title:

Subtractors

Description:

Subtractors Lecture L7.2 Section 6.2 Subtractors Half Subtractor Full Subtractor Adder/Subtractor - 1 Adder/Subtractor - 2 Half Subtractor Full Subtractor Full ... – PowerPoint PPT presentation

Number of Views:114
Avg rating:3.0/5.0
Slides: 19
Provided by: cseSecsOa2
Category:

less

Transcript and Presenter's Notes

Title: Subtractors


1
Subtractors
  • Lecture L7.2
  • Section 6.2

2
Subtractors
  • Half Subtractor
  • Full Subtractor
  • Adder/Subtractor - 1
  • Adder/Subtractor - 2

3
Half Subtractor
C
A
B
D
0
0
0
1
0 0 0 0 0 1 1 1 1 0 1 0 1 1 0 0
2
1
0 -1 1
4
Full Subtractor
Ci Ai Bi Di Ci1
0 0 0 0 0 0 0 1 1 1 0 1 0 1 0 0 1 1 0 0 1
0 0 1 1 1 0 1 0 1 1 1 0 0 0 1 1 1 1 1
1
1
1
1
Di
5
Full Subtractor
Ci Ai Bi Di Ci1
0 0 0 0 0 0 0 1 1 1 0 1 0 1 0 0 1 1 0 0 1
0 0 1 1 1 0 1 0 1 1 1 0 0 0 1 1 1 1 1
1
1
1
1
Ci1
Ci1 !Ai Bi Ci !Ai !Bi Ci
Ai Bi
6
Full Subtractor
Ci1 !Ai Bi Ci !Ai !Bi Ci
Ai Bi
Ci1 !Ai Bi Ci (!Ai !Bi Ai
Bi) Ci1 !Ai Bi Ci !(Ai Bi)
Recall
Di Ci (Ai Bi)
Ci1 !Ai Bi Ci !(Ai Bi)
7
Full Subtractor
Di Ci (Ai Bi)
Ci1 !Ai Bi Ci !(Ai Bi)
8
subtract.abl
MODULE subtract TITLE 'Subtractor, A. Student,
7/12/02' DECLARATIONS " INPUT PINS " A3..A0 PIN
6, 7, 11, 5 " Switch 1..4 A A3..A0
" 4-bit operand B3..B0 PIN 72, 71,
66, 70 " Switch 5..8 B B3..B0
" 4-bit subtrahend " OUTPUT PINS " D3..D0
PIN 39, 37, 36, 35 ISTYPE 'com' " LED 5..8 D
D3..D0 " 4-bit difference BF PIN
40 ISTYPE 'com' " LED 4 borrow flag
9
subtract.abl (contd)
" INTERMEDIATE NODES " C4..C0 NODE ISTYPE 'com'
" internal borrow vector Cin C3..C0 Cout
C4..C1 EQUATIONS C0 0 D C A B Cout
!A B Cin !(A B) BF C4 END subtract
Di Ci (Ai Bi)
Ci1 !Ai Bi Ci !(Ai Bi)
10
Adder/Subtractor - 1
Half subtractor
Half adder
E 0 Half adder
E 1 Half subtractor
11
Adder/Subtractor-1
i1
E 0 Full adder E 1 Full subtractor
12
addsub1.abl
i1
C4..C0 NODE ISTYPE 'com' " internal borrow
vector Cin C3..C0 Cout C4..C1
EQUATIONS Cout Cin (E (A B)) (E A)
B
13
Adder/Subtractor-2
14
Reordered Full Adder
Full Adder
Ci Ai Bi Si Ci1
Ci Ai Bi Si Ci1
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
1 0 1 0 1 1 0 0 1 0 1 1 1 1 1 1 1 0 0 1 0
0 1 1 0 0 0 0 0 0 0 1 1 0 1 0 1 0 1 0
NOT
15
Making a full subtractor from a full adder
16
Adder/Subtractor-2
E 0 4-bit adder E 1 4-bit subtractor
17
4-bit Subtractor E 1
That is, add A to twos complement of B D A - B
18
Question
Subtract the following 4-bit binary numbers
10110110 -74 11001011 -53 11101011
-21
What is the answer in binary and dec? Was there a
net borrow?
Yes
Write a Comment
User Comments (0)
About PowerShow.com