0% found this document useful (0 votes)
7 views

Chap 01

Uploaded by

charbelkhalil05
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

Chap 01

Uploaded by

charbelkhalil05
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 49

Logic and Computer Design Fundamentals

Chapter 1 – Digital Systems


and Information

Charles Kime & Thomas Kaminski


© 2008 Pearson Education, Inc.
Overview

▪ Digital Systems, Computers, and Beyond


▪ Information Representation
▪ Number Systems [binary, octal and hexadecimal]
▪ Arithmetic Operations
▪ Base Conversion
▪ Decimal Codes [BCD (binary coded decimal)]
▪ Alphanumeric Codes

Chapter 1 2
Digital Systems

▪ Early computers were used for computations


with digits– digital computers.
▪ The use of “digital” spread to digital circuits
and digital systems.
▪ The term logic is applied to circuits that
operate on a set of two elements with 0,1
▪ The general-purpose digital computer is a
digital system that follow a stored sequence of
instructions, called a program.

Chapter 1 3
Digital Computer Example

Memory

Control
CPU unit Datapath

Inputs:
Outputs: LCD
keyboard, mouse,
screen, wireless,
wireless, Input/Output speakers
microphone
Synchronous or
Asynchronous?
Chapter 1 4
Digital Computer

▪ The memory stores the programs, input,


output, and intermediate data.
▪ The datapath performs arithmetic and
data-processing operations.
▪ The control unit supervises the flow of
information between various
components.
▪ A datapath + Control Unit forms CPU

Chapter 1 5
▪ The program and user data are transferred to
memory by input devices.
▪ Output devices display the result.
▪ The control unit in the CPU retrieves the
instructions from the program stored in
memory.
▪ A digital computer can
• perform arithmetic computations,
• manipulate strings of alphabetic characters,
• Make decisions based on internal and external
conditions.
Chapter 1 6
Signal Examples Over Time

Time
Continuous in
value & time
Analog

Digital Discrete in
value &
Asynchronous continuous in
time
Discrete in
Synchronous
value & time

Chapter 1 7
Signal Example – Physical Quantity: Voltage

Threshold
Region

Chapter 1 8
INFORMATION REPRESENTATION - Signals

▪ Information variables represented by physical


quantities.
▪ For digital systems, the variables take on discrete
values.
▪ Two level, or binary values are used 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 9
Embedded Microcomputers

▪ The input devices transform inputs from the


product into electrical signals
▪ The output devices transform electrical signals into
outputs to the product or the outside world.
▪ Input/output devices can use digital/analog signals.
• Digital input device: a limit switch which is
closed or open if a force is applied to it.
• Analog input devices: thermistor which changes
electrical resistance in response to temperature

Chapter 1 10
And Beyond – Embedded Systems

▪ Computers as integral parts of other


products
▪ Examples of embedded computers
• Single-chip computers: Microcomputers or
Microcontrollers
• Digital signal processors: special-purpose
computers
• Embedded software: permanently stored to
provide only the functions required for the
product.
Chapter 1 11
DIGITAL & COMPUTER SYSTEMS - Digital
System

▪ Takes a set of discrete information inputs and discrete


internal information (system state) and generates a set
of discrete information outputs.

Discrete Discrete
Inputs Information
Processing Discrete
System Outputs

System State
Chapter 1 12
Digital System Example:

A Digital Counter

Count Up
Reset 0 0 1 3 5 6 4

Inputs: Count Up, Reset


Outputs: Visual Display (LED)
State: "Value" of stored digits

Chapter 1 13
Examples of Embedded Systems

Banking, Commerce Copiers

Communication Cell phones, routers, satellites


Games and toys Video games, talking stuffed games

Home appliances Digital alarm clock, microwave ovens,


Dishwashers

Media CD players, Flat Panel TVs, Digital


Camera
Medical equipment Pacemakers, magnetic resonance imaging
Personal PDA

Transportation & Navigation Global Positioning Systems, Automobiles


(>50 microcontrollers)

Chapter 1 14
Impact of Digital Systems

▪ Play central role in medical diagnosis and


treatment
▪ Educational institutions and workplaces
▪ Interacting with others.
▪ Thanks to the invention of the transistor
and the integrated circuits

Chapter 1 15
More on Generic Computer

▪ At the heart of the computer, an


Integrated Circuit called the processor.
▪ Modern processors are complex and
consist of ten to hundreds of millions of
transistors.
▪ The processor contains four functional
modules: CPU, FPU, MMU and the
internal cache.
• MMU+ Internal cache + External cache +
RAM = memory
Chapter 1 16
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 = (
i=n-1
Ai r )+( 
i
j=-1

Aj r)
j

