0% found this document useful (0 votes)
76 views24 pages

CH 01

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
76 views24 pages

CH 01

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 24

Digital Design

Chapter 1: Introduction

Slides to accompany the textbook Digital Design, with RTL Design, VHDL, and
Verilog, 2nd Edition,
by Frank Vahid, John Wiley and Sons Publishers, 2010.
http://www.ddvahid.com

Copyright © 2010 Frank Vahid


Instructors of courses requiring Vahid's Digital Design textbook (published by John Wiley and Sons) have permission to modify and use these slides for customary course-related activities,
subject to keeping this copyright notice in place and unmodified. These slides may be posted as unanimated pdf versions on publicly-accessible course websites.. PowerPoint source (or pdf
Digital
with animations) may Design 2e
not be posted to publicly-accessible websites, but may be posted for students on internal protected sites or distributed directly to students by other electronic means.
Copyright © 2010 1
Instructors may make printouts of the slides available to students for a reasonable photocopying charge, without incurring royalties. Any other use requires explicit permission. Instructors
Frank Vahid
may obtain PowerPoint source or obtain special use permissions from Wiley – see http://www.ddvahid.com for information.
1.1

Why Study Digital Design?


• Look “under the hood” of computers
– Solid understanding --> confidence, insight,
even better programmer when aware of
hardware resource issues
• Electronic devices becoming digital
– Enabled by shrinking and more capable chips
– Enables:
• Better devices: Sound recorders, cameras, cars,
cell phones, medical devices, game consoles,...
• New devices: smartphones, smart assistants...
– Known as “embedded systems”
• Thousands of new devices every year
• Designers needed: Potential career direction
Satellites DVD Video Musical
players recorders instruments smartwatches
Portable
music players Cell phones Cameras TVs smartphones ???

1995 1997 1999 2001 2003 2005 2007 2009 2011 2013 2015
Digital Design 2e • Years shown above indicate when digital version began to dominate
Copyright © 2010
– (Not the first year that a digital version appeared)
2
Frank Vahid
1.2

What Does “Digital” Mean?


• Analog signal • Digital signal
– Infinite possible values – Finite possible values
• Ex: voltage on a wire • Ex: button pressed on a
created by microphone keypad
Sound waves
move the
membrane, 1 2 3 4

2
which moves digital
the magnet,
signal
microphone
analog a

which creates signal


current in the nearby wire
Possible values: Possible values:
1.00, 1.01, 2.0000009, 4
value

value
0, 1, 2, 3, or 4.
... infinite possibilities 3 That’s it.
2
a 1
0
time time
Digital Design 2e
Copyright © 2010 3
Frank Vahid
Digital Signals with Only Two Values: Binary
• Binary digital signal -- only two
possible values

value
Typically represented as 0 and 1
– One binary digit is a bit
– 1
We’ll only consider binary digital signals 0
– Binary is popular because time
• Transistors, the basic digital electric
component, operate using two voltages
(more in Chpt. 2)
• Storing/transmitting one of two values is
easier than three or more (e.g., loud beep
or quiet beep, reflection or no reflection)

Digital Design 2e
Copyright © 2010 4
Frank Vahid
lengthy transmission
Example of Digitization

Volts

(e.g, cell phone)


3 3
2 2
Benefit 1 original signal 1 received signal
• 0 0
Analog signal (e.g., audio, time time
video) may lose quality How fix -- higher, lower, ?
– Voltage levels not 01 10 11 10 11

lengthy transmission
saved/copied/transmitted
a2d

(e.g, cell phone)


perfectly

Volts
a

• Digitized version enables


1 digitized signal 1
near-perfect save/cpy/tran.
0 0
– “Sample” voltage at
particular rate, save time time
sample using bit encoding Can fix—distinguish 0s/1s, restore
– Voltage levels still not kept sa
perfectly m
– But we can distinguish 0s Not a perfect re-creation e
from 1s due to a2d and d2a

01 10 11 10 11
Let bit encoding be:
1 V: “01”
2 V: “10” d2a

Volts
3
3 V: “11”
Higher sampling 2
rate and more bits per
1
Digital Design 2e encoding improves re-creation
Copyright © 2010 0 5
Frank Vahid
Digitization Benefit: Can Store on Digital Media
analog signal
on wire
3
2

