You are on page 1of 47

CEN-220 Digital Logic Design

Fall 2010
Instructor: Mansoor Naseer
mansoor@bahria.edu.pk
Bahria University, Islamabad
Course Information

ƒ Credit hours: 4 (3+1)


ƒ Three hours theory and two hours lab
ƒ Class timings:
ƒ Monday: 0915
0915-1115(XC-8)
1115(XC-8), Wednesday:
1115-1215(XC-7): BEE-3B
ƒ Monday: 1215-1415(XC-14), Wednesday:
0915-1015(XC-7): BEE-3A
ƒ Textbook:
ƒ "Logic
"L i andd Computer
C t Design
D i Fundamentals”,
F d t l”
Morris M. Mano, 4th Edition, Prentice Hall,
2008
Course Information

ƒ Group/Web Page:
• Webpage: http://groups.google.com.pk/group/dld2010f
p g p g g p g p
• Current email address: dld2010f@googlegroups.com
ƒ Marks Distribution:
• Quizzes: 10%
• A i
Assignments/Projects:
t /P j t 20%
• Midterm Examination: 20%
• Final Examination: 50%
• Labs: 100% ggrade constitutingg 1 credit hour
ƒ Grading Policy:
• 87 – 100 : A
• 80 – 86 : B+
• 72 – 79 : B
• 66 – 71 : C+
• 60 – 65 : C
• <60 : F
Learning Objectives

ƒ Various number systems.


ƒ Definition and Laws of Boolean Algebra,
Boolean Expression and functions.
ƒ Minimization of Boolean functions,
methods for the minimization.
ƒ Logic elements and their application.
ƒ Combinational Circuits
Circuits.
ƒ Sequential Circuits.
Pre requisites & outline

ƒ Pre requisite: None


ƒ Week 1 – Number systems.
ƒ Week 2 – Number systems arithmetic
arithmetic.
ƒ Week 3 – Definition and Laws of Boolean algebra.
ƒ Week 4 – Boolean Expression and functions.
ƒ Week 5 – Minimization of Boolean functions.
ƒ W k 6 – Logic
Week L i elements
l t andd their
th i application.
li ti
ƒ Week 7 – introduction to Combinational Circuits.
ƒ Week 8 – introduction to Combinational Circuits cont…
ƒ Week 9 – Midterm
ƒ W k 10 – Combinational
Week C bi i l arithmetic
ih i
ƒ Week 11 – introduction to Sequential Circuits.
ƒ Week 12 – Sequential circuits cont…
ƒ Week 13 – Registers
ƒ Week 14 – Counters
ƒ Week 15 – Memories
ƒ Week 16 – Datapath and Control
ƒ Week 17 – Datapath and Control Cont…
ƒ Week 18 – Finals
Logic and Computer Design Fundamentals
Chapter 1 – Digital Systems
and Information

Charles Kime & Thomas Kaminski


© 2008 Pearson Education,
Education Inc.
Inc
(Hyperlinks are active in View Show mode)
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
ƒ Parity Bit
ƒ Grayy Codes

Chapter 1 7
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
I
Inputs Information
Processing Discrete
System Outputs

System State
Chapter 1 8
Types of Digital Systems

ƒ No state present
• Combinational Logic System
• Output = Function(Input)
ƒ S
Statee present
p ese
• State updated at discrete times
=> Synchronous Sequential System
• State updated at any time
=>Asynchronous Sequential System
• State
S =F
Function
i (State,
(S I
Input)
)
• Output = Function (State)
or Function ((State,, Input)
p )

Chapter 1 9
Digital System Example:

A Digital Counter (e. g., odometer):

Count Up
Reset 0 0 1 3 5 6 4

IInputs:
t Count U
C Up, R
Reset
Outputs: Visual Display
State: "Value"
Value of stored digits

Synchronous or Asynchronous?

Chapter 1 10
Digital Computer Example

Memoryy

Control
CPU unit Datapath

Inputs:
Outputs: LCD
keyboard, mouse,
screen, wireless,
wireless, Input/Output speakers
k
microphone
Synchronous or
Asynchronous?
Chapter 1 11
And Beyond – Embedded Systems

ƒ Computers as integral parts of other


