CPSC 352 Chapter 3: Arithmetic
[Pages:6]3-1
Chapter 3: Arithmetic
CPSC 352 Chapter 3: Arithmetic
3-2
Chapter 3: Arithmetic
Chapter Contents
3.1 Overview 3.2 Fixed Point Addition and Subtraction 3.3 Fixed Point Multiplication and Division 3.4 Floating Point Arithmetic 3.5 High Performance Arithmetic 3.6 Case Study: Calculator Arithmetic Using Binary Coded Decimal
3-3
Chapter 3: Arithmetic
Computer Arithmetic
? Using number representations from Chapter 2, we will explore four basic arithmetic operations: addition, subtraction, multiplication, division.
? Significant issues include: fixed point vs. floating point arithmetic, overflow and underflow, handling of signed numbers, and performance.
? We look first at fixed point arithmetic, and then at floating point arithmetic.
3-4
Chapter 3: Arithmetic
Number Circle for 3-Bit Two's
Complement Numbers
? Numbers can be added or subtracted by traversing the number circle clockwise for addition and counterclockwise for subtraction.
? Overflow occurs when a transition is made from +3 to -4 while pro-
ceeding around the number circle when adding, or from -4 to +3
while subtracting.
0
Subtracting
-1
000
numbers
1
111
001
-2 110
010 2
101
011
-3
100
3
Adding
-4
numbers
3-5
Chapter 3: Arithmetic
Overflow
? Overflow occurs when adding two positive numbers produces a negative result, or when adding two negative numbers produces a positive result. Adding operands of unlike signs never produces an overflow.
? Notice that discarding the carry out of the most significant bit during two's complement addition is a normal occurrence, and does not by itself indicate overflow.
? As an example of overflow, consider adding (80 + 80 = 160)10, which produces a result of -9610 in an 8-bit two's complement format:
01010000 = 80 + 01010000 = 80 ----------
10100000 = -96 (not 160 because the sign bit is 1.)
3-6
Chapter 3: Arithmetic
Ripple Carry Adder
? Two binary numbers A and B are added from right to left, creating a sum and a carry at the outputs of each full adder for each bit position.
b3 a3 c3
Full adder
b2 a2 c2
Full adder
b1 a1 c1
Full adder
b0 a0 c0 0
Full adder
c4
s3
s2
s1
s0
3-7
Chapter 3: Arithmetic
Constructing Larger Adders
? A 16-bit adder can be made up of a cascade of four 4-bit ripplecarry adders.
a15 a14 a13 a12 b15 b14 b13 b12
a3 a2 a1 a0 b3 b2 b1 b0
c16
4-Bit Adder #3
c12 . . . c4
4-Bit Adder #0
c0 0
s15 s14 s13 s12
s3 s2 s1 s0
3-8
Chapter 3: Arithmetic
Full Subtractor
? Truth table and schematic symbol for a ripple-borrow subtractor:
ai bi bori diffi bori+1
00 0 00 1 01 0 01 1 10 0 10 1 11 0 11 1
00 11 11 01 10 00 00 11
bi ai bori
Full subtractor
bori+1
diffi (ai ? bi)
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- basic arithmetic and the alu multiplication
- lecture 8 binary multiplication division
- two s complement rit
- 3 17 binary and hexadecimal calculator 39
- cpsc 352 chapter 3 arithmetic
- unsigned binary math final fgcu
- signed binary arithmetic
- signed fixed point calculator
- binary arithmetic and bit operations
- 1st hand out ir
Related searches
- chapter 3 developmental psychology quizlet
- mcgraw hill algebra1 chapter 3 lesson 8
- chapter 3 psychology quizlet test
- psychology chapter 3 quiz answers
- developmental psychology chapter 3 quizlet
- strategic management chapter 3 quizlet
- psychology chapter 3 exam
- psychology chapter 3 test questions
- quizlet psychology chapter 3 quiz
- chapter 3 psychology quiz
- developmental psychology chapter 3 test
- quizlet psychology chapter 3 answers