Documente Academic
Documente Profesional
Documente Cultură
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
1.1
1995
DVD
players
Cell phones
1997
1999
Video
recorders
Cameras
2001
2003
Musical
instruments
TVs
2005
2007
???
1.2
Digital signal
Finite possible values
Ex: button pressed on a
keypad
digital
signal
a
Possible values:
1.00, 1.01, 2.0000009,
... infinite possibilities
a
time
Digital Design 2e
Copyright 2010
Frank Vahid
value
value
analog
signal
4
3
2
1
0
Possible values:
0, 1, 2, 3, or 4.
Thats it.
time
3
value
1
0
time
Digital Design 2e
Copyright 2010
Frank Vahid
01 10 11 10 11
a2d
1
0
digitized signal
time
time
How fix -- higher, lower, ?
1
0
time
Can fixdistinguish 0s/1s, restore
m
e
01 10 11 10 11
received signal
sa
Sample voltage at
particular rate, save
sample using bit encoding
Voltage levels still not kept
perfectly
But we can distinguish 0s
from 1s
time
3
2
1
0
Higher sampling
rate and more bits per
encoding improves re-creation
Volts
original signal
lengthy transmission
(e.g, cell phone)
3
2
1
0
lengthy transmission
(e.g, cell phone)
Volts
Example of Digitization
Benefit
3
2
1
0
d2a
!"#"$"%&$"'()*+(+,"$-).&()/$'0+)'()!"#"$&1)2+3"&
Digitization Benefit: Can Store on Digital Media
a
a
Digital Design 2e
Digital
Design 2e
Copyright
2010
2010
Frank Copyright
Vahid
Frank Vahid
e.g., MP3s
A CD can hold about 20
songs uncompressed,
but about 200
0000000000 0000000000 0000001111 1111111111
compressed
a
00 00 10000001111 01
sensors and
other inputs
electric
digital
signal
data
A2D
digital
data
Digital Design 2e
Copyright 2010
Frank Vahid
digital
data
D2A
electric
signal
actuators and
other outputs
Digital System
digital
data
button
red
blue green
black
0 0 0
red
blue green
black
0 0 1
red
blue green
black
0 1 0
air
33
degrees
temperature
sensor
0 0 1 0 0 0 0 1
!"#$%"$&'(")*$+*,%-$./0112$3'4(")*
!"#$%"$&'(")*$+*,%-$./0112$3'4(")*
!"#$%"$&'(")*$+*,%-$./0112$3'4(")*
How to Encode Text: ASCII, Unicode
Sample
ASCII
encodings
Sample
ASCII
encodings
Sample
ASCII
encodings
Encoding
Symbol
Sample ASCII encodings
Encoding
Symbol
Encoding
Symbol
Encoding
Sym
Encoding
Symbol
Encoding
Symbol
110
aa
010 0000
<space>
110 0001
a
1100001
0001
010 0000
0000
<space>
010
<space>
Encoding
Symbol
Encoding
Symbol
Encoding
Symbol
Encoding
Symbol
Encoding
Symbol
Encoding
Symbol
110
0010
b
010 0001
!
110 0010
110 0010b
b
010
!!
010 0001
0001
100 100
0001
A A A 100100
0001
1110
N
100
0001
1110
N
...
100
1110
N
010 0010
"
...
010
0010
"
...
010 0010
"
0010
0010
1111
O O O 111
1111
100
0010B B B 100100
yy
1111001
1001
100
1111
010 0011
#
010
## 100 100
111 1001
y
010 0011
0011
100
0011
C
100
0011
C
101
0000
P
101
0000
P
111
1010
z
100
0011
C
111
1010
z
010
0100
$
010 0100
$
101
0000
P
111
1010
z
010 0100
$
0100
100 100
0100
D D D 101101
0001
Q Q
0001
Q
010
0101
%
100
0100
010 0101
%
101
0001
010 0101
%
0101
0010
100 100
0101
0010
R R R 011
010
0110
&
0110000
0000
100
0101E E E 101101
010 0110
&
00
101
0010
010 0110
&
011 0000
0
100
0110
F
101
0011
S
100
0110
F
010 0111'
'
S
0110001
0001
100 0110
F 101 0011
010 0111
011
11
101
0011
S
010 0111
'
011
0001
1
0111
G
0100 T T
100 100
0111
010 1000(
(
0110010
0010
0100
100 0111G
G 101101
010 1000
22
101 0100
T 011
010 1000
(
011 0010
2
100
1000
H
101
0101
U
010
1001
)
011
0011
3
100
1000
H
U
100
1000 I H 101 0101
010 1001
)
011
0011
3
101
0101
U
010
1001
)
011
0011
3
100
1001
0110 V V
010 1010
*
011 0100
4
100 1001
I
101101
0110
100
1001
I
010 1010
*
011
0100
4
101
0110
V
010 1011
1010
100 1010
J
011 01005
4
101 0111
W
010
+*
011 0101
100 1010
0111
W
100
1010J K J 101101
010 1011
+
011 0101
5
101
0111
W
100
1011
010
1011
+
011
0101
5
1000
X
010 1100
,
011 0110
6
100 1011
1000
X
100
1011K L K 101101
010 1100
0110
6
101
1000
1100
1001
Y X 011
010 1101
1100,
011
0110
6
010
- , 100 100
011
0111
7
1100
L M L 101 1001
Y Z Y 011 0111
100
1100
010 1101
7
100
1101
101
1001
101
1010
010
1101
011
0111
7
010 1110
.
011 1000
8
100 1101
M
101 1010
Z
100
1101
M
010 1110
.
011
1000
8
101
1010
Z
010 1111
1110
010
/.
011 10009
8
011 1001
010 1111
011 1001
9
010 1111/
/
011 1001
9
7- 7(or
8-)
ASCII:
ASCII:
ASCII:
7(or
8-)
ASCII:
7-(or
(or8-)
8-)
bit bit
encoding
of of
bit
encoding
of
encoding
bit
encoding
of
each
letter,
each
letter,
each
letter,
each
letter,
number,
or
number,
or
number,
or or
number,
symbol
symbol
symbol
symbol
Unicode:
Unicode:
Unicode:
Unicode:
Increasingly
Increasingly
Increasingly
Increasingly
popular16-bit
16-bit
popular
popular
16-bit
popular
16-bit
encoding
encoding
encoding
encoding
Encodes
Encodes
characters from
Encodes
Encodes
characters
from
various
world
characters
from
characters
from
various
world
languages
various
world
various
world
languages
languages
languages
Digital Design 2e
Digital
Design2e
Copyright
2010
Copyright
2010
Frank Vahid
Digital Design
Frank2e
Vahid
Digital Design 2e
Copyright 2010
Question:
Question:
Question:
Question:
What does
does this
bit
What
this ASCII
ASCII
bitsequence
sequencerepresent?
represent?
What
does
thisthis
ASCII
bit1010011
sequence
represent?
What
does
ASCII
bit sequence
represen
1010010
1000101
1010100
1010010
1000101
1010011
1010100
1010010
1000101
1010011
1010100
1010010
1000101
1010011
1010100
RREESSTT
R ERS ET S T
24
23
22
21
20
Q: How much?
+ =
a
4 + 1= 5
10
temperature sensor
0
"33"
Digital System
if (input <= "00100000") // "32"
output = "1000110" // "F"
else if (input >= "11010100") // "212"
display
"N"
11
29
28
27
26
25
24
23
16 8
22
21
20
Put 1 in
leftmost
place without
sum
exceeding
number
Track sum
Digital Design 2e
Copyright 2010
Frank Vahid
Desired decimal
number: 12
Binary
number
Current
sum
(a)
(b)
0
16 8
0 1
16 8
(c)
12
0 1
16 8
1
4 2
(d)
done
0 1
16 8
1 0
4 2
0
1
13
Example using
a more
compact
notation
Digital Design 2e
Copyright 2010
Frank Vahid
Desired decimal
number: 23
Binary
number
1 0
sum: 0 16 8 4 2 1
16
(a) 16
(b) 20
(c) 22
(d) 23
(e)
14
Ceiling fan
receiver
should be
set in
factory to
respond to
channel
73
Convert 73
to binary,
set DIP
switch
accordingly
Digital Design 2e
Copyright 2010
Frank Vahid
Desired value: 73
Q:
(a)
0 1 0 0 1 0 0 1
128 64 32 16 8
sum:
64
72
(b)
73
DIP switch
channel receiver
"34" 0 0 1 0 0 0 1 0
1
0
"73" 0 1 0 0 1 0 0 1
InA
if (InA = InB)
Out = 1
else
Ceiling fan Out = 0
module
Out
InB
(c)
15
163
162
161
160
binary
hex
binary
0
1
2
3
4
5
6
7
0000
0001
0010
0011
0100
0101
0110
0111
8
9
A
B
C
D
E
F
1000
1001
1010
1011
1100
1101
1110
1111
16
Decimal to Hex
Easy method: convert to binary first, then binary to hex
Convert 99 base 10 to hex
First convert to binary:
0 1 1 0 0 0 1 1
128 64 32 16 8
1
a
6 3
Digital Design 2e
Copyright 2010
Frank Vahid
17
(b)
Province #
(c) Province: 7
(a)
RFID
tag
Digital Design 2e
Copyright 2010
Frank Vahid
(d)
(e)
(f)
00000111
07
City #
Animal #
City: 160
Animal: 513
10100000
00000010 00000001
A0
02 01
!"#$%&'(#)*+",-&".*/(#0&1*21*30#45*67..0&1
Converting To/From Binary by Hand: Summary
Digital Design
Digital
Design2e
2e
Copyright
Copyright
2010
2010
Frank Vahid
Frank Vahid
19
19
Decimal
6
2 12
0
0
1
(current value: 0)
2. Divide quotient by 2
Insert remainder into the binary number
Continue since quotient (3) is greater than 0
3
2 6
0
0 0
2 1
(current value: 0)
3. Divide quotient by 2
Insert remainder into the binary number
Continue since quotient (1) is greater than 0
1
2 3
1
1 0 0
4 2 1
(current value: 4)
4. Divide quotient by 2
Insert remainder into the binary number
Quotient is 0, done
0
2 1
1
1 1 0 0
8 4 2 1
(current value: 12)
Digital
Design
2e 2e
Digital
Design
Copyright
2010
Copyright
2010
Frank
Vahid
Frank
Vahid
Binary
Note:
Note:
Works
for
Works for
any
base
any base
Njust
Njust
divide by
divide
by
instead
NN instead
20 20
Digital Design 2e
Copyright 2010
Frank Vahid
21
1.3
Microprocessors a
common choice to
implement a digital
system
I0
I1
I2
I3
I4
I5
I6
I7
Digital Design 2e
Copyright 2010
Frank Vahid
P0
P1
P2
P3
P4
P5
P6
P7
Easy to program
Cheap (as low as
$1)
Readily available
void main()
1
a
{
0
while (1) {
1
P0 = I0 && !I1; b
0
// F = a and !b,
1
}
F
0
}
6:00
7:057:06
9:009:01
time
22
'LJLWDO'HVLJQ:KHQ0LFURSURFHVVRUV$UHQW*RRG
Digital Design: When Microprocessors Arent Good Enough
!"#$%&
With microprocessors so easy,
Withcheap,
microprocessors
so easy,
and available,
why
cheap,
and aavailable,
why
design
digital circuit?
design
digital circuit?may be too
aMicroprocessor
Digital Design 2e
Copyright 2010
Digital Design
Frank2eVahid
Copyright 2010
Frank Vahid
23
23
Image Sensor
Microprocessor
Custom
Digital Circuit
Read
0.1
Compress
0.5
Store
0.8
Digital Design 2e
Copyright 2010
Frank Vahid
(c)
Memory
5+8+1
=14 sec
(Read,
Compress,
and Store)
Read
circuit
Compress
circuit
.1+.5+.8
=1.4 sec
Store
circuit
Memory
Image Sensor
Read
circuit
Compress
circuit
Microprocessor
(Store)
.1+.5+1
=1.6 sec
Good
compromise
24
Chapter Summary
Digital systems surround us
Inside computers
Inside many other electronic devices (embedded systems)
Digital Design 2e
Copyright 2010
Frank Vahid
25