Professional Documents
Culture Documents
LEC Ch1
LEC Ch1
INTRODUCTION
NUMBER SYSTEMS AND CONVERSION
FIU-ECE-CEA
©2010 Cengage Learning
Switching circuits
1.- Combinational:
Outputs depend only on the present value of inputs (not past values)
2.- Sequential:
Outputs depend on the present and past values of inputs
FIU-ECE-CEA
©2010 Cengage Learning
Number Systems and Conversion:
Any positive integer R (R>1) can be chosen as the “base” (radix)of a number system.
N = (a4 a3 a2 a1 a0 .a-1 a-2 a-3)R
N = (a4xR4 + a3xR3 + a2xR2 + a1xR1 + a0xR0
+ a-1xR-1 + a-2xR-2 + a-3xR-3)
Decimal Notation
953.7810 = 9x102 + 5x101 + 3x100 + 7x10-1 + 8x10-2
Binary
1011.112 = 1x23 + 0x22 + 1x21 + 1x20 + 1x2-1 + 1x2-2
= 8 + 0 + 2 + 1 + 1/2 + 1/4
= 11.7510
FIU-ECE-CEA
©2010 Cengage Learning
How to find the coefficients:
For the integer part: N = a4xR4 + a3xR3 + a2xR2 + a1xR1 + a0
If we divide N by R, then the remainder is a0
N = a4xR3 + a3xR2 + a2xR1 + a1 = Q1 , remainder a0
R
If we divide Q1 by R, then the remainder is a0
Q1 = a4xR2 + a3xR1 + a2 = Q2 , remainder a1
R
If we divide Q2 by R, then the remainder is a0
Q2 = a4xR1 + a3 = Q3 , remainder a2
R
and so on… until you get all coefficients
FIU-ECE-CEA
©2010 Cengage Learning
Conversion (b)
EXAMPLE: Convert .62510 to binary.
FIU-ECE-CEA
©2010 Cengage Learning
Conversion (c)
EXAMPLE: Convert 0.710 to binary.
FIU-ECE-CEA
©2010 Cengage Learning
Conversion (d)
EXAMPLE: Convert 231.34 to base 7.
FIU-ECE-CEA
©2010 Cengage Learning
Commonly used:
210=1K (1,024)
216= 64K (65,536)
220=1M (1,048,576)
230=1G (1,073,741,824)
FIU-ECE-CEA
©2010 Cengage Learning
Binary Hexadecimal
Conversion
Equation (1-1)
FIU-ECE-CEA
©2010 Cengage Learning
Exercise: Convert to decimal: DEC.A16
FIU-ECE-CEA
©2010 Cengage Learning
Addition (in binary)
The addition table for binary numbers is:
0+0=0
0+1=1
1+0=1
1 + 1 = 0 and carry 1 to the next column
Carrying 1 to a column is equivalent to adding 1 to that column.
Example:
Add 1310 and 1110
in binary.
FIU-ECE-CEA
©2010 Cengage Learning
Subtraction (a)
0–0=0
0 – 1 = 1 and borrow 1 from the next column
1–0=1
1–1=0
Borrowing 1 from a column is equivalent to subtracting 1 from that
column.
EXAMPLE:
FIU-ECE-CEA
©2010 Cengage Learning
Subtraction (b)
FIU-ECE-CEA
©2010 Cengage Learning
Subtraction (c)
A detailed analysis of the borrowing process for this
example, indicating first a borrow of 1 from column 1
and then a borrow of 1 from column 2, is as follows:
FIU-ECE-CEA
©2010 Cengage Learning
Multiplication (a)
FIU-ECE-CEA
©2010 Cengage Learning
Multiplication (b)
When doing binary multiplication, a common way to avoid
carries greater than 1 is to add in the partial products one at a
time as illustrated by the following example:
1111 multiplicand
1101 multiplier
1111 1st partial product
0000 2nd partial product
(01111) sum of first two partial products
1111 3rd partial product
(1001011) sum after adding 3rd partial product
1111 4th partial product
11000011 final product (sum after adding 4th partial product)
FIU-ECE-CEA
©2010 Cengage Learning
Binary Division
Binary division is similar to decimal division, except it
is much easier because the only two possible
quotient digits are 0 and 1.
We start division by comparing the divisor with the
upper bits of the dividend.
If we cannot subtract without getting a negative
result, we move one place to the right and try again.
If we can subtract, we place a 1 for the quotient
above the number we subtracted from and append
the next dividend bit to the end of the difference and
repeat this process with this modified difference until
we run out of bits in the dividend.
FIU-ECE-CEA
©2010 Cengage Learning
Binary Division (a)
This example illustrates division
of 14510 by 1110 in binary:
FIU-ECE-CEA
©2010 Cengage Learning
Binary Division (b)
Method 1:
Method 2:
FIU-ECE-CEA
©2010 Cengage Learning
Exercises:
a) Add, subtract and multiply:
1111 and 1001
FIU-ECE-CEA
©2010 Cengage Learning
3 Systems for representing negative
numbers in binary
I) Sign & Magnitude: Most significant bit is the sign
Ex: – 510 = 11012 (is awkward for arithmetic units)
FIU-ECE-CEA
©2010 Cengage Learning
2’s Complement Addition (a)
The addition is carried out just as if all the numbers were
positive and any carry from the sign position is ignored.
FIU-ECE-CEA
©2010 Cengage Learning
2’s Complement Addition (b)
FIU-ECE-CEA
©2010 Cengage Learning
2’s Complement Addition (c)
FIU-ECE-CEA
©2010 Cengage Learning
1’s Complement Addition (b)
The addition is similar to 2’s complement except that instead
of discarding the last carry, it is added to the n-bit sum in the
position furthest to the right.
FIU-ECE-CEA
©2010 Cengage Learning
1’s Complement Addition (c)
FIU-ECE-CEA
©2010 Cengage Learning
1’s Complement Addition (d)
(for n=8)
FIU-ECE-CEA
©2010 Cengage Learning
2’s Complement Addition (d)
(for n=8)
FIU-ECE-CEA
©2010 Cengage Learning
Binary Codes
FIU-ECE-CEA
©2010 Cengage Learning
ASCII Code in Matrix Form
FIU-ECE-CEA
©2010 Cengage Learning
ASCII Code: Control Character Meanings
FIU-ECE-CEA
©2010 Cengage Learning