Volts
1 samples
wire 0
00 01 10 10 11 11 11 01 10 10 00 time
analog-to-
microphone digital digitized signal
converter
Store on CD, USB drive,
(a) 0001101011111101101000
etc. No deterioration.

0001101011111101101000 read from tape, CD, etc. analog signal


reproduced from
digital-to-
digitized signal
analog 3 a
converter
2
Volts

wire
1
0
00 01 10 10 11 11 11 01 10 10 00 time
(b)
speaker
Digital Design 2e
Copyright © 2010 6
Frank Vahid
Digitized Audio: Compression Benefit
• Digitized audio can be Example compression scheme:
compressed 00 means 0000000000
01 means 1111111111
– e.g., MP3s 1X means X
– A CD can hold about 20
songs uncompressed, 0000000000 0000000000 0000001111 1111111111
but about 200
compressed a
00 00 10000001111 01
• Compression also done
on digitized pictures
(jpeg), movies (mpeg),
and more
• Digitization has many
other benefits too
Digital Design 2e
Copyright © 2010 7
Frank Vahid
How Do We Encode Data as Binary for Our
Digital System?
a
analog button

phenomena • Some inputs inherently


binary 0 1

sensors and
other inputs – Button: not pressed (0), red blue gr een black
electric digital pressed (1)
signal data 0 0 0
• Some inputs inherently
A2D
digital red blue gr een black

digital
data – Just need encoding in 0 0 1
binary
Digital System red blue gr een black
– e.g., multi-button input:
digital digital encode red=001, blue=010, 0 1 0
data data ... air 33
D2A
• Some inputs analog degrees
electric
signal – Need analog-to-digital temperature
sensor
actuators and conversion
other outputs
– As done in earlier slide --
sample and encode with
Digital Design 2e
bits 0 0 1 0 0 0 0 1
Copyright © 2010 8
Frank Vahid
How to Encode Text: ASCII, Unicode
Sample ASCII encodings
• ASCII: 7- (or 8-)
Encoding Symbol Encoding Symbol
010 0000 <space>␠ 110 0001 a
Encoding Symbol Encoding Symbol 110 0010 b
bit encoding of
010 0001 !
010 0010 " 100 0001 A 100 1110 N ...
010 0011 # 100 0010 B 100 1111 O 111 1001 y
each letter, 010 0100
010 0101
$
%
100
100
0011
0100
C
D
101 0000
101 0001
P
Q
111 1010 z

number, or 010 0110


010 0111
&
'
100 0101
100 0110
E
F
101 0010
101 0011
R
S
011 0000
011 0001
0
1
100 0111 G 101 0100 T
symbol 010 1000
010 1001
(
) 100
100
1000
1001
H
I
101 0101 U
011 0010
011 0011
2
3
010 1010 * 101 0110 V 011 0100 4
• Unicode: 010 1011
010 1100
+
,
100
100
1010
1011
J
K
101 0111
101 1000
W
X
011 0101
011 0110
5
6
100 1100 L 101 1001 Y
Increasingly 010 1101
010 1110
-
. 100 1101 M 101 1010 Z
011 0111
011 1000
7
8
010 1111 / 011 1001 9
popular 16-bit Question:
encoding What does this ASCII bit sequence represent?
– Encodes 1010010 1000101 1010011 1010100
characters from
various world a

languages REST
Digital Design 2e
Copyright © 2010 9
Frank Vahid
How to Encode Numbers: Binary Numbers
• Each position represents a
quantity; symbol in position
means how many of that
quantity 5 2 3

– Base ten (decimal) 104 103 102 101 100


• Ten symbols: 0, 1, 2, ..., 8, and 9
• More than 9 -- next position
– So each position power of 10
• Nothing special about base 10 --
used because we have 10 fingers
1 0 1 Q: How much?
– Base two (binary) + =
24 23 22 21 20
• Two symbols: 0 and 1 a

• More than 1 -- next position


– So each position power of 2 4+ 1= 5

Digital Design 2e
Copyright © 2010 10
Frank Vahid
Using Digital Data in a Digital System
• A temperature sensor
outputs temperature in temperature sensor

binary 0 0 1 0 0 0 0 1 "33"

• The system reads the Digital System


temperature, outputs if (input <= "00100000") // "32"

