Professional Documents
Culture Documents
(Lecture) DigialSystems Chap01
(Lecture) DigialSystems Chap01
(Lecture) DigialSystems Chap01
Discrete Discrete
Inputs Information
Processing Discrete
System Outputs
System State
Chapter 1 4
DIGITAL & COMPUTER SYSTEMS –
Digital System
Chapter 1 5
Types of Digital Systems
▪ No state present
• Combinational Logic System
• Output = Function(Input)
▪ State present
• State updated at discrete times
=> Synchronous Sequential System
• State updated at any time
=>Asynchronous Sequential System
• State = Function (State, Input)
• Output = Function (State)
or Function (State, Input)
Chapter 1 6
Digital System Example:
Count Up
Reset 0 0 1 3 5 6 4
Synchronous or Asynchronous?
Chapter 1 7
Digital Computer Example
Memory
Control
CPU unit Datapath
• Microcontrollers
• Digital signal processors
Chapter 1 9
Embedded Systems
Chapter 1 10
Information Representation
Continuous vs. Discrete Signals
Chapter 1 12
Signal Examples Over Time
Time
Continuous in
Analog value & time
Digital Discrete in
value &
Asynchronous continuous in
time
Discrete in value
Synchronous & time
Chapter 1 13
INFORMATION REPRESENTATION - Signals
Chapter 1 14
Signal Example – Physical Quantity: Voltage
Threshold Region
Chapter 1 15
Number Systems
NUMBER SYSTEMS – Representation
Chapter 1 17
NUMBER SYSTEMS – Representation
( ) ( )
i=n-1 j = -1
(Number)r = Ai ri + Aj r j
i=0 j = -m
(Integer Portion) + (Fraction Portion)
Chapter 1 18
Number Systems – Examples
Chapter 1 19
NUMBER SYSTEMS – Representation
▪ A base 5 number:
(312.4)5 = 3 x 52 + 1 x 51 + 2 x 50 + 4 x 5-1
= 75 + 5 + 2 + 0.8 = (82.8)10
▪ A binary number:
(11010)2 = 1 x 24 + 1 x 23 + 0 x 22 + 1 x 21 + 0 x 20
= 16 + 8 + 0 + 2 + 0 = (26)10
Chapter 1 20
Powers of 2
Chapter 1 21
Special Powers of 2
Chapter 1 22
Arithmetic Operation
ARITHMETIC OPERATIONS –
Binary Arithmetic
▪ Single Bit Addition with Carry
▪ Multiple Bit Addition
▪ Single Bit Subtraction with Borrow
▪ Multiple Bit Subtraction
▪ Multiplication
▪ BCD Addition
Chapter 1 24
Single Bit Binary Addition
Chapter 1 25
Single Bit Binary Addition with Carry
• Carry in (Z) of 1: Z 1 1 1 1
X 0 0 1 1
+Y +0 +1 +0 +1
CS 01 10 10 11
Chapter 1 26
Multiple Bit Binary Addition
Chapter 1 27
Single Bit Binary Subtraction with Borrow
▪ Given two binary digits (X,Y), a borrow in (Z) we get
the following difference (S) and borrow (B):
▪ Borrow in (Z) of 0: Z 0 0 0 0
X 0 0 1 1
-Y -0 -1 -0 -1
BS
▪ Borrow in (Z) of 1: Z 1 1 1 1
X 0 0 1 1
-Y -0 -1 -0 -1
BS
Chapter 1 28
Single Bit Binary Subtraction with Borrow
▪ Given two binary digits (X,Y), a borrow in (Z) we get
the following difference (S) and borrow (B):
▪ Borrow in (Z) of 0: Z 0 0 0 0
X 0 0 1 1
-Y -0 -1 -0 -1
BS 00 11 01 00
▪ Borrow in (Z) of 1: Z 1 1 1 1
X 0 0 1 1
-Y -0 -1 -0 -1
BS
Chapter 1 29
Single Bit Binary Subtraction with Borrow
▪ Given two binary digits (X,Y), a borrow in (Z) we get
the following difference (S) and borrow (B):
▪ Borrow in (Z) of 0: Z 0 0 0 0
X 0 0 1 1
-Y -0 -1 -0 -1
BS 00 11 01 00
▪ Borrow in (Z) of 1: Z 1 1 1 1
X 0 0 1 1
-Y -0 -1 -0 -1
BS 11 10 00 11
Chapter 1 30
Multiple Bit Binary Subtraction
Chapter 1 31
Multiple Bit Binary Subtraction
Chapter 1 32
Multiple Bit Binary Subtraction
Chapter 1 33
Multiple Bit Binary Subtraction
Chapter 1 34
Multiple Bit Binary Subtraction
Chapter 1 35
Binary Multiplication
Chapter 1 36
Binary Multiplication
Chapter 1 37
Binary Multiplication
Chapter 1 38
Binary Multiplication
Chapter 1 39
Binary Multiplication
Chapter 1 40
Base Conversion
Converting Binary to Decimal
Chapter 1 42
Converting Binary to Decimal
Chapter 1 44
Converting Decimal to Binary
Chapter 1 45
Converting Decimal to Binary
Chapter 1 46
Converting Decimal to Binary
9876543210
1001110001
Chapter 1 47
BASE CONVERSION - Positive Powers of 2
Chapter 1 52
Conversion Between Bases
Chapter 1 53
Conversion Details
Chapter 1 54
Conversion Details
Chapter 1 55
Convert 46.6875 to Base 2
▪ Convert 46 to Base 2:
Chapter 1 56
Convert 46.6875 to Base 2
▪ Convert 46 to Base 2:
46 / 2 = 23 : remainder = 0
23 / 2 = 11 : remainder = 1
11 / 2 = 5 : remainder = 1
5 / 2 = 2 : remainder = 1
2 / 2 = 1 : remainder = 0
1 / 2 = 0 : remainder = 1
Chapter 1 57
Convert 46.6875 to Base 2
▪ Convert 46 to Base 2:
46 / 2 = 23 : remainder = 0
23 / 2 = 11 : remainder = 1
11 / 2 = 5 : remainder = 1
5 / 2 = 2 : remainder = 1
2 / 2 = 1 : remainder = 0
1 / 2 = 0 : remainder = 1
Chapter 1 58
Convert 46.6875 to Base 2
Chapter 1 59
Convert 46.6875 to Base 2
Chapter 1 60
Convert 46.6875 to Base 2
Chapter 1 61
Additional Issue - Fractional Part
Chapter 1 63
Convert 153.513 to Octal
Chapter 1 64
Convert 153.513 to Octal
Chapter 1 65
Convert 153.513 to Octal
Chapter 1 66
Checking the Conversion
Chapter 1 67
Why Do Repeated Division and
Multiplication Work?
Chapter 1 68
Octal (Hexadecimal) to Binary and
Back
▪ Octal (Hexadecimal) to Binary:
• Restate the octal (hexadecimal) as three (four) binary
digits starting at the radix point and going both ways
• Example: 2618 = 010 110 0012
Chapter 1 69
Octal to Hexadecimal via Binary
Chapter 1 70
Octal to Hexadecimal via Binary
Chapter 1 71
Octal to Hexadecimal via Binary
Chapter 1 72
Octal to Hexadecimal via Binary
Chapter 1 73
Decimal Codes
Binary vs. Decimal
Chapter 1 75
Binary Coding
Chapter 1 76
Binary Coded Decimal (BCD)
▪ Example:
• 1001 (9) = 1000 (8) + 0001 (1)
• 396 = 0011 1001 0110
Chapter 1 77
Binary Coded Decimal (BCD)
Chapter 1 78
Binary Coded Decimal (BCD)
Chapter 1 79
Binary Codes for Decimal Digits
▪ There are over 8,000 ways that you can choose 10 elements
from the 16 binary numbers of 4 bits
▪ A few are useful:
Decimal 8,4,2,1 Excess3 8,4,-2,-1 Gray
0 0000 0011 0000 0000
1 0001 0100 0111 0100
2 0010 0101 0110 0101
3 0011 0110 0101 0111
4 0100 0111 0100 0110
5 0101 1000 1011 0010
6 0110 1001 1010 0011
7 0111 1010 1001 0001
8 1000 1011 1000 1001
9 1001 1100 1111 1000
Chapter 1 80
Excess 3 Code and 8, 4, –2, –1 Code
Chapter 1 82
Number of Bits Required
▪ Examples:
• You can represent 4 elements in radix r = 2 with n = 2
digits: (00, 01, 10, 11).
• You can represent 4 elements in radix r = 2 with n = 4
digits: (0001, 0010, 0100, 1000).
• This second code is called a "one hot" code
Chapter 1 84
Warning: Conversion or Coding?
Chapter 1 85
BCD Arithmetic
▪ If the digit sum is > 9, add one to the next significant digit
Chapter 1 86
BCD Addition Example
1897BCD 0
0001 1000 1001 0111
+ 0010 1001 0000 0101
2905BCD
Chapter 1 87
BCD Addition Example
1 1 1 0
0001 1000 1001 0111
+ 0010 1001 0000 0101
0100 10010 1010 1100
+ 0000 0110 0110 0110
0100 1000 0000 0010
Chapter 1 88
BCD Addition Example
1 1 1 0
0001 1000 1001 0111
+ 0010 1001 0000 0101
0100 10010 1010 1100
+ 0000 0110 0110 0110
0100 1000 0000 0010
Chapter 1 89
BCD Addition Example
1 1 1 0
0001 1000 1001 0111
+ 0010 1001 0000 0101
0100 10010 1010 1100
+ 0000 0110 0110 0110
0100 1000 0000 0010
Chapter 1 90
BCD Addition Example
1 1 1 0
0001 1000 1001 0111
+ 0010 1001 0000 0101
0100 10010 1010 1100
+ 0000 0110 0110 0110
0100 1000 0000 0010
Chapter 1 91
Alphanumeric Codes
Alphanumeric Codes
Chapter 1 93
ASCII Character Codes
Chapter 1 94
ASCII Character Codes
Chapter 1 95
ASCII Properties
Chapter 1 96
Gray Codes
GRAY CODE – Decimal
G2
G1
111 G0
101 010 011
Chapter 1 100
Shaft Encoder
▪ Is this a problem?
• Yes, the position is completely unknown
Chapter 1 101
Shaft Encoder
▪ Is this a problem?
• No, the position is either 3 or 4, which is OK since it is
halfway in between Chapter 1 102
Shaft Encoder
Chapter 1 103
UNICODE
Chapter 1 104
Parity Bit
PARITY BIT Error-Detection Codes