i=0 j=-m
(Integer Portion) + (Fraction Portion)
Chapter 1 17
Number Systems – Examples

General Decimal Binary


Radix (Base) r 10 2
Digits 0 => r - 1 0 => 9 0 => 1
0 r0 1 1
1 r1 10 2
2 r2 100 4
3 r3 1000 8
Powers of 4 r4 10,000 16
Radix 5 r5 100,000 32
-1 r -1 0.1 0.5
-2 r -2 0.01 0.25
-3 r -3 0.001 0.125
-4 r -4 0.0001 0.0625
-5 r -5 0.00001 0.03125

Chapter 1 18
Examples

▪ Conversion to decimal:
▪ 724.5= 7 x 102 + 2 x 101 + 4 x 100 + 5 x 10-1

▪ (11010.11)2 = 1 x 24 + 1 x 23 + 0 x 22 + 1 x 21 +
0 x 20 + 1x2-1 + 1 x2-2 = (26.75) 10
▪ Conversion to Binary:
625 -512 = 113
113 – 64 = 49
49 – 32 = 17 ➔ (625)10 = 29 + 26 + 25 + 24 + 20
17 – 16 = 1 = (1001110001)2
1–1=0
Chapter 1 19
Octal and Hexadecimal

▪ All computers and digital systems use the


binary representation.
▪ The octal (base 8) and the hexadecimal (base
16) systems are useful for representing binary
quantities indirectly. (Power of 2)
▪ The hexadecimal: 0 till 9, A, B, C, D, E and F
▪ (B65F)16= 11 x 163 + 6 x 162+ 5x161 +15x160
= (46687)10

▪ (127.4)8 = 1x82 + 2x81 + 7x80 + 4x8-1= (87.5)10

Chapter 1 20
Conversions

▪ Binary to Octal:
▪ (010 110 001 101 011.111 100 000 110) 2
= (26153.7406)8
▪ Binary to Hexadecimal:
▪ (0010 1100 0110 1011.1111 0000 0110) 2
= (2C6B.F06)16
▪ Octal and Hex to Binary:
▪ (673.12)8 = (110 111 011.001 010)2
▪ (3A6.C)16 = (0011 1010 0110.1100)2
Chapter 1 21
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 22
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 23
Single Bit Binary Addition with Carry

Given two binary digits (X,Y), a carry in (Z) we get the


following sum (S) and carry (C):
Carry in (Z) of 0: Z 0 0 0 0
X 0 0 1 1
+Y +0 +1 +0 +1
CS 00 01 01 10

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 24
Multiple Bit Binary Addition

▪ Extending this to two multiple bit


examples:
Carries 00000 101100
Augend 01100 10110
Addend +10001 + 10111
Sum 11101 101101

Chapter 1 25
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 26
Multiple Bit Binary Subtraction

▪ Extending this to two multiple bit examples:


Borrows 00000 00110 00110
Minuend 10110 10110 11110
Subtrahend - 10010 - 10011 10011
Difference 00100 00011 -01011
▪ Notes: Borrow-In to the least significant bit. If the
Subtrahend > the Minuend, interchange and
append a – to the result.

Chapter 1 27
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
Chapter 1 28
▪ Hexadecimal Addition:
59F
+E46
13E5
▪ Octal Multiplication:
762
x 45
4672
3710
43772
Chapter 1 29
BASE CONVERSION - Positive Powers of 2

▪ 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
8 256 19 524,288
9 512 20 1,048,576
10 1024 21 2,097,152
Chapter 1 30
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 31
Commonly Occurring Bases

Name Radix Digits


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 32
Numbers in Different Bases

▪ Good idea to memorize!


Decimal Binary Octal Hexadecimal
(Base 10) (Base 2) (Base 8) (Base 16)
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 01011 13 0B
12 01100 14 0C
13 01101 15 0D
14 01110 16 0E
15 01111 17 0F
16 10000 20 10
Chapter 1 33
Conversion Between Bases

▪ Method 2
▪ To convert from one base to another:
1) Convert the Integer Part
2) Convert the Fraction Part
3) Join the two results with a radix point

Chapter 1 34
Conversion Details

▪ To Convert the Integral Part:


Repeatedly divide the number by the new radix and
save the remainders. The digits for the new radix are
the remainders in reverse order of their computation.
If the new radix is > 10, then convert all remainders >
10 to digits A, B, …
▪ To Convert the Fractional Part:
Repeatedly multiply the fraction by the new radix and
save the integer digits that result. The digits for the
new radix are the integer digits in order of their
computation. If the new radix is > 10, then convert all
integers > 10 to digits A, B, …

Chapter 1 35
Example: Convert 46.687510 To Base 2

▪ Convert 46 to Base 2=(101110) 2


