Download as pdf or txt
Download as pdf or txt
You are on page 1of 35

CHAPTER 1

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

For the fraction part: F= a-1xR-1 + a-2xR-2 + a-3xR-3 +….


is the same process but multiply instead of dividing
FIU-ECE-CEA
©2010 Cengage Learning
Conversion (a)

EXAMPLE: Convert 5310 to binary.

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)

Conversion from binary to hexadecimal (and conversely)


can be done by inspection because each hexadecimal digit
corresponds to exactly four binary digits (bits).

FIU-ECE-CEA
©2010 Cengage Learning
Exercise: Convert to decimal: DEC.A16

Exercise: a) Convert to hexadecimal: 1,457.1110(round to 2 digits)


b) Convert the result to binary and octal
c) Devise a scheme to convert directly hexadecimal to base-4 and use it
for your answer in b)

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)

The subtraction table for binary numbers is

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)

EXAMPLES OF BINARY SUBTRACTION:

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)

The multiplication table 0x0=0


for binary numbers is: 0x1=0
1x0=0
1x1=1
Example of
multiplication of
1310 by 1110 in binary:

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

b) Add, subtract and multiply:


1101001 and 110110

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)

II) 1’s Complement: N = (2n – 1) - N


Ex: – 510 = (24 – 1) – 5 = 16 – 1 – 5 = 1010 = 10102
510 = 01012 (the easy way is to change 0’s for 1’s and 1’s for 0’s)

III) 2’s Complement: N* = 2n - N


Ex: – 510 = 24 – 5 = 16 – 5 = 1110 = 10112
Must be careful with the “overflow” when “adding” to avoid errors
FIU-ECE-CEA
©2010 Cengage Learning
Table 1-1: Signed Binary Integers (word length n = 4)

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

Although most large computers work internally with


binary numbers, the input-output equipment generally
uses decimal numbers. Because most logic circuits
only accept two-valued signals, the decimal numbers
must be coded in terms of binary signals. In the
simplest form of binary code, each decimal digit is
replaced by its binary equivalent. For example,
937.25 is represented by:

Section 1.5 (p. 21)


FIU-ECE-CEA
©2010 Cengage Learning
Table 1–2. Binary Codes for Decimal Digits
8-4-2-1
Decimal 6-3-1-1 Excess-3 2-out-of-5 Gray
Code
Digit Code Code Code Code
(BCD)
0 0000 0000 0011 00011 0000
1 0001 0001 0100 00101 0001
2 0010 0011 0101 00110 0011
3 0011 0100 0110 01001 0010
4 0100 0101 0111 01010 0110
5 0101 0111 1000 01100 1110
6 0110 1000 1001 10001 1010
7 0111 1001 1010 10010 1011
8 1000 1011 1011 10100 1001
9 1001 1100 1100 11000 1000
Only 2 bits Only 1 bit
Weighted Codes 3 plus 8421 can be “1” can change
FIU-ECE-CEA
©2010 Cengage Learning
ASCII Code: American Standard Code for Information Interchange

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

You might also like