ASCII code: output = "1000110" // "F"


else if (input >= "11010100") // "212"
– “F” for freezing (0-32)
a

output = "1000010" // "B"


– “B” for boiling (212 or more) else
– “N” for normal output = "1001110" // "N"

• A display converts its 1 0 0 1 1 1 0 "N"

ASCII input to the


corresponding letter display N

Digital Design 2e
Copyright © 2010 11
Frank Vahid
Converting from Binary to Decimal
• Just add weights
– 12 is just 1*20, or 110.
– 1102 is 1*22 + 1*21 + 0*20, or 610. We might think of this using base
ten weights: 1*4 + 1*2 + 0*1, or 6.
– 100002 is 1*16 + 0*8 + 0*4 + 0*2 + 0*1, or 1610.
– 100001112 is 1*128 + 1*4 + 1*2 + 1*1 = 13510. Notice this time
a

that we didn’t bother to write the weights having a 0 bit.


– 001102 is the same as 1102 above — the leading 0’s don’t change
the value.
29 28 27 26 25 24 23 22 21 20
Useful to know powers of 2:
512 256 128 64 32 16 8 4 2 1 a

Practice counting up by powers of 2: 512 256 128 64 32 16 8 4 2 1

Digital Design 2e
Copyright © 2010 12
Frank Vahid
Converting from Decimal to Binary
Desired decimal Current Binary
• Put 1 in number: 12 sum number
leftmost 0
16 > 12, too big; 0
place without (a)
Put 0 in 16’s place 16 8 4 2 1
sum
exceeding 8 <= 12, so put 0 1
(b) 1 in 8’s place, 8
number 16 8 4 2 1
current sum is 8
• Track sum
8+4=12 <= 12, so put 0 1 1
a

(c) 1 in 4’s place, 12


16 8 4 2 1
current sum is 12
Reached desired 12,
(d) 0 1 1 0 0
so put 0s in remaining done
16 8 4 2 1
places

Digital Design 2e
Copyright © 2010 13
Frank Vahid
Converting from Decimal to Binary

• Example using Desired decimal Binary


a more number: 23 number
compact 1 0 1 1 1
notation
sum: 0 16 8 4 2 1
16
(a) 16
a
(b) 20
(c) 22
(d) 23
(e)

Digital Design 2e
Copyright © 2010 14
Frank Vahid
Base Sixteen: Another Base Used by Designers
8 A F • Nice because each position
16 4 16 3 162 16 1 16 0 represents four base-two positions
8 A F – Compact way to write binary numbers
1000 1010 1111 • Known as hexadecimal, or just hex
h ex binary h ex bina ry

0 0000 8 1000
1 0001 9 1001
2 0010 A 1010 Q: Write 11110000 in hex
3 0011 B 1011
4 0100 C 1100
5 0101 D 1101 F0 a

6 0110 E 1110
7 0111 F 1111
Q: Convert hex A01 to binary
a

1010 0000 0001


Digital Design 2e
Copyright © 2010 16
Frank Vahid
Decimal to Hex
• Easy method: convert to binary first, then binary to hex

Convert 99 base 10 to hex


0 1 1 0 0 0 1 1
First convert to binary:
a

128 64 32 16 8 4 2 1

Then binary to hex:


6 3

(Quick check: 6*16 + 3*1 = 96+3 = 99) a

Digital Design 2e
Copyright © 2010 17
Frank Vahid
Hex Example: RFID Tag
• Batteryless tag powered by radio field
– Transmits unique identification number
– Example: 32 bit id
• 8-bit province number, 8-bit country number, 16-bit animal number
• Tag contents are in binary
• But programmers use hex when writing/reading

(b)
Province # City # Animal #

(c) Province: 7 City: 160 Animal: 513


(a)
(d) 00000111 10100000 00000010 00000001
(e) 07 A0 02 01
RFID
tag (f) Tag ID in hex: 07A00201

Digital Design 2e
Copyright © 2010 18
Frank Vahid
Converting To/From Binary by Hand: Summary

Decimal Binary
1 1 0 1 0
26 10
16 8 4 2 1
To binary
To decimal
1 1 0 1 0 To hex To octal
16 8 4 2 1 16 + 8 + 2
16+8 = 26 10
16 24 24+2 --
= 24
= 26 1 1010 11 010
= 1A16 = 32 8

