SlideShare a Scribd company logo
1 of 92
Chapter 1 1
COE 200
Introduction
Chapter 1 2
Outline
 Course Introduction
•Course Information
•Textbook
•Grading
•Important Dates
•Course Outline
Chapter 1 3
Course Information
 Instructor: Rabie A. Ramadan, PhD
 Email: ra.ramadan@uoh.edu.sa
 Homepage: http://rabieramadan.org/classes/2015-
2016/COE200
 Office: Computer Engineering S259
 Office Hours
Mon 2- 4:00
Chapter 1 4
Textbook
 Logic and Computer Design
Fundamentals, M. Morris Mano and
Charles R. Kime (4th edition, 2008).
Prentice Hall.
 http://www.writphotec.com/mano4/
Chapter 1 5
Grading Information
 Grading
 Laboratory 15%
 Class work & Quizzes 10%
 Exam 1 15%
 Exam 2 15%
 Final 45%
 Policies
• Attendance is required
• All submitted work must be yours
• Cheating will not be tolerated
• Homeworks are due cy deadline – no extensions will be
provided - Blackboard
Chapter 1 6
Course Content
• Digital Systems and Information
• Combinational Logic Circuits
• Combinational Logic Design
 First Exam
• Arithmetic Functions and HDLs
• Sequential Circuits
• Selected Design Topics
 Second Exam
• Registers and Register Transfers
• Memory Basics
Final Exam
Class Style
 Do not think of the exam
• Just think of the class materials and how much you
learn from it
 Feel free to stop me at any time
• I do not care how much I teach in class as long as you
understand what I am saying
 There will be an interactive sessions in
class
 you solve some of the problems with my help
Chapter 1 7
When the time is up , just let me know….
Chapter 1 8
Chapter 1 9
Charles Kime & Thomas Kaminski
© 2008 Pearson Education, Inc.
(Hyperlinks are active in View Show mode)
Chapter 1 – Digital Systems
and Information
Logic and Computer Design Fundamentals
Chapter 1 11
Overview
 Introduction to Digital Systems
 Information Representation
 Number Systems [binary, octal and hexadecimal]
 Arithmetic Operations
 Base Conversion
 Decimal Codes [Binary Coded Decimal (BCD)]
 Gray Codes
 Alphanumeric Codes
 Parity Bit
Chapter 1 12
DIGITAL & COMPUTER SYSTEMS
 Takes a set of discrete information inputs and discrete
internal information (system state) and generates a set of
discrete information outputs.
System State
Discrete
Information
Processing
System
Discrete
Inputs Discrete
Outputs
Chapter 1 13
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, Input)
Chapter 1 14
Digital System Example:
A Digital Counter (e. g., odometer):
1 3
0 0 5 6 4
Count Up
Reset
Inputs: Count Up, Reset
Outputs: Visual Display
State: "Value" of stored digits
Chapter 1 15
INFORMATION REPRESENTATION - Signals
 Information variables represented by physical quantities.
 For digital systems, the variables take on discrete values.
 Two level, or binary values are the most prevalent values
in digital systems.
 Binary values are represented abstractly by:
• digits 0 and 1
• words (symbols) False (F) and True (T)
• words (symbols) Low (L) and High (H)
• and words On and Off.
 Binary values are represented by values or ranges of
values of physical quantities
Chapter 1 16
Signal Examples Over Time
Analog
Asynchronous
Synchronous
Time
Continuous
in value &
time
Discrete in
value &
continuous
in time
Discrete in
value & time
Digital
Chapter 1 17
Signal Example – Physical Quantity: Voltage
Threshold
Region
Chapter 1 18
NUMBER SYSTEMS – Representation
 Positive radix, positional number systems
 A number with radix r is represented by a
string of digits:
An - 1An - 2 … A1A0 . A- 1 A- 2 … A- m + 1 A- m
in which 0 Ai < r and . is the radix point.
 The string of digits represents the power series:
( ) ( )
(Number)r= 
 +
j = - m
j
j
i
i = 0
i r
A
r
A
(Integer Portion) + (Fraction Portion)
i = n - 1 j = - 1
Chapter 1 19
Number Systems – Examples
General Decimal Binary
Radix (Base) r 10 2
Digits 0 => r - 1 0 => 9 0 => 1
0
1
2
3
Powers of 4
Radix 5
-1
-2
-3
-4
-5
r0
r1
r2
r3
r4
r5
r -1
r -2
r -3
r -4
r -5
1
10
100
1000
10,000
100,000
0.1
0.01
0.001
0.0001
0.00001
1
2
4
8
16
32
0.5
0.25
0.125
0.0625
0.03125
Chapter 1 20
Special Powers of 2
 210 (1024) is Kilo, denoted "K"
 220 (1,048,576) is Mega, denoted "M"
 230 (1,073, 741,824) is Giga, denoted "G"
 240 (1,099,511,627,776) is Tera, denoted “T"
Chapter 1 21
ARITHMETIC OPERATIONS - Binary
Arithmetic
 Single Bit Addition with Carry
 Multiple Bit Addition
 Single Bit Subtraction with Borrow
 Multiple Bit Subtraction
 Multiplication
 BCD Addition
