lecture_2_Digital Co.. - My FIT (my.fit.edu)

Download Report

Transcript lecture_2_Digital Co.. - My FIT (my.fit.edu)

ECE- 1551
DIGITAL LOGIC
LECTURE 2: DIGITAL COMPUTER AND NUMBER
SYSTEMS
Assistant Prof. Fareena Saqib
Florida Institute of Technology
Fall 2016, 01/14/2016
What is a Digital System
A digital system is an interconnection of digital modules. To understand the operation of each
digital module, it is necessary to have a basic knowledge of digital circuits and their logical
function.
 Structure: The way components are interrelated
 a collection of interconnected digital modules designed to perform a particular service or function
 Function: The operation of each individual component as part of the structure
 Takes a set of discrete information inputs and discrete internal information (system state) and
generates a set of discrete information outputs.
Digital
Inputs
The quantization of a process can be performed
automatically by an analog‐to‐digital converter, a
device that forms a digital (discrete) representation of
a analog (continuous) quantity.
Analog
Inputs
ADC
Current
State
Digital
Processing
System
Digital
Outputs
Digital System and Binary Numbers
 Digital systems use just two discrete values and are therefore said to be binary.
 A binary digit, called a bit, has two values: 0 and 1.
 Discrete elements of information are represented with groups of bits called binary
codes.
 For example, the decimal digits 0 through 9 are represented in a digital system with a code of four bits (e.g.,
the number 7 is represented by 0111).
 How a pattern of bits is interpreted as a number depends on the code system in which it
resides.
 To make this distinction, we could write (0111) to indicate that the pattern 0111 is to be interpreted in a
binary system, and (0111) to indicate that the reference system is decimal.
 Then 0111 = 7 , which is not the same as (0111) , or one hundred eleven.
2
10
2
10
10
Thus, a digital system is a system that manipulates discrete elements of information
represented internally in binary form.
Numbers Systems
 Decimal Numbers
 Binary Numbers
 Octal and Hexadecimal Number Systems
 Converting Between Bases
 Converting Any Base to Decimal
 Converting Decimal to Any Base
 Converting Between Binary and Octal
 Converting Between Binary and Hexadecimal
Decimal Number System
 The standard numbers used in the US are base ten, this is the decimal number system.
This system uses ten different symbols to represent numbers. These symbols are 0, 1, 2,
3, 4, 5, 6, 7, 8, and 9. Each digit in a decimal number has a specific value. The number
7,392 is represented by 7 thousand, 3 hundreds, 9 tens, and 2 ones.
3
2
1
0
7 x 10 + 3 x10 + 9 x 10 + 2 x 10 = 7392
 Convention is to write numeric coefficients and from their position deduce powers of 10,
with powers increasing from right to left.
5
4
3
a5a4a3a2a1a0.a-1a-2a-3
2
1
0
-1
-2
-3
10 a5 + 10 a4 + 10 a3 + 10 a2 + 10 a1 + 10 a0 + 10 a-1 + 10 a-2 + 10 a-3
 Coefficients aj are any of the 10 digits (0,1,2,3,4,5,6,7,8,9)
 Subscript j value gives the place value. Hence the power of 10.
Binary Number System
 The number system typically used in digital logic will be base 2, this is the binary number
system. This system uses two different symbols to represent numbers, 0 and 1.
 The table below shows how the binary system progresses to more than three digits to
represent even one decimal digit.
Number System
Decimal
Binary
One
1
0001
Two
2
0010
Three
3
0011
Four
4
0100
Five
5
0101
Six
6
0110
Seven
7
0111
Eight
8
1000
Nine
9
1001
Ten
10
1010
Octal and Hexadecimal Number Systems
 Other useful number systems used in digital logic are octal and hexadecimal.
 Octal uses 8 symbols to represent numbers. These symbols are 0, 1, 2, 3, 4, 5, 6,
and 7. Hexadecimal uses 16 symbols to represent numbers. These symbols are 0, 1,
2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, and F.
 It can be hard to read 8 bits of binary. The 1’s and 0’s tend to blend together and it
can cause mistakes. Octal and hexadecimals can be used to condense long binary
strings into shorter hexadecimal values.
 F.g long strings of bits in the addresses, instructions, and data in digital systems.
 For example, B65F is used to represent 1011011001010000. (Will be discussed later in conversion
section)
Octal and Hexadecimal Number Systems
 The table below shows the progression used for octal and hexadecimal.
Number System
Decimal
Binary
Octal
Hexdecimal
One
1
0001
1
1
Two
2
0010
2
2
Three
3
0011
3
3
Four
4
0100
4
4
Five
5
0101
5
5
Six
6
0110
6
6
Seven
7
0111
7
7
Eight
8
1000
10
8
Nine
9
1001
11
9
Ten
10
1010
12
A
Eleven
11
1011
13
B
tweleve
12
1100
14
C
Thirteen
13
1101
15
D
Fourteen
14
1110
16
E
Fifteen
15
1111
17
F
Sixteen
16
10000
20
10
Conversion Between Bases
Conversion Between Bases
 The main source of confusion is when the conversion requires math in different
bases an example of this is below. (10)7 + (6)8 = (1101)2
 This demonstrates the difficulty of even adding two small numbers when using
different bases.
 A useful method is to convert the entire problem to base 10, and after the answer