Digital Design 2e
Copyright © 2010 19
Frank Vahid
Divide-By-2 Method Common in Automatic Conversion
• Repeatedly divide decimal number by 2, place remainder
in current binary digit (starting from 1s column)
Decimal Binary
6
1. Divide decimal number by 2 2 12 0
Insert remainder into the binary number –12 1
Continue since quotient (6) is greater than 0 0 (current value: 0)

3
2. Divide quotient by 2 2 6 0 0
Insert remainder into the binary number –6 2 1
Continue since quotient (3) is greater than 0 0 (current value: 0)

1
3. Divide quotient by 2 2 3 1 0 0
Insert remainder into the binary number –2 4 2 1 Note:
Continue since quotient (1) is greater than 0 1 (current value: 4) Works for
any base
0
4. Divide quotient by 2 1 1 0 0 N—just
2 1
Insert remainder into the binary number –0 8 4 2 1 divide by
Quotient is 0, done 1 (current value: 12) N instead

Digital Design 2e
Copyright © 2010 20
Frank Vahid
Bytes, Kilobytes, Megabytes, and More
• Byte: 8 bits
• Common metric prefixes:
– kilo (thousand, or 103), mega (million, or 106), giga (billion, or 109),
and tera (trillion, or 1012), e.g., kilobyte, or KByte
• BUT, metric prefixes also commonly used inaccurately
– 216 = 65536 commonly written as “64 Kbyte”
– Typical when describing memory sizes
• Also watch out for “KB” for kilobyte vs. “Kb” for kilobit

Digital Design 2e
Copyright © 2010 21
Frank Vahid
1.3
Implementing Digital Systems: Programming
Microprocessors Vs. Designing Digital Circuits
Programmed Custom designed
Desired motion-at-night detector • Microprocessors a
microprocessor digital circuit common choice to
implement a digital
system
– Easy to program
– Cheap (as low as
$1)
– Readily available

I0 P0 void main() 1
I1 P1 a
{ 0
I2 P2 while (1) { 1
I3 P3 P0 = I0 && !I1; b
I4 P4 0
// F = a and !b,
I5 P5 1
I6 P6 } F
0
I7 P7 }
6:00 7:05 7:06 9:00 9:01 time

Digital Design 2e
Copyright © 2010 22
Frank Vahid
Digital Design: When Microprocessors Aren’t Good
Enough
• With microprocessors so easy,
cheap, and available, why
design a digital circuit?
– Microprocessor may be too
slow Wing controller computation task:
– Or too big, power hungry, or • 50 ms on microprocessor
costly
• 5 ms as custom digital circuit
If must execute 100 times per second:
• 100 * 50 ms = 5000 ms = 5 seconds
• 100 * 5 ms = 500 ms = 0.5 seconds
Microprocessor too slow, circuit OK.

Digital Design 2e
Copyright © 2010 23
Frank Vahid
Digital Design: When Microprocessors Aren’t Good
Enough
• Commonly, designers partition Q: How long for each
a system among a Image Sensor Micro- implementation option?
processor
microprocessor and custom
digital circuits (a) (Read, 5+8+1
Compress,
Memory and Store) =14 sec

Image Sensor Read Compress


circuit circuit
.1+.5+.8
Sample digital camera task execution times (in seconds)
on a microprocessor versus a digital circuit: (b) =1.4 sec
Store a
Memory
circuit
Task Microprocesso Custom
r Digital Circuit
Image Sensor Read Compress
Read 5 0.1 circuit circuit
Compress 8 0.5
.1+.5+1
(c) =1.6 sec
Microprocessor
Memory
Store 1 0.8 (Store) Good
compromise
Digital Design 2e
Copyright © 2010 24
Frank Vahid
Chapter Summary
• Digital systems surround us
– Inside computers
– Inside many other electronic devices (embedded systems)
• Digital systems use 0s and 1s
– Encoding analog signals to digital can provide many benefits
• e.g., audio—higher-quality storage/transmission, compression, etc.
– Encoding integers as 0s and 1s: Binary numbers
• Microprocessors (themselves digital) can implement many
digital systems easily and inexpensively
– But often not good enough—need custom digital circuits

Digital Design 2e
Copyright © 2010 25
Frank Vahid

You might also like