2-22 5
Aha!
642 is 600 + 40 + 2 in BASE 10
The base of a number determines the number of digits and the
value of digit positions
Natural Numbers
2-23 6
Continuing with our example…
642 in base 10 positional notation is:
6 x 10² = 6 x 100 = 600
+ 4 x 10¹ = 4 x 10 = 40
+ 2 x 10º = 2 x 1 = 2 = 642 in base 10
This number is in
base 10
The power indicates
the position of
the number
Positional Notation
2-24 7
Positional Notation
2-25 6
8
What if 642 has the base of 13?
642 in base 13 is equivalent to 1068 in base 10
+ 6 x 13² = 6 x 169 = 1014
+ 4 x 13¹ = 4 x 13 = 52
+ 2 x 13º = 2 x 1 = 2
= 1068 in base 10
Positional Notation
2-26 9
Decimal is base 10 and has 10 digits:
0,1,2,3,4,5,6,7,8,9
Binary is base 2 and has 2 digits:
0,1
For a number to exist in a given number system, the
number system must include those digits. For example:
The number 284 only exists in base 9 and higher.
Binary
2-27 10
How are digits in bases higher than 10
represented?
Base 16:
0,1,2,3,4,5,6,7,8,9,A,B,C,D,E, and F
Bases Higher than 10
2-28
What is the decimal equivalent of the octal number
642?
6 x 8² = 6 x 64 = 384
+ 4 x 8¹ = 4 x 8 = 32
+ 2 x 8º = 2 x 1 = 2
= 418 in base 10
11
Converting Octal to Decimal
2-29
What is the decimal equivalent of the hexadecimal number
DEF?
D x 16² = 13 x 256 = 3328
+ E x 16¹ = 14 x 16 = 224
+ F x 16º = 15 x 1 = 15
= 3567 in base 10
Remember, base 16 is 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F
Converting Hexadecimal to Decimal
2-30
What is the decimal equivalent of the binary number 010110?
1 x 2
6
= 1 x 64 = 64
+ 1 x 2
5
= 1 x 32 = 32
+ 0 x 2
4
= 0 x 16 = 0
+ 1 x 2
3
= 1 x 8 = 8
+ 1 x 2
2
= 1 x 4 = 4
+ 1 x 2
1
= 1 x 2 = 2
+ 0 x 2º = 0 x 1 = 0
= 112 in base 10
13
Converting Binary to Decimal
Binary Addition
Chapter 1 31
Addition
 From right to left, we add each pair of digits
 We write the sum, and add the carry to the
next column on the left
1 9 8
+ 2 6 4
Sum
Carry
0 1 1
+ 0 0 1
Sum
Carry
2
1
6
1
4
0
0
1
0
1
1
0
Chapter 1 32
Binary Sums and Carries
a b Sum a b Carry
0 0 0 0 0 0
0 1 1 0 1 0
1 0 1 1 0 0
1 1 0 1 1 1
XOR AND
Chapter 1 33
Binary Addition (cont.)
Chapter 1 34
Binary Subtraction
Chapter 1 35
Binary Subtraction (cont.)
Chapter 1 36
One’s Complement
 The additive inverse of a one’s complement
representation is found by inverting each
bit.
 Inverting each bit is also called taking the
one’s complement
Chapter 1 37
Example
0000 0011 (3)
1111 1100 (-3)
1110 1000 (-23)
0001 0111 (23)
0000 0000 (0)
1111 1111 (0)
Note: There are two
representations of zero
Chapter 1 38
Two’s complement
 The additive inverse of a two’s complement
integer can be obtained by adding 1 to its
one’s complement
Chapter 1 39
Example
010001 (17) 1101000 (-24)
101110 0010111
1 1
------ -------
101111 (-17) 0011000 (24)
take the 1’s complement
Chapter 1 40
Subtracting the large number from the
small number
Chapter 1 41
Subtracting the large number from the
small number
Chapter 1 42
Subtracting the large number from the
small number
Chapter 1 43
Group Activity
Chapter 1 44
Group Activity
Chapter 1 45
Multiplication (decimal)
143
130
13
11
13
+

Chapter 1 46
Chapter 1 47
Binary Multiplication
The binary multiplication table is simple:
0  0 = 0 | 1  0 = 0 | 0  1 = 0 | 1  1 = 1
Extending multiplication to multiple digits:
Multiplicand 1011
Multiplier x 101
Partial Products 1011
0000 -
1011 - -
Product 110111
Multiplication (binary)
10001111
1101000
11010
1101
1011
1101
+

Chapter 1 48
Multiplication (binary)
10001111
1101000
11010
1101
1011
1101
+