products
d
ƒ Examples of embedded computers
• Microcomputers
• Microcontrollers
• Digital signal processors

Chapter 1 12
Embedded Systems

ƒ Examples of Embedded Systems


Applications
li i
• Cell phones
• Automobiles
• Video games
• Copiers
• Dishwashers
• Flat Panel TVs
• Global Positioningg Systems
y

Chapter 1 13
INFORMATION REPRESENTATION - Signals

ƒ Information variables represented by physical


quantities.
quantities
ƒ For digital systems, the variables take on discrete
values.
ƒ Two level, or binary values are the most prevalent
values in digital systems.
ƒ Binaryy values are represented
p abstractlyy by:
y
• 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 14
Signal Examples Over Time

Time
Continuous
Analog in value &
time

Digital Discrete
Di t iin
value &
Asynchronous continuous
in time

Synchronous Discrete in
value & time

Chapter 1 15
Signal Example – Physical Quantity: Voltage

Threshold
R i
Region

Chapter 1 16
Binary Values: Other Physical Quantities

ƒ What are other physical quantities


represent 0 and 1?
• CPU Voltage
• Disk Magnetic Field Direction
• CD Surface Pits/Light
• Dynamic RAM Electrical Charge

Chapter 1 17
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 18
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 19
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
(1 099 511 627 776 ) is
i Tera,
T denoted
d t d “T"

Chapter 1 20
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 21
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 22
Multiple Bit Binary Addition

ƒ Extending this to two multiple bit


examples:
l
Carries 0 0
Augend 01100 10110
Add d
Addend +10001
10001 +10111
10111
Sum
ƒ Note: The 0 is the default Carry-In to the
least significant bit.

Chapter 1 23
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 24
Multiple Bit Binary Subtraction

ƒ Extending this to two multiple bit examples:


Borrows 0 0
Mi
Minuendd 10110 10110
Subtrahend - 10010 - 10011
Difference
ƒ Notes: The 0 is a Borrow-In
Borrow In to the least significant
bit. If the Subtrahend > the Minuend, interchange
and append a – to the result.

Chapter 1 25
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 - -
P d
Product 110111
Chapter 1 26
BASE CONVERSION - Positive Powers of 2

ƒ Useful for Base Conversion


Exponent Value Exponent Value
0 1 11 2,048
1 2 12 4 096
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 11,048,576
048 576
10 1024 21 2,097,152
Chapter 1 27
Converting Binary to Decimal

ƒ To convert to decimal, use decimal arithmetic


to form Σ (digit × respective power of 2).
ƒ Example:Convert 110102 to N10:

Chapter 1 28
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,
power until the remainder is zero.
zero
• Place 1’s in the positions in the binary result
corresponding to the powers recorded; in all other
positions place 00’ss.
ƒ Example: Convert 62510 to N2

Chapter 1 29
Commonly Occurring Bases

Name Radix Digits


g
Binary 2 0,1
Octal 8 01234567
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
ƒ The six letters (in addition to the 10
integers) in hexadecimal represent:

Chapter 1 30
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 31
Conversion Between Bases

ƒ Method 2
ƒ To convert from one base to another:
1) Convert the Integer Part
2) Convert the Fraction Part
3) JJoin
i th
the ttwo results
lt with
ith a radix
di point
i t

Chapter 1 32
Conversion Details

ƒ To Convert the Integral Part:


Repeatedly
R dl di
divide
id the
h number b bby the
h new radixdi and
d
save the remainders. The digits for the new radix are
p
the remainders in reverse order of their computation.
If the new radix is > 10, then convert all remainders >
10 to digits A, B, …
ƒ To
T CConvertt th
the F
Fractional
ti l Part:
P t
Repeatedly multiply the fraction by the new radix and
save the
th iinteger
t di
digits
it that
th t result.
lt The
Th digits
di it for
f the
th
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 33
Example: Convert 46.687510 To Base 2

ƒ Convert 46 to Base 2

ƒ Convert 0.6875 to Base 2:

ƒ Join the results together with the


radix
di point:
i
Chapter 1 34
Additional Issue - Fractional Part

ƒ Note that in this conversion, the fractional part


