CENG 121 Chapter 1
CENG 121 Chapter 1
Chapter 1 1
Overview
Chapter 1 2
DIGITAL & COMPUTER SYSTEMS - Digital
System
Discrete
Discrete
Information
Inputs
Discrete
Processing
Outputs
System
System State
Chapter 1 3
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 4
Digital System Example:
Count Up
Reset
0 0 1 3 5 6 4
Synchronous or Asynchronous?
Chapter 1 5
Digital Computer Example
Memory
Control
CPU Datapath
unit
Synchronous or
Asynchronous?
Chapter 1 6
And Beyond – Embedded Systems
Chapter 1 7
Embedded Systems
Chapter 1 8
INFORMATION REPRESENTATION - Signals
Chapter 1 9
Signal Examples Over Time
Time
Continuous in value
& time
Analog
Digital Discrete in
Chapter 1 10
Signal Example – Physical Quantity: Voltage
Threshold Region
Chapter 1 11
Binary Values: Other Physical Quantities
Chapter 1 12
NUMBER SYSTEMS – Representation
( )+ ( )
i j
(Number)r =
å Ai r å Aj r
i=0 j=-m
Chapter 1 13
Number Systems – Examples
Chapter 1 14
Special Powers of 2
10
2 (1024) is Kilo, denoted "K"
30
2 (1,073, 741,824)is Giga, denoted "G"
40
2 (1,099,511,627,776 ) is Tera, denoted “T"
Chapter 1 15
ARITHMETIC OPERATIONS - Binary
Arithmetic
Chapter 1 16
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 17
Multiple Bit Binary Addition
Chapter 1 18
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 19
Multiple Bit Binary Subtraction
Chapter 1 20
Binary Multiplication
0 1 11 2,048
1 2 12 4,096
2 4 13 8,192
3 8 14 16,384
4 16 15 32,768
5 32 16 65,536
6 64 17 131,072
7 128 18 262,144
8 256 19 524,288
9 512 20 1,048,576
10 1024 21 2,097,152
Chapter 1 22
Converting Binary to Decimal
Chapter 1 23
Converting Decimal to Binary
Method 1
• Subtract the largest power of 2 (see slide 14) that gives
a positive remainder and record the power.
• Repeat, subtracting from the prior remainder and
recording the power, until the remainder is zero.
• Place 1’s in the positions in the binary result
corresponding to the powers recorded; in all other
positions place 0’s.
Example: Convert 62510 to N2
Chapter 1 24
Commonly Occurring Bases
Binary 2 0,1
Octal 8 0,1,2,3,4,5,6,7
Decimal 10 0,1,2,3,4,5,6,7,8,9
Hexadecimal 16 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F
Chapter 1 25
Numbers in Different Bases
00 00000 00 00
01 00001 01 01
02 00010 02 02
03 00011 03 03
04 00100 04 04
05 00101 05 05
06 00110 06 06
07 00111 07 07
08 01000 10 08
09 01001 11 09
10 01010 12 0A
11 0101 1 13 0B
12 01100 14 0C
13 01101 15 0D
14 01110 16 0E
15 01111 17 0F
16 10000 20 10
Chapter 1 26
Conversion Between Bases
Method 2
To convert from one base to another:
1) Convert the Integer Part
Chapter 1 27
Conversion Details
Chapter 1 28
Example: Convert 46.687510 To Base 2
Convert 46 to Base 2
Chapter 1 31
Why Do Repeated Division and
Multiplication Work?
Divide the integer portion of the power series
on slide 13 by radix r. The remainder of this
division is A0, represented by the term A0/r.
Discard the remainder and repeat, obtaining
remainders A1, …
Multiply the fractional portion of the power
series on slide 13 by radix r. The integer part of
the product is A-1.
Discard the integer part and repeat, obtaining
integer parts A-2, …
This demonstrates the algorithm for any radix
r >1.
Chapter 1 32
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.
Binary to Octal (Hexadecimal):
• Group the binary digits into three (four) bit
groups starting at the radix point and going
both ways, padding with zeros as needed in
the fractional part.
• Convert each group of three bits to an octal
(hexadecimal) digit.
Chapter 1 33
Octal to Hexadecimal via Binary
Chapter 1 35
Binary Numbers and Binary Coding
Flexibility of representation
• Within constraints below, can assign any binary
combination (called a code word) to any data as long
as data is uniquely encoded.
Information Types
• Numeric
Must represent range of data needed
Very desirable to represent data such that simple,
straightforward computation for common arithmetic
operations permitted
Tight relation to binary numbers
• Non-numeric
Greater flexibility since arithmetic operations not applied.
Not tied to binary numbers
Chapter 1 36
Non-numeric Binary Codes
Blue 101
Code 100 is Indigo 110
Chapter 1 37
Number of Bits Required
Chapter 1 40
Binary Coded Decimal (BCD)
Chapter 1 41
Excess 3 Code and 8, 4, –2, –1 Code
Chapter 1 43
BCD Arithmetic
Given a BCD code, we use binary arithmetic to add the digits:
8 1000 Eight
+5 +0101 Plus 5
13 1101 is 13 (> 9)
Note that the result is MORE THAN 9, so must be
+5 +0101 Plus 5
13 1101 is 13 (> 9)
+0110 so add 6
Chapter 1 44
BCD Addition Example
Chapter 1 45
ALPHANUMERIC CODES - ASCII Character
Codes
American Standard Code for Information
Interchange (Refer to Table 1 -4 in the text)
This code is a popular code used to represent
information sent as character-based data. It uses
7-bits to represent:
• 94 Graphic printing characters.
• 34 Non-printing characters
Some non-printing characters are used for text
format (e.g. BS = Backspace, CR = carriage
return)
Other non-printing characters are used for record
marking and flow control (e.g. STX and ETX start
and end text areas).
Chapter 1 46
ASCII Properties
Chapter 1 47
PARITY BIT Error-Detection Codes
Chapter 1 48
4-Bit Parity Code Example
000 - 000
-
001 - 001
-
010 - 010
-
011 - 011
-
100 - 100
-
101 - 101
-
110 - 110
-
The codeword "1111" has even111
111 -
parity
- and the
codeword "1110" has odd parity. Both can be
used to represent 3-bit data.
Chapter 1 49
GRAY CODE – Decimal
0 0000 0000
1 0001 0001
2 0010 0011
3 0011 0010
4 0100 0110
5 0101 0111
6 0110 0101
7 0111 0100
8 1000 1100
9 1001 1101
Chapter 1 50
Optical Shaft Encoder
B 0
B 1
G 2
G 1
111 G 0
010 011
101
(a) Binary Code for Positions 0 through 7 (b) Gray Code for Positions 0 through 7
Chapter 1 51
Shaft Encoder (Continued)
Is this a problem?
Yes
Chapter 1 52
Shaft Encoder (Continued)
Is this a problem?
Chapter 1 53
UNICODE
Chapter 1 54
Terms of Use
All (or portions) of this material © 2008 by Pearson
Education,Inc.
Permission is given to incorporate this material or
adaptations thereof into classroom presentations and
handouts to instructors in courses adopting the latest
edition of Logic and Computer Design Fundamentals
as the course textbook.
These materials or adaptations thereof are not to be
sold or otherwise offered for consideration.
This Terms of Use slide or page is to be included within
the original materials or any adaptations thereof.
Chapter 1 55