It’s interesting to note that binary
multiplication is a sequence of shifts
and adds of the first term (depending
on the bits in the second term.
110100 is missing here because the
corresponding bit in the second
terms is 0.
Chapter 1 49
Chapter 1 50
 Useful for Base Conversion
Exponent Value Exponent Value
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
19 524,288
20 1,048,576
21 2,097,152
8 256
9 512
10 1024
BASE CONVERSION - Positive Powers of 2
Chapter 1 51
 To convert to decimal, use decimal
arithmetic to form S (digit × respective
power of 2).
 Example: Convert 110102 to N10:
Converting Binary to Decimal
Decimal to Binary Conversion
 Converting to binary – can’t use polynomial
evaluation!
 Whole part and fractional parts must be
handled separately!
• Whole part: Use repeated division.
• Fractional part: Use repeated multiplication.
• Combine results when finished.
Chapter 1 52
Decimal to Binary Conversion
(Whole Part: Repeated Division)
 Divide by target radix (2 in this case)
 Remainders become digits in the new
representation (0 <= digit < R)
 Digits produced in right to left order.
 Quotient is used as next dividend.
 Stop when the quotient becomes zero, but
use the corresponding remainder.
Chapter 1 53
Decimal to Binary Conversion
(Whole Part: Repeated Division)
97  2  quotient = 48, remainder = 1 (LSB)
48  2  quotient = 24, remainder = 0.
24  2  quotient = 12, remainder = 0.
12  2  quotient = 6, remainder = 0.
6  2  quotient = 3, remainder = 0.
3  2  quotient = 1, remainder = 1.
1  2  quotient = 0 (Stop) remainder = 1 (MSB)
Result = 1 1 0 0 0 0 12
Chapter 1 54
Decimal to Binary Conversion
(Fractional Part: Repeated Multiplication)
• Multiply by target radix (2 in this case)
• Whole part of product becomes digit in the
new representation (0 <= digit < R)
• Digits produced in left to right order.
• Fractional part of product is used as next
multiplicand.
• Stop when the fractional part becomes zero
(sometimes it won’t).
Chapter 1 55
Decimal to Binary Conversion
(Fractional Part: Repeated Multiplication)
.1  2  0.2 (fractional part = .2, whole part = 0)
.2  2  0.4 (fractional part = .4, whole part = 0)
.4  2  0.8 (fractional part = .8, whole part = 0)
.8  2  1.6 (fractional part = .6, whole part = 1)
.6  2  1.2 (fractional part = .2, whole part = 1)
Result = .000110001100011000112…..
(How much should we keep?)
Regardless of the number of digits , multiply them
by 2
Chapter 1 56
Counting in Binary
Dec Binary
0 0000
1 0001
2 0010
3 0011
4 0100
5 0101
6 0110
7 0111
Note the pattern!
•LSB (bit 0) toggles on every count.
•Bit 1 toggles on every second
count.
•Bit 2 toggles on every fourth count.
•Etc….
Chapter 1 57
Representation Rollover
 Consequence of fixed precision.
 Computers use fixed precision!
 Digits are lost on the left-hand end.
 Remaining digits are still correct.
 Rollover while counting . . .
Up: “999999”  “000000” (Rn-1  0)
Down: “000000”  “999999” (0  Rn-1 )
Chapter 1 58
2.59
• We need to know how to convert a number in one
system to the equivalent number in another system.
• Since the decimal system is more familiar than the
other systems, we first show how to covert from any
base to decimal.
• Then we show how to convert from decimal to any
base.
• Finally, we show how we can easily convert from
binary to hexadecimal or octal and vice versa.
Conversion Summary
2.60
Any base to decimal conversion
Figure 2.5 Converting other bases to decimal
2.61
Example
The following shows how to convert the binary
number (110.11)2 to decimal: (110.11)2 = 6.75.
The following shows how to convert the hexadecimal
number (1A.23)16 to decimal.
Note that the result in the decimal notation is not exact,
because
3 × 16
−2
= 0.01171875. We have rounded this value to
three digits (0.012).
Example
Chapter 1 62
The following shows how to convert (23.17)
8
to
decimal.
This means that (23.17)8 ≈ 19.234 in decimal. Again,
we have rounded up 7 × 8
−2
= 0.109375.
Example
Chapter 1 63
Decimal to any base
Chapter 1 64
The following shows how to convert 35 in decimal to
binary. We start with the number in decimal, we
move to the left while continuously finding the
quotients and the remainder of division by 2. The
result is 35 = (100011)2.
Example
Chapter 1 65
2.66
The following shows how to convert 126 in decimal to its
equivalent in the octal system. We move to the right while
continuously finding the quotients and the remainder of division
by 8. The result is 126 = (176)8.
Example
2.67
The following shows how we convert 126 in decimal to its
equivalent in the hexadecimal system. We move to the
right while continuously finding the quotients and the
remainder of division by 16. The result is 126 = (7E)16
Example
2.68
Converting the fractional part of a number in decimal to
other bases
2.69
Convert the decimal number 0.625 to binary.
Since the number 0.625 = (0.101)2 has no integral part, the
example shows how the fractional part is calculated.
Example
The following shows how to convert 0.634 to octal
using a maximum of four digits. The result is 0.634 =
(0.5044)8. Note that we multiple by 8 (base octal).
Example
Chapter 1 70
2.71
The following shows how to convert 178.6 in decimal to
hexadecimal using only one digit to the right of the decimal point.
The result is 178.6 = (B2.9)16 Note that we divide or multiple by
16 (base hexadecimal).
Example
2.72
An alternative method for converting a small decimal
integer (usually less than 256) to binary is to break the
number as the sum of numbers that are equivalent to the
binary place values shown:
Example
2.73
A similar method can be used to convert a decimal fraction
to binary when the denominator is a power of two:
The answer is then (0.011011)2
Example
2.74
Show the hexadecimal equivalent of the binary number
(110011100010)2.
Solution
We first arrange the binary number in 4-bit patterns:
1100 1110 0010
Note that the leftmost pattern can have one to four bits.
Example
2.75
What is the binary equivalent of (24C)16?
Solution
Each hexadecimal digit is converted to 4-bit patterns:
2 → 0010, 4 → 0100, and C → 1100
The result is (001001001100)2.
Example
2.76
Show the octal equivalent of the binary number
(101110010)2.
Solution
Each group of three bits is translated into one
octal digit.
The result is (562)8.
101 110 010
Example
2.77
What is the binary equivalent of for (24)8?
Solution
Write each octal digit as its equivalent bit pattern to
get
2 → 010 and 4 → 100
The result is (010100)2.
Example
2.78
Octal-hexadecimal conversion
Octal to hexadecimal and hexadecimal to octal conversion
Chapter 1 79
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 80
 Given n binary digits (called bits), a binary code
is a mapping from a set of represented elements
to a subset of the 2n binary numbers.
 Example: A
binary code
for the seven
colors of the
rainbow
 Code 100 is
not used
Non-numeric Binary Codes
Binary Number
000
001
010
011
101
110
111
Color
Red
Orange
Yellow
Green
Blue
Indigo
Violet
Chapter 1 81
Number of Elements Represented
 Given n digits in radix r, there are rn
distinct elements that can be represented.
 But, you can represent m elements, m <
rn
 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, 0011, 1000).
• This second code is called a "one hot" code.
Chapter 1 82
DECIMAL CODES - Binary Codes for Decimal
Digits
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
 There are over 8,000 ways that you can chose 10 elements
from the 16 binary numbers of 4 bits. A few are useful:
Chapter 1 83
 What special property does the Gray code have
in relation to adjacent decimal digits?
GRAY CODE – Decimal
Decimal 8,4,2,1 Gray
0 0000 0000
1 0001 0100
2 0010 0101
3 0011 0111
4 0100 0110
5 0101 0010
6 0110 0011
7 0111 0001
8 1000 1001
9 1001 1000
Chapter 1 83
Chapter 1 84
UNICODE
 UNICODE extends ASCII to 65,536
universal characters codes
• For encoding characters in world languages
• Available in many modern applications
• 2 byte (16-bit) code words
• See Reading Supplement – Unicode on the
Companion Website
http://www.prenhall.com/mano
Chapter 1 84
Chapter 1 85
PARITY BIT Error-Detection Codes
 Redundancy (e.g. extra information), in the
form of extra bits, can be incorporated into
binary code words to detect and correct errors.
 A simple form of redundancy is parity, an extra
bit appended onto the code word to make the
number of 1’s odd or even. Parity can detect all
single-bit errors and some multiple-bit errors.
 A code word has even parity if the number of
1’s in the code word is even.
 A code word has odd parity if the number of
1’s in the code word is odd.
Chapter 1 86
4-Bit Parity Code Example
 Fill in the even and odd parity bits:
 The codeword "1111" has even parity and the