can become 0 as a result of the repeated
multiplications.
ƒ In ggeneral,, it mayy take manyy bits to get
g this to
happen or it may never happen.
ƒ Example Problem: Convert 0.6510 to N2
• 0.65 = 0.1010011001001 …
• The fractional part begins repeating every 4 steps
yielding repeating 1001 forever!
ƒ Solution: Specify number of bits to right of
radix point and round or truncate to this
number.
Chapter 1 35
Checking the Conversion

ƒ To convert back, sum the digits times their


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

Chapter 1 36
Octal (Hexadecimal) to Binary and
Back
ƒ Octal (Hexadecimal) to Binary:
• Restate
R the
h octall (h
(hexadecimal)
d i l) as three
h
(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
th ffractional
the ti l part.
t
• Convert each group of three bits to an octal
(hexadecimal) digit.
digit

Chapter 1 37
Octal to Hexadecimal via Binary

ƒ Convert octal to binary.


ƒ Use groups of four bits and convert as above to
hexadecimal digits.
ƒ Example:
E l Octal
O t l to
t Binary
Bi to
t Hexadecimal
H d i l
6 3 5 . 1 7 7 8

ƒ Why do these conversions work?

Chapter 1 38
Binary Coded Decimal (BCD)

ƒ 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?
ƒ What are the “invalid” code words?

Chapter 1 39
Excess 3 Code and 8, 4, –2, –1 Code

Decimal Excess 3 8, 4, –2, –1


0 0011 0000
1 0100 0111
2 0101 0110
3 0110 0101
4 0111 0100
5 1000 1011
6 1001 1010
7 1010 1001
8 1011 1000
9 1100 1111
ƒ What interesting property is common
to these two codes?
Chapter 1 40
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 41
BCD Arithmetic
ƒ Given a BCD code, we use binary arithmetic to add the digits:
8 1000 Eightg
+5 +0101 Plus 5
13 1101 is 13 (> 9)
ƒ N
Note that the result is MORE
O THAN N 9,, so must be
represented by two digits!
ƒ To correct the digit, subtract 10 by adding 6 modulo 16.
8 1000 Eight
+5 +0101 Plus 5
13 1101 is 13 (> 9)
+0110
0110 so adddd 6
carry = 1 0011 leaving 3 + cy
0001 | 0011 Final answer (two digits)g
ƒ If the digit sum is > 9, add one to the next significant digit
Chapter 1 42
BCD Addition Example

ƒ Add 2905BCD to 1897BCD showing


g
carries and digit corrections.
0
0001 1000 1001 0111
+ 0010 1001 0000 0101

Chapter 1 43
ALPHANUMERIC CODES - ASCII Character
Codes
ƒ American Standard Code for Information
Interchangeg (Refer to Table 1 -44 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
Non printing characters
ƒ Some non-printing characters are used for text
format ((e.g.
g BS = Backspace,
p , CR = carriage g
return)
ƒ Other non-printing characters are used for record
marking
ki and d fl
flow control
t l ((e.g. STX and
d ETX start
t t
and end text areas).
Chapter 1 44
ASCII Properties

ASCII has some interesting properties:


ƒ Digits
Di it 0 to
t 9 span Hexadecimal
H d i l values l 3016 to
t 3916 .
ƒ Upper case A-Z span 4116 to 5A16 .
ƒ Lower case a -z span
p 6116 to 7A16 .
• Lower to upper case translation (and vice versa)
occurs by flipping bit 6.
ƒ Delete
D l t (DEL) iis all
ll bit
bits set,
t a carryover from
f when
h
punched paper tape was used to store messages.
ƒ Punching
u c g all holes
o es in a row
ow eerased
sed a mistake!
s e!

Chapter 1 45
4-Bit Parity Code Example

ƒ Fill in the even and odd parity bits:


Even Parity Odd Parity
Message - Parity Message - Parity
000 - 000 -
001 - 001 -
010 - 010 -
011 - 011 -
100 - 100 -
101 - 101 -
110 - 110 -
111 - 111 -
ƒ The codeword "1111" has even parity and the
codeword "1110"
1110 has odd parity
parity. Both can be
used to represent 3-bit data.
Chapter 1 46
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

ƒ What special property does the Gray code have


in relation to adjacent
j decimal digits?
g

Chapter 1 47

You might also like