has been found, convert the answer to the desired base.
 Converting Any Base to Decimal…
Conversion Between Bases:
1: Converting Any Base to Decimal
The conversion of a number in base r to decimal is done by expanding the number in a power series and
adding all the terms
Converting Any Base to Decimal: Binary to Decimal
 A useful word to describe the base of a number system is radix. The radix of a
decimal number is ten, and the radix of a binary number is two.
 Decimal system uses 10 digits, where as binary uses 2. That is, in binary system
coefficients can have only 2 values: 0 and 1.
j
 Each coefficient aj is multiplied by a power of the radix, e,g 2 and the results are
added to obtain the decimal equivalent
 For example, the decimal equivalent of the binary number 11010.11 is ??
4
3
2
1
0
-1
-2
1 * 2 + 1 * 2 + 0 * 2 + 1 * 2 + 0 * 2 + 1 * 2 + 1 * 2 = 26.75
Converting Any Base to Decimal: Binary to Decimal
Converting Any Base to Decimal
 There are many different number systems. In general, a number expressed in a
base‐r. system has coefficients multiplied by powers of r:
n
n-1
r an + r
m-2
r
n-2
an-1 + r
m-1
am-2 + r
2
1
m
 Coefficients aj range in value from 0 to r -1.
 (4021.2)5 =?
 (127.4)8 = ?
 (B65F)16 =?
-1
-2
-3
an-2 + ……+ r a2 + r a1 + r a0 + r a-1 + 10 a-2 + 10 a-3 +……+
am-1 + r am.
 Examples:
0
Conversion Between Bases:
2: Converting Decimal to any Base
For integer part by dividing the number and all successive
quotients by r and accumulating the remainders.
For fraction part by multiplying the number and all successive
fractions by r and accumulating the resulting integers.
Converting Decimal to any Base
 If the number includes a radix point, it is necessary to separate the number into an
integer part and a fraction part, since each part must be converted differently.
 The conversion of a decimal integer to a number in base r is done by dividing the
number and all successive quotients by r and accumulating the remainders.
 Example: Convert decimal 41 to binary.
Converting Decimal to Binary Base: Answer Slide
 Convert decimal 41 to binary. First, 41 is divided by 2 to give an integer quotient of
20 and a remainder of 12. Then the quotient is again divided by 2 to give a new
quotient and remainder. The process is continued until the integer quotient
becomes 0. The coefficients of the desired binary number are obtained from the
remainders as follows:
Converting Decimal to Octal Base: Example 2
 Convert decimal 153 to octal.
Converting Decimal to Octal Base: Answer Slide
Converting Decimal to Any Base: Numbers with Fractions
 Convert (0.6875)10 to binary. First, 0.6875 is multiplied by 2 to give an integer and a
fraction. Then the new fraction is multiplied by 2 to give a new integer and a new
fraction. The process is continued until the fraction becomes 0 or until the number
of digits has sufficient accuracy. The coefficients of the binary number are obtained
from the integers as follows:
Converting Decimal to Any Base: Summary
 Successive Quotients
 The method used to convert a decimal integer number to any other radix is called Successive
Quotients. This method uses a recursive algorithm.
 The integer column begins with the decimal number being converted. The second row is the first row
divided by the radix, the quotient on the left and the remainder on the right. This pattern is
continued until the quotient returns 0. The conversion is read least significant bit, LSB on the top.
The algorithm for this process is itemized below.
1. Divide the initial decimal number by the radix.
2. Place the remainder into the LSB (Least Significant Bit) digit of the converted result.
3. Divide the current quotient by the radix.
4. Place the remainder into the next LSB digit of the converted result.
5. Repeat Step 3 and 4 until the quotient is 0
Converting Decimal to Any Base: Summary
 Successive Products
 The process of converting decimal fractions is a similar recursive algorithm process.
1. Multiply the initial decimal fraction by the radix.
2. Place the integer into the MSB (Most Significant Bit) digit of the converted result.
3. Multiply the current fraction by the radix.
4. Place the integer into the next MSB digit of the converted result.
5. Repeat Step 3 and 4 until the fraction is 0 or the required number of bits have been converted.
Converting Decimal to Any Base: Numbers with Fractions
Example
 Convert (0.513)10 to octal:
 Convert (41.6875)10 to binary
 Convert (153.513)10 to octal
Quickly Converting Between Binary and Hexadecimal
 Conversion from and to binary, octal and hexadecimal helps shorter patterns of
octal and hex characters to recognize than long patterns of 1’s and 0’s.
3
4
 Since 2 =8 and 2 =16. Each octal digit corresponds to three binary digits and each
hexadecimal digit corresponds to four binary digits.
 To convert from binary to octal, first partition the binary number into group of three
digits each.
 Starting from the binary point and preceding from the left to the right.
 Corresponding octal digit is then assigned to each group.
 Example
(10 110 001 101 011 . 111 100 000 110)2
2 6
1
5
3
7
4
0
6
= (26153.7406)8
Quickly Converting Between Binary and Hexadecimal
 Conversion from binary to hexadecimal is similar, except binary number is divided
into groups of four digits:
 Example
(10
1100
2
C
0110 1011 . 1111 0010)2 =
6
B
F
2
(2C6B.F2)16
Next Class
 Study Number Systems – Signed and Unsigned numbers.