codeword "1110" has odd parity. Both can be
used to represent 3-bit data.
Even Parity Odd Parity
Message- Parity Message- Parity
000 - 000 -
001 - 001 -
010 - 010 -
011 - 011 -
100 - 100 -
101 - 101 -
110 - 110 -
111 - 111 -
Binary-Coded Decimal (BCD)
• a BCD number is just a natural binary encoding of the
decimal digits from 0 to 9 on four bits.
0101 0111
59 in BCD (0 ~ 99)
because there are unused code words
87 in normal unsigned binary number (0 ~ 255)
Chapter 1 87
Binary-Coded Decimal (BCD)
• Binary-Coded Decimal is a weighted code because each
decimal digit can be obtained from its code word by
assigning a fixed weight to each code-word bit.
• The weights for the BCD bits are 8, 4, 2, and 1, and for this
reason the code is sometimes called the 8421 code.
Chapter 1 88
Excess-3 code
• This code is also self-complementing like 2421
code.
• Although this code is not weighted, it has an
arithmetic relationship with the BCD code.
• The code word for each decimal digit is the
corresponding BCD code word plus 0011
2
.
0010 = 2 in BCD
+ 00112
= 0101 = 2 in excess-3
Chapter 1 89
Gray Code
• Gray code is a code where only one bit changes at
a time while traversing from 0 to any decimal
number in sequence.
• This is a useful property when converting analog
values into digital values, since it eliminates the
problem of misinterpreting asynchronous changes
to bits between valid values.
Chapter 1 90
Gray Code
Chapter 1 91
Parity check
• One of the most common ways to achieve error detection is by means of a parity bit.
• A parity bit is an extra bit included with a message to make the total number of 1’s
transmitted either odd or even.
• If an odd parity is adopted, the P bit is chosen such that the total number of 1’s is odd.
Chapter 1 92

More Related Content

What's hot

Chapter 1 digital systems and binary numbers
Chapter 1 digital systems and binary numbersChapter 1 digital systems and binary numbers
Chapter 1 digital systems and binary numbersMohammad Bashartullah
 
digital logic design number system
digital logic design number systemdigital logic design number system
digital logic design number systemNallapati Anindra
 
Number system and their conversion
Number system and their conversionNumber system and their conversion
Number system and their conversionRam Pratap Singh
 
Logic Design 2009
Logic Design 2009Logic Design 2009
Logic Design 2009lionking
 
Data representation moris mano ch 03
Data representation   moris mano ch  03Data representation   moris mano ch  03
Data representation moris mano ch 03thearticlenow
 
Lec 02 data representation part 1
Lec 02 data representation part 1Lec 02 data representation part 1
Lec 02 data representation part 1Abdul Khan
 
data representation
 data representation data representation
data representationHaroon_007
 
ACIT Mumbai - CCNA Training Coourse- IP ADDRESS ASSIGNMENT
ACIT Mumbai - CCNA Training Coourse- IP ADDRESS ASSIGNMENTACIT Mumbai - CCNA Training Coourse- IP ADDRESS ASSIGNMENT
ACIT Mumbai - CCNA Training Coourse- IP ADDRESS ASSIGNMENTSleek International
 
Lec 02 data representation part 2
Lec 02 data representation part 2Lec 02 data representation part 2
Lec 02 data representation part 2Abdul Khan
 
Digital notes
Digital notesDigital notes
Digital notesstivengo2
 
Module 1 number systems and code1
Module 1  number systems and code1Module 1  number systems and code1
Module 1 number systems and code1Deepak John
 
Mba admission in india
Mba admission in indiaMba admission in india
Mba admission in indiaEdhole.com
 

What's hot (20)

Chapter 1 digital systems and binary numbers
Chapter 1 digital systems and binary numbersChapter 1 digital systems and binary numbers
Chapter 1 digital systems and binary numbers
 
digital logic design number system
digital logic design number systemdigital logic design number system
digital logic design number system
 
Number systems ppt
Number systems pptNumber systems ppt
Number systems ppt
 
Okkkkk
OkkkkkOkkkkk
Okkkkk
 
Number system and their conversion
Number system and their conversionNumber system and their conversion
Number system and their conversion
 
Logic Design 2009
Logic Design 2009Logic Design 2009
Logic Design 2009
 
Bolum1cozumler
Bolum1cozumlerBolum1cozumler
Bolum1cozumler
 
06 floating point
06 floating point06 floating point
06 floating point
 
Data representation moris mano ch 03
Data representation   moris mano ch  03Data representation   moris mano ch  03
Data representation moris mano ch 03
 
Logic Design
Logic DesignLogic Design
Logic Design
 
Lec 02 data representation part 1
Lec 02 data representation part 1Lec 02 data representation part 1
Lec 02 data representation part 1
 
dld 01-introduction
dld 01-introductiondld 01-introduction
dld 01-introduction
 
data representation
 data representation data representation
data representation
 
ACIT Mumbai - CCNA Training Coourse- IP ADDRESS ASSIGNMENT
ACIT Mumbai - CCNA Training Coourse- IP ADDRESS ASSIGNMENTACIT Mumbai - CCNA Training Coourse- IP ADDRESS ASSIGNMENT
ACIT Mumbai - CCNA Training Coourse- IP ADDRESS ASSIGNMENT
 
Lec 02 data representation part 2
Lec 02 data representation part 2Lec 02 data representation part 2
Lec 02 data representation part 2
 
Digital notes
Digital notesDigital notes
Digital notes
 
L2 number
L2 numberL2 number
L2 number
 
Module 1 number systems and code1
Module 1  number systems and code1Module 1  number systems and code1
Module 1 number systems and code1
 
Computer Number System
Computer Number SystemComputer Number System
Computer Number System
 
Mba admission in india
Mba admission in indiaMba admission in india
Mba admission in india
 

Similar to Module 4

digital systems and information
digital systems and informationdigital systems and information
digital systems and informationKamran Zafar
 
100_2_digitalSystem_Chap1 (2).ppt
100_2_digitalSystem_Chap1 (2).ppt100_2_digitalSystem_Chap1 (2).ppt
100_2_digitalSystem_Chap1 (2).pptnamraashraf56
 
Chapter 1 digital design.pptx
Chapter 1 digital design.pptxChapter 1 digital design.pptx
Chapter 1 digital design.pptxAliaaTarek5
 
Chapter 1 Digital Systems and Binary Numbers.ppt
Chapter 1 Digital Systems and Binary Numbers.pptChapter 1 Digital Systems and Binary Numbers.ppt
Chapter 1 Digital Systems and Binary Numbers.pptAparnaDas827261
 
