CH 01
CH 01
Chapter 1: Introduction
Digital Design, with RTL Design, VHDL, and Verilog, 2nd Edition,
by Frank Vahid, John Wiley and Sons Publishers, 2010.
1.1
DVD
players
Cell phones
1997
1999
Video
recorders
Cameras
2001
2003
Musical
instruments
TVs
2005
2007
???
1.2
Digital signal
Sound waves
move the
membrane,
which moves
the magnet,
microphone
digital
di
i l
signal
analog
signal
Possible values:
1.00, 1.01, 2.0000009,
... infinite p
possibilities
a
time
i
vaalue
vaalue
which creates
current in the nearby wire
4
3
2
1
0
Possible values:
0, 1, 2, 3, or 4.
Thatss it
That
it.
time
3
value
1
0
time
time
3
2
i d signal
i l
1 received
0
time
How fix -- higher,
g , lower,, ?
01 10 11 10 11
a2d
1 digitized signal
0
time
1
0
time
Can fixdistinguish 0s/1s, restore
Volts
original
i i l signal
i l
lengthy tran
nsmission
(e.g, cell phone)
3
2
1
0
lengthy trransmission
(e.g, celll phone)
Volts
Example of Digitization
Benefit
d2a
3
2
1
0
Volts
3
1
samples
wire
microphone
00 01 10 10 11 11 11 01 10 10 00 time
analog-todigital
converter
digitized signal
0001101011111101101000
( )
(a)
wire
3
V
Volts
digital-todi
it l t
analog
converter
analog signal
reproduced from
digitized signal
2
1
0
00 01 10 10 11 11 11 01 10 10 00 time
(b)
speaker
00 00 10000001111 01
sensors and
other inputs
electric
di it l
digital
signal
data
A2D
digital
d t
data
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
Encoding Symbol
010 0000 <space>
010 0001
!
010 0010
"
010 0011
#
010 0100
$
010 0101
%
010 0110
&
010 0111
'
010 1000
(
010 1001
)
010 1010
*
010 1011
+
010 1100
,
010 1101
010 1110
.
010 1111
/
Encoding
cod g Symbol
Sy bo
100 1110
N
100 1111
O
101 0000
P
101 0001
Q
101 0010
R
101 0011
S
101 0100
T
101 0101
U
101 0110
V
101 0111
W
101 1000
X
101 1001
Y
101 1010
Z
Encoding Symbol
110 0001
110 0010
...
111 1001
111 1010
a
b
011 0000
011 0001
011 0010
011 0011
011 0100
011 0101
011 0110
011 0111
011 1000
011 1001
0
1
2
3
4
5
6
7
8
9
y
z
Question:
What does this ASCII bit sequence represent?
1010010 1000101 1010011 1010100
a
REST
9
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"
1000110 // "F"
F
else if (input >= "11010100") // "212"
display
"N"
11
28
27
26
25
24
23
22
21
20
16 8
Put 1 in
leftmost
place without
sum
exceeding
number
Track sum
Desired decimal
number: 12
Binary
number
Current
sum
0
(a)
(b)
((c))
12
0 1
16 8
1
4 2
((d))
done
do
e
0 1
16 8
1 0
4 2
0
1
16 8
0 1
16 8
1
a
13
Example using
a more
compact
notation
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
Example: DIP
DIP-Switch
Switch Controlled Channel
Ceiling fan
receiver
should be
set in
f t
factory
to
t
respond to
channel
73
Convert 73
to binary
binary,
set DIP
switch
accordingly
Desired value: 73
a
0 1 0 0 1 0 0 1
Q:
(a)
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
bina ry
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
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
17
(b)
Province #
(c) Province: 7
(a)
(d)
(e)
RFID
tag
(f)
00000111
07
City #
Animal #
City: 160
Animal: 513
10100000
00000010 00000001
A0
02 01
18
26 10
16
Binary
1
0
1
To binary
T decimal
To
d i l
1
16
16
16+8
= 24
24
24+2
= 26
--
To hex To octal
16 + 8 + 2
= 26 10
1 1010
= 1A16
11 010
= 32 8
19
Divide-By-2
Divide
By 2 Method Common in Automatic Conversion
Repeatedly divide decimal number by 2, place remainder
i currentt binary
in
bi
digit
di it ((starting
t ti ffrom 1
1s column)
l
)
1. Divide decimal number by 2
Insert remainder into the binary number
Continue since quotient (6) is greater than 0
Decimal
6
2 12
12
0
Binary
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
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
2
1
1 0 0
4 2 1
(current value: 4)
4. Divide quotient by 2
Insert remainder into the binary number
Quotient is 0,
0 done
0
2 1
0
1
1 1 0 0
8 4 2 1
((current value: 12))
Note:
Works ffor
any base
Njust
divide by
N instead
20
21
1.3
microprocessor
digital circuit
Microprocessors a
common choice to
implement a digital
system
I0
I1
I2
I3
I4
I5
I6
I7
P0
P1
P2
P3
P4
P5
P6
P7
Easy
y to p
program
g
Cheap (as low as
$1)
Readily available
void main()
1
a
{
0
while (1) {
1
b
P0 = I0 && !I1;
0
// F = a and !b,
1
F
}
0
}
6:00
7:057:06
9:009:01
time
22
Wing
g controller computation
p
task:
50 ms on microprocessor
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
Mi
Microprocessor
ttoo slow,
l
circuit
i it OK.
OK
23
Image
g Sensor
(a)
Memory
Image Sensor
Microprocessor
Custom
Digital Circuit
Read
0.1
Compress
0.5
Store
0.8
Microprocessor
(Read,
Compress,
and Store)
Read
circuit
5+8+1
=14
14 sec
Compress
circuit
(b)
Store
circuit
Memory
Image Sensor
(c)
Memory
.1+.5+.8
=1.4 sec
Read
circuit
Compress
circuit
Microprocessor
(Store)
.1+.5+1
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 ssystems
stems use
se 0s and 1s
Encoding analog signals to digital can provide many benefits
e.g., audio
audiohigher-quality
higher quality storage/transmission, compression, etc.
Microprocessors
p
((themselves digital)
g ) can implement
p
many
y
digital systems easily and inexpensively
But often not good enoughneed custom digital circuits
25