▪ Convert 0.6875 to Base 2=(0.1011) 2
0.6875 * 2 = 1.3750 int = 1
0.3750 * 2 = 0.7500 int = 0
0.7500 * 2 = 1.5000 int = 1
0.5000 * 2 = 1.0000 int = 1
0.0000
(46.6875)10=(101110.1011)2

Chapter 1 36
Checking the Conversion

▪ To convert back, sum the digits times their


respective powers of r.
▪ From the prior conversion of 46.687510
1011102 = 1·32 + 0·16 +1·8 +1·4 + 1·2 +0·1
= 32 + 8 + 4 + 2
= 46
0.10112 = 1/2 + 1/8 + 1/16
= 0.5000 + 0.1250 + 0.0625
= 0.6875

Chapter 1 37
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 38
Octal to Hexadecimal via Binary

▪ Convert octal to binary.


▪ Use groups of four bits and convert as above to
hexadecimal digits.
▪ Example: Octal to Binary to Hexadecimal
(635.177)8
6 3 5 . 1 7 78
110| 011| 101 . 001| 111| 111 2
Regroup:
1| 1001| 1101 . 0011| 1111| 1(000)2
(19D. 3F8)16
Chapter 1 39
Decimal Codes

▪ The binary system is the most natural for a


computer, but people are accustomed to the
decimal system.
▪ Convert decimal numbers to binary, perform all
arithmetic calculations in binary, then convert the
results back to decimal.
▪ An n-bit binary code is a group of n bits that
assume up to 2n distinct combinations.
• 2-bit binary code: 00, 01, 10, 11
• n-bit binary code: from 0 to 2n -1
Chapter 1 40
BCD – Binary-Coded Decimal

Decimal Symbol BCD Digit


Decimal 396 0 0000

= 0011 1001 0110 1 0001


2 0010
3 0011
4 0100
5 0101
6 0110
7 0111
8 1000
9 1001

Chapter 1 41
BCD

(185)10 = (0001 1000 0101)BCD = (10111001)2


▪ The BCD value has 12 bits, but the equivalent binary
needs only 8 bits.
▪ BCD representation of decimal numbers is still important
because computer input and output data used by most
people needs to be in the decimal system.
▪ BCD numbers are decimal numbers and not binary
numbers even though they are represented in bits.
▪ The only difference: decimals are written using 0,1,2,…9
and BCD numbers use the binary codes 0000, 0001,…
1001

Chapter 1 42
Binary Coded Decimal (BCD)

▪ The BCD code is the 8,4,2,1 code.


▪ 8, 4, 2, and 1 are weights
▪ BCD is a weighted code
▪ This code is the simplest, most intuitive binary
code for decimal digits and uses the same
powers of 2 as a binary number, but only
encodes the first ten values from 0 to 9.
▪ Example: 1001 (9) = 1000 (8) + 0001 (1)
▪ How many “invalid” code words are there?
1010, 1011, 1100, 1101, 1110, 1111

Chapter 1 43
Warning: Conversion or Coding?

▪ Do NOT mix up conversion of a decimal


number to a binary number with coding
a decimal number with a BINARY
CODE.
▪ 1310 = 11012 (This is conversion)
▪ 13  0001|0011 (This is coding)

Chapter 1 44
BCD Addition Example

▪ Add 1897BCD 2905BCD to showing


carries and digit corrections.
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 45
DECIMAL CODES - Binary Codes for Decimal
Digits
▪ There are over 8,000 ways that you can chose 10 elements
from the 16 binary numbers of 4 bits. A few are useful:

Decimal BCD 8,4,2,1 Excess3 8,4,-2,-1


0 0000 0011 0000
1 0001 0100 0111
2 0010 0101 0110
3 0011 0110 0101
4 0100 0111 0100
5 0101 1000 1011
6 0110 1001 1010
7 0111 1010 1001
8 1000 1011 1000
9 1001 1100 1111

Chapter 1 46
ALPHANUMERIC CODES - ASCII Character
Codes
▪ American Standard Code for Information
Interchange.
▪ This code is a popular code used to represent
information sent as character-based data. It uses
7-bits to represent 128 characters:
• 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 47
ASCII Properties

▪ ASCII has some interesting properties


▪ Digits 0 to 9 span Hexadecimal values 3016 to 3916
▪ Upper case A-Z span 4116 to 5A16
▪ Lower case a -z span 6116 to 7A16
▪ ASCII is a 7-bit code, but most computers
manipulate an 8-bit quantity as a single unit called
byte
▪ Therefore, ASCII characters are stored 1 per byte
with the most significant bit set to 0.
▪ Some printers recognize additional 128 8-bit
characters, with the most bit set to 1.
Chapter 1 48
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 49

You might also like