chapter1digitalsystemsandbinarynumbers-151021072016-lva1-app6891.pptx
chapter1digitalsystemsandbinarynumbers-151021072016-lva1-app6891.pptxchapter1digitalsystemsandbinarynumbers-151021072016-lva1-app6891.pptx
chapter1digitalsystemsandbinarynumbers-151021072016-lva1-app6891.pptxSurendra Loya
 
Unit 1 PDF.pptx
Unit 1 PDF.pptxUnit 1 PDF.pptx
Unit 1 PDF.pptxChandraV13
 
digital-systems-and-binary-numbers1.pptx
digital-systems-and-binary-numbers1.pptxdigital-systems-and-binary-numbers1.pptx
digital-systems-and-binary-numbers1.pptxRameshK531901
 
Ee 202 chapter 1 number and code system
Ee 202 chapter 1 number and code system Ee 202 chapter 1 number and code system
Ee 202 chapter 1 number and code system CT Sabariah Salihin
 
21EC201– Digital Principles and system design.pptx
21EC201– Digital Principles and system design.pptx21EC201– Digital Principles and system design.pptx
21EC201– Digital Principles and system design.pptxGobinathAECEJRF1101
 
Ncp computer appls num sys2 pramod
Ncp computer appls  num sys2 pramodNcp computer appls  num sys2 pramod
Ncp computer appls num sys2 pramodNCP
 
Unit-6 Computer Arithmetic.ppsx
Unit-6 Computer Arithmetic.ppsxUnit-6 Computer Arithmetic.ppsx
Unit-6 Computer Arithmetic.ppsxtest227270
 
UNIT - I.pptx
UNIT - I.pptxUNIT - I.pptx
UNIT - I.pptxamudhak10
 
UNIT - I.pptx
UNIT - I.pptxUNIT - I.pptx
UNIT - I.pptxamudhak10
 

Similar to Module 4 (20)

digital systems and information
digital systems and informationdigital systems and information
digital systems and information
 
100_2_digitalSystem_Chap1 (2).ppt
100_2_digitalSystem_Chap1 (2).ppt100_2_digitalSystem_Chap1 (2).ppt
100_2_digitalSystem_Chap1 (2).ppt
 
Chapter 1 digital design.pptx
Chapter 1 digital design.pptxChapter 1 digital design.pptx
Chapter 1 digital design.pptx
 
DLD-Introduction.pptx
DLD-Introduction.pptxDLD-Introduction.pptx
DLD-Introduction.pptx
 
LCDF3_Chap_01x.pptx
LCDF3_Chap_01x.pptxLCDF3_Chap_01x.pptx
LCDF3_Chap_01x.pptx
 
Chapter 3.pptx
Chapter 3.pptxChapter 3.pptx
Chapter 3.pptx
 
Chapter 1 Digital Systems and Binary Numbers.ppt
Chapter 1 Digital Systems and Binary Numbers.pptChapter 1 Digital Systems and Binary Numbers.ppt
Chapter 1 Digital Systems and Binary Numbers.ppt
 
Alu1
Alu1Alu1
Alu1
 
Number_Systems (2).ppt
Number_Systems (2).pptNumber_Systems (2).ppt
Number_Systems (2).ppt
 
chapter1digitalsystemsandbinarynumbers-151021072016-lva1-app6891.pptx
chapter1digitalsystemsandbinarynumbers-151021072016-lva1-app6891.pptxchapter1digitalsystemsandbinarynumbers-151021072016-lva1-app6891.pptx
chapter1digitalsystemsandbinarynumbers-151021072016-lva1-app6891.pptx
 
Unit 1 PDF.pptx
Unit 1 PDF.pptxUnit 1 PDF.pptx
Unit 1 PDF.pptx
 
digital-systems-and-binary-numbers1.pptx
digital-systems-and-binary-numbers1.pptxdigital-systems-and-binary-numbers1.pptx
digital-systems-and-binary-numbers1.pptx
 
Ee 202 chapter 1 number and code system
Ee 202 chapter 1 number and code system Ee 202 chapter 1 number and code system
Ee 202 chapter 1 number and code system
 
DCF QNA edited
DCF QNA editedDCF QNA edited
DCF QNA edited
 
21EC201– Digital Principles and system design.pptx
21EC201– Digital Principles and system design.pptx21EC201– Digital Principles and system design.pptx
21EC201– Digital Principles and system design.pptx
 
Chapter02.pdf
Chapter02.pdfChapter02.pdf
Chapter02.pdf
 
Ncp computer appls num sys2 pramod
Ncp computer appls  num sys2 pramodNcp computer appls  num sys2 pramod
Ncp computer appls num sys2 pramod
 
Unit-6 Computer Arithmetic.ppsx
Unit-6 Computer Arithmetic.ppsxUnit-6 Computer Arithmetic.ppsx
Unit-6 Computer Arithmetic.ppsx
 
UNIT - I.pptx
UNIT - I.pptxUNIT - I.pptx
UNIT - I.pptx
 
UNIT - I.pptx
UNIT - I.pptxUNIT - I.pptx
UNIT - I.pptx
 

Recently uploaded

Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfUmakantAnnand
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsKarinaGenton
 

Recently uploaded (20)

Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.Compdf
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its Characteristics
 

Module 4

  • 1. Chapter 1 1 COE 200 Introduction
  • 2. Chapter 1 2 Outline  Course Introduction •Course Information •Textbook •Grading •Important Dates •Course Outline
  • 3. Chapter 1 3 Course Information  Instructor: Rabie A. Ramadan, PhD  Email: ra.ramadan@uoh.edu.sa  Homepage: http://rabieramadan.org/classes/2015- 2016/COE200  Office: Computer Engineering S259  Office Hours Mon 2- 4:00
  • 4. Chapter 1 4 Textbook  Logic and Computer Design Fundamentals, M. Morris Mano and Charles R. Kime (4th edition, 2008). Prentice Hall.  http://www.writphotec.com/mano4/
  • 5. Chapter 1 5 Grading Information  Grading  Laboratory 15%  Class work & Quizzes 10%  Exam 1 15%  Exam 2 15%  Final 45%  Policies • Attendance is required • All submitted work must be yours • Cheating will not be tolerated • Homeworks are due cy deadline – no extensions will be provided - Blackboard
  • 6. Chapter 1 6 Course Content • Digital Systems and Information • Combinational Logic Circuits • Combinational Logic Design  First Exam • Arithmetic Functions and HDLs • Sequential Circuits • Selected Design Topics  Second Exam • Registers and Register Transfers • Memory Basics Final Exam
  • 7. Class Style  Do not think of the exam • Just think of the class materials and how much you learn from it  Feel free to stop me at any time • I do not care how much I teach in class as long as you understand what I am saying  There will be an interactive sessions in class  you solve some of the problems with my help Chapter 1 7
  • 8. When the time is up , just let me know…. Chapter 1 8
  • 10. Charles Kime & Thomas Kaminski © 2008 Pearson Education, Inc. (Hyperlinks are active in View Show mode) Chapter 1 – Digital Systems and Information Logic and Computer Design Fundamentals
  • 11. Chapter 1 11 Overview  Introduction to Digital Systems  Information Representation  Number Systems [binary, octal and hexadecimal]  Arithmetic Operations  Base Conversion  Decimal Codes [Binary Coded Decimal (BCD)]  Gray Codes  Alphanumeric Codes  Parity Bit
  • 12. Chapter 1 12 DIGITAL & COMPUTER SYSTEMS  Takes a set of discrete information inputs and discrete internal information (system state) and generates a set of discrete information outputs. System State Discrete Information Processing System Discrete Inputs Discrete Outputs
  • 13. Chapter 1 13 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, Input)
  • 14. Chapter 1 14 Digital System Example: A Digital Counter (e. g., odometer): 1 3 0 0 5 6 4 Count Up Reset Inputs: Count Up, Reset Outputs: Visual Display State: "Value" of stored digits
  • 15. Chapter 1 15 INFORMATION REPRESENTATION - Signals  Information variables represented by physical quantities.  For digital systems, the variables take on discrete values.  Two level, or binary values are the most prevalent values in digital systems.  Binary values are represented abstractly by: • digits 0 and 1 • words (symbols) False (F) and True (T) • words (symbols) Low (L) and High (H) • and words On and Off.  Binary values are represented by values or ranges of values of physical quantities
  • 16. Chapter 1 16 Signal Examples Over Time Analog Asynchronous Synchronous Time Continuous in value & time Discrete in value & continuous in time Discrete in value & time Digital
  • 17. Chapter 1 17 Signal Example – Physical Quantity: Voltage Threshold Region
  • 18. Chapter 1 18 NUMBER SYSTEMS – Representation  Positive radix, positional number systems  A number with radix r is represented by a string of digits: An - 1An - 2 … A1A0 . A- 1 A- 2 … A- m + 1 A- m in which 0 Ai < r and . is the radix point.  The string of digits represents the power series: ( ) ( ) (Number)r=   + j = - m j j i i = 0 i r A r A (Integer Portion) + (Fraction Portion) i = n - 1 j = - 1
  • 19. Chapter 1 19 Number Systems – Examples General Decimal Binary Radix (Base) r 10 2 Digits 0 => r - 1 0 => 9 0 => 1 0 1 2 3 Powers of 4 Radix 5 -1 -2 -3 -4 -5 r0 r1 r2 r3 r4 r5 r -1 r -2 r -3 r -4 r -5 1 10 100 1000 10,000 100,000 0.1 0.01 0.001 0.0001 0.00001 1 2 4 8 16 32 0.5 0.25 0.125 0.0625 0.03125
  • 20. Chapter 1 20 Special Powers of 2  210 (1024) is Kilo, denoted "K"  220 (1,048,576) is Mega, denoted "M"  230 (1,073, 741,824) is Giga, denoted "G"  240 (1,099,511,627,776) is Tera, denoted “T"
  • 21. Chapter 1 21 ARITHMETIC OPERATIONS - Binary Arithmetic  Single Bit Addition with Carry  Multiple Bit Addition  Single Bit Subtraction with Borrow  Multiple Bit Subtraction  Multiplication  BCD Addition
  • 22. 2-22 5 Aha! 642 is 600 + 40 + 2 in BASE 10 The base of a number determines the number of digits and the value of digit positions Natural Numbers
  • 23. 2-23 6 Continuing with our example… 642 in base 10 positional notation is: 6 x 10² = 6 x 100 = 600 + 4 x 10¹ = 4 x 10 = 40 + 2 x 10º = 2 x 1 = 2 = 642 in base 10 This number is in base 10 The power indicates the position of the number Positional Notation
  • 25. 2-25 6 8 What if 642 has the base of 13? 642 in base 13 is equivalent to 1068 in base 10 + 6 x 13² = 6 x 169 = 1014 + 4 x 13¹ = 4 x 13 = 52 + 2 x 13º = 2 x 1 = 2 = 1068 in base 10 Positional Notation
  • 26. 2-26 9 Decimal is base 10 and has 10 digits: 0,1,2,3,4,5,6,7,8,9 Binary is base 2 and has 2 digits: 0,1 For a number to exist in a given number system, the number system must include those digits. For example: The number 284 only exists in base 9 and higher. Binary
  • 27. 2-27 10 How are digits in bases higher than 10 represented? Base 16: 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E, and F Bases Higher than 10
  • 28. 2-28 What is the decimal equivalent of the octal number 642? 6 x 8² = 6 x 64 = 384 + 4 x 8¹ = 4 x 8 = 32 + 2 x 8º = 2 x 1 = 2 = 418 in base 10 11 Converting Octal to Decimal
  • 29. 2-29 What is the decimal equivalent of the hexadecimal number DEF? D x 16² = 13 x 256 = 3328 + E x 16¹ = 14 x 16 = 224 + F x 16º = 15 x 1 = 15 = 3567 in base 10 Remember, base 16 is 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F Converting Hexadecimal to Decimal
  • 30. 2-30 What is the decimal equivalent of the binary number 010110? 1 x 2 6 = 1 x 64 = 64 + 1 x 2 5 = 1 x 32 = 32 + 0 x 2 4 = 0 x 16 = 0 + 1 x 2 3 = 1 x 8 = 8 + 1 x 2 2 = 1 x 4 = 4 + 1 x 2 1 = 1 x 2 = 2 + 0 x 2º = 0 x 1 = 0 = 112 in base 10 13 Converting Binary to Decimal
  • 32. Addition  From right to left, we add each pair of digits  We write the sum, and add the carry to the next column on the left 1 9 8 + 2 6 4 Sum Carry 0 1 1 + 0 0 1 Sum Carry 2 1 6 1 4 0 0 1 0 1 1 0 Chapter 1 32
  • 33. Binary Sums and Carries a b Sum a b Carry 0 0 0 0 0 0 0 1 1 0 1 0 1 0 1 1 0 0 1 1 0 1 1 1 XOR AND Chapter 1 33
  • 37. One’s Complement  The additive inverse of a one’s complement representation is found by inverting each bit.  Inverting each bit is also called taking the one’s complement Chapter 1 37
  • 38. Example 0000 0011 (3) 1111 1100 (-3) 1110 1000 (-23) 0001 0111 (23) 0000 0000 (0) 1111 1111 (0) Note: There are two representations of zero Chapter 1 38
  • 39. Two’s complement  The additive inverse of a two’s complement integer can be obtained by adding 1 to its one’s complement Chapter 1 39
  • 40. Example 010001 (17) 1101000 (-24) 101110 0010111 1 1 ------ ------- 101111 (-17) 0011000 (24) take the 1’s complement Chapter 1 40
  • 41. Subtracting the large number from the small number Chapter 1 41
  • 42. Subtracting the large number from the small number Chapter 1 42
  • 43. Subtracting the large number from the small number Chapter 1 43
  • 47. Chapter 1 47 Binary Multiplication The binary multiplication table is simple: 0  0 = 0 | 1  0 = 0 | 0  1 = 0 | 1  1 = 1 Extending multiplication to multiple digits: Multiplicand 1011 Multiplier x 101 Partial Products 1011 0000 - 1011 - - Product 110111
  • 49. Multiplication (binary) 10001111 1101000 11010 1101 1011 1101 +  It’s interesting to note that binary multiplication is a sequence of shifts and adds of the first term (depending on the bits in the second term. 110100 is missing here because the corresponding bit in the second terms is 0. Chapter 1 49
  • 50. Chapter 1 50  Useful for Base Conversion Exponent Value Exponent Value 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 19 524,288 20 1,048,576 21 2,097,152 8 256 9 512 10 1024 BASE CONVERSION - Positive Powers of 2
  • 51. Chapter 1 51  To convert to decimal, use decimal arithmetic to form S (digit × respective power of 2).  Example: Convert 110102 to N10: Converting Binary to Decimal
  • 52. Decimal to Binary Conversion  Converting to binary – can’t use polynomial evaluation!  Whole part and fractional parts must be handled separately! • Whole part: Use repeated division. • Fractional part: Use repeated multiplication. • Combine results when finished. Chapter 1 52
  • 53. Decimal to Binary Conversion (Whole Part: Repeated Division)  Divide by target radix (2 in this case)  Remainders become digits in the new representation (0 <= digit < R)  Digits produced in right to left order.  Quotient is used as next dividend.  Stop when the quotient becomes zero, but use the corresponding remainder. Chapter 1 53
  • 54. Decimal to Binary Conversion (Whole Part: Repeated Division) 97  2  quotient = 48, remainder = 1 (LSB) 48  2  quotient = 24, remainder = 0. 24  2  quotient = 12, remainder = 0. 12  2  quotient = 6, remainder = 0. 6  2  quotient = 3, remainder = 0. 3  2  quotient = 1, remainder = 1. 1  2  quotient = 0 (Stop) remainder = 1 (MSB) Result = 1 1 0 0 0 0 12 Chapter 1 54
  • 55. Decimal to Binary Conversion (Fractional Part: Repeated Multiplication) • Multiply by target radix (2 in this case) • Whole part of product becomes digit in the new representation (0 <= digit < R) • Digits produced in left to right order. • Fractional part of product is used as next multiplicand. • Stop when the fractional part becomes zero (sometimes it won’t). Chapter 1 55
  • 56. Decimal to Binary Conversion (Fractional Part: Repeated Multiplication) .1  2  0.2 (fractional part = .2, whole part = 0) .2  2  0.4 (fractional part = .4, whole part = 0) .4  2  0.8 (fractional part = .8, whole part = 0) .8  2  1.6 (fractional part = .6, whole part = 1) .6  2  1.2 (fractional part = .2, whole part = 1) Result = .000110001100011000112….. (How much should we keep?) Regardless of the number of digits , multiply them by 2 Chapter 1 56
  • 57. Counting in Binary Dec Binary 0 0000 1 0001 2 0010 3 0011 4 0100 5 0101 6 0110 7 0111 Note the pattern! •LSB (bit 0) toggles on every count. •Bit 1 toggles on every second count. •Bit 2 toggles on every fourth count. •Etc…. Chapter 1 57
  • 58. Representation Rollover  Consequence of fixed precision.  Computers use fixed precision!  Digits are lost on the left-hand end.  Remaining digits are still correct.  Rollover while counting . . . Up: “999999”  “000000” (Rn-1  0) Down: “000000”  “999999” (0  Rn-1 ) Chapter 1 58
  • 59. 2.59 • We need to know how to convert a number in one system to the equivalent number in another system. • Since the decimal system is more familiar than the other systems, we first show how to covert from any base to decimal. • Then we show how to convert from decimal to any base. • Finally, we show how we can easily convert from binary to hexadecimal or octal and vice versa. Conversion Summary
  • 60. 2.60 Any base to decimal conversion Figure 2.5 Converting other bases to decimal
  • 61. 2.61 Example The following shows how to convert the binary number (110.11)2 to decimal: (110.11)2 = 6.75.
  • 62. The following shows how to convert the hexadecimal number (1A.23)16 to decimal. Note that the result in the decimal notation is not exact, because 3 × 16 −2 = 0.01171875. We have rounded this value to three digits (0.012). Example Chapter 1 62
  • 63. The following shows how to convert (23.17) 8 to decimal. This means that (23.17)8 ≈ 19.234 in decimal. Again, we have rounded up 7 × 8 −2 = 0.109375. Example Chapter 1 63
  • 64. Decimal to any base Chapter 1 64
  • 65. The following shows how to convert 35 in decimal to binary. We start with the number in decimal, we move to the left while continuously finding the quotients and the remainder of division by 2. The result is 35 = (100011)2. Example Chapter 1 65
  • 66. 2.66 The following shows how to convert 126 in decimal to its equivalent in the octal system. We move to the right while continuously finding the quotients and the remainder of division by 8. The result is 126 = (176)8. Example
  • 67. 2.67 The following shows how we convert 126 in decimal to its equivalent in the hexadecimal system. We move to the right while continuously finding the quotients and the remainder of division by 16. The result is 126 = (7E)16 Example
  • 68. 2.68 Converting the fractional part of a number in decimal to other bases
  • 69. 2.69 Convert the decimal number 0.625 to binary. Since the number 0.625 = (0.101)2 has no integral part, the example shows how the fractional part is calculated. Example
  • 70. The following shows how to convert 0.634 to octal using a maximum of four digits. The result is 0.634 = (0.5044)8. Note that we multiple by 8 (base octal). Example Chapter 1 70
  • 71. 2.71 The following shows how to convert 178.6 in decimal to hexadecimal using only one digit to the right of the decimal point. The result is 178.6 = (B2.9)16 Note that we divide or multiple by 16 (base hexadecimal). Example
  • 72. 2.72 An alternative method for converting a small decimal integer (usually less than 256) to binary is to break the number as the sum of numbers that are equivalent to the binary place values shown: Example
  • 73. 2.73 A similar method can be used to convert a decimal fraction to binary when the denominator is a power of two: The answer is then (0.011011)2 Example
  • 74. 2.74 Show the hexadecimal equivalent of the binary number (110011100010)2. Solution We first arrange the binary number in 4-bit patterns: 1100 1110 0010 Note that the leftmost pattern can have one to four bits. Example
  • 75. 2.75 What is the binary equivalent of (24C)16? Solution Each hexadecimal digit is converted to 4-bit patterns: 2 → 0010, 4 → 0100, and C → 1100 The result is (001001001100)2. Example
  • 76. 2.76 Show the octal equivalent of the binary number (101110010)2. Solution Each group of three bits is translated into one octal digit. The result is (562)8. 101 110 010 Example
  • 77. 2.77 What is the binary equivalent of for (24)8? Solution Write each octal digit as its equivalent bit pattern to get 2 → 010 and 4 → 100 The result is (010100)2. Example
  • 78. 2.78 Octal-hexadecimal conversion Octal to hexadecimal and hexadecimal to octal conversion
  • 79. Chapter 1 79 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
  • 80. Chapter 1 80  Given n binary digits (called bits), a binary code is a mapping from a set of represented elements to a subset of the 2n binary numbers.  Example: A binary code for the seven colors of the rainbow  Code 100 is not used Non-numeric Binary Codes Binary Number 000 001 010 011 101 110 111 Color Red Orange Yellow Green Blue Indigo Violet
  • 81. Chapter 1 81 Number of Elements Represented  Given n digits in radix r, there are rn distinct elements that can be represented.  But, you can represent m elements, m < rn  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, 0011, 1000). • This second code is called a "one hot" code.
  • 82. Chapter 1 82 DECIMAL CODES - Binary Codes for Decimal Digits 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  There are over 8,000 ways that you can chose 10 elements from the 16 binary numbers of 4 bits. A few are useful:
  • 83. Chapter 1 83  What special property does the Gray code have in relation to adjacent decimal digits? GRAY CODE – Decimal Decimal 8,4,2,1 Gray 0 0000 0000 1 0001 0100 2 0010 0101 3 0011 0111 4 0100 0110 5 0101 0010 6 0110 0011 7 0111 0001 8 1000 1001 9 1001 1000 Chapter 1 83
  • 84. Chapter 1 84 UNICODE  UNICODE extends ASCII to 65,536 universal characters codes • For encoding characters in world languages • Available in many modern applications • 2 byte (16-bit) code words • See Reading Supplement – Unicode on the Companion Website http://www.prenhall.com/mano Chapter 1 84
  • 85. Chapter 1 85 PARITY BIT Error-Detection Codes  Redundancy (e.g. extra information), in the form of extra bits, can be incorporated into binary code words to detect and correct errors.  A simple form of redundancy is parity, an extra bit appended onto the code word to make the number of 1’s odd or even. Parity can detect all single-bit errors and some multiple-bit errors.  A code word has even parity if the number of 1’s in the code word is even.  A code word has odd parity if the number of 1’s in the code word is odd.
  • 86. Chapter 1 86 4-Bit Parity Code Example  Fill in the even and odd parity bits:  The codeword "1111" has even parity and the codeword "1110" has odd parity. Both can be used to represent 3-bit data. Even Parity Odd Parity Message- Parity Message- Parity 000 - 000 - 001 - 001 - 010 - 010 - 011 - 011 - 100 - 100 - 101 - 101 - 110 - 110 - 111 - 111 -
  • 87. Binary-Coded Decimal (BCD) • a BCD number is just a natural binary encoding of the decimal digits from 0 to 9 on four bits. 0101 0111 59 in BCD (0 ~ 99) because there are unused code words 87 in normal unsigned binary number (0 ~ 255) Chapter 1 87
  • 88. Binary-Coded Decimal (BCD) • Binary-Coded Decimal is a weighted code because each decimal digit can be obtained from its code word by assigning a fixed weight to each code-word bit. • The weights for the BCD bits are 8, 4, 2, and 1, and for this reason the code is sometimes called the 8421 code. Chapter 1 88
  • 89. Excess-3 code • This code is also self-complementing like 2421 code. • Although this code is not weighted, it has an arithmetic relationship with the BCD code. • The code word for each decimal digit is the corresponding BCD code word plus 0011 2 . 0010 = 2 in BCD + 00112 = 0101 = 2 in excess-3 Chapter 1 89
  • 90. Gray Code • Gray code is a code where only one bit changes at a time while traversing from 0 to any decimal number in sequence. • This is a useful property when converting analog values into digital values, since it eliminates the problem of misinterpreting asynchronous changes to bits between valid values. Chapter 1 90
  • 92. Parity check • One of the most common ways to achieve error detection is by means of a parity bit. • A parity bit is an extra bit included with a message to make the total number of 1’s transmitted either odd or even. • If an odd parity is adopted, the P bit is chosen such that the total number of 1’s is odd. Chapter 1 92