Académique Documents
Professionnel Documents
Culture Documents
Chapter 1: Introduction
2
which moves digital
the magnet,
signal
microphone
analog
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
1
0
time time
Digital Design
Copyright © 2007 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
Copyright © 2007 4
Frank Vahid
Example of Digitization Benefit
• Analog signal (e.g., audio)
lengthy transmission
Volts
lengthy transmission
a2d
Volts
a
sample using bit encoding
– Voltage levels still not kept 1 digitized signal 1
perfectly 0
– But we can distinguish 0s 0
from 1s time time
Can fix -- easily distinguish 0s
Let bit encoding be: 01 10 11 10 11 sa and 1s, restore
1 V: “01” Digitized signal not d2a m
2 V: “10” perfect re-creation, e
Volts
3
3 V: “11” but higher sampling
rate and more bits per 2
Digital Design
encoding brings closer. 1
Copyright © 2007 0 time 5
Frank Vahid
Digitized Audio: Compression Benefit
• Digitized audio can be Example compression scheme:
compressed 00 --> 0000000000
01 --> 1111111111
– e.g., MP3s 1X --> X
– A CD can hold about 20
songs uncompressed, 0000000000 0000000000 0000001111 111111111
but about 200
compressed 00 00 10000001111 01
digital
data – Just need encoding in binary 0 0 1
– e.g., multi-button input:
Digital System encode red=001, red blue green black
Digital Design 0 0 1 0 0 0 0 1
Copyright © 2007 7
Frank Vahid
How to Encode Text: ASCII, Unicode
• ASCII: 7- (or 8-) bit Symbol Encoding Symbol Encoding
Question:
What does this ASCII bit sequence represent?
1010010 1000101 1010011 1010100
REST
Digital Design
Copyright © 2007 Note: small red “a” (a) in a slide indicates animation 8
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
– Base two (binary)
1 0 1 Q: How much?
24 23 22 21 20 + =
• Two symbols: 0 and 1 a
Digital Design
Copyright © 2007 10
Frank Vahid
Converting from Decimal to Binary Numbers:
Subtraction Method (Easy for Humans)
• Goal Desired decimal number: 12
– Get the binary weights to add up
to the decimal quantity 32 16 8 4 2 1
• Work from left to right 1 =32
too much
• (Right to left – may fill in 1s that 32 16 8 4 2 1
shouldn’t have been there – try it). =16
0 1
32 16 8 4 2 1 too much
a
0 0 1 =8
32 16 8 4 2 1 ok, keep going
0 0 1 1 =8+4=12
32 16 8 4 2 1 DONE
0 0 1 1 0 0 answer
32 16 8 4 2 1
Digital Design
Copyright © 2007 11
Frank Vahid
Converting from Decimal to Binary Numbers:
Subtraction Method (Easy for Humans)
• Subtraction method Remaining quantity: 12
– To make the job easier (especially
for big numbers), we can just 32 16 8 4 2 1
subtract a selected binary weight 1 32 is
from the (remaining) quantity too much
32 16 8 4 2 1
• Then, we have a new remaining
0 1 16 is
quantity, and we start again (from 32 16 8 4 2 1
too much
the present binary position) a
0 0 1 1 4-4=0
32 16 8 4 2 1 DONE
0 0 1 1 0 0 answer
32 16 8 4 2 1
Digital Design
Copyright © 2007 12
Frank Vahid
Converting from Decimal to Binary Numbers:
Subtraction Method Example
• Q: Convert the number “23” from decimal to binary
A: Remaining quantity Binary Number
23 0 0 0 0 0 0
32 16 8 4 2 1
23 0 1 0 0 0 0
-16 32 16 8 4 2 1
a
7
7 0 1 0 1 0 0
-4 32 16 8 4 2 1
3 8 is more than 7, can’t use
4 0 1 0 1 1 0
-2 32 16 8 4 2 1
1
1 0 1 0 1 1 1
-1 32 16 8 4 2 1
Digital Design 0
Copyright © 2007 Done! 23 in decimal is 10111 in binary. 13
Frank Vahid
Converting from Decimal to Binary Numbers:
Division Method (Good for Computers)
• Divide decimal number by 2 and insert remainder into new binary
number.
– Continue dividing quotient by 2 until the quotient is 0.
• Example: Convert decimal number 12 to binary
Decimal Number Binary Number
6
2 12 divide by 2 0
-12 1
0
insert remainder
Digital Design
Copyright © 2007 15
Frank Vahid
Base Sixteen: Another Base Sometimes Used by
Digital Designers
8 A F • Nice because each position
164 163 162 161 160 represents four base two positions
8 A F – Used as compact means to write
1000 1010 1111
binary numbers
Digital Design
Copyright © 2007 16
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)
– Available now
I0 P0 void main() 1
ro 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:057:06 9:009:01 time
Digital Design
Copyright © 2007 17
Frank Vahid
Digital Design: When Microprocessors Aren’t Good
Enough
• With microprocessors so easy, Q: How long for each
Image Sensor Micro-
cheap, and available, why implementation option?
processor
design a digital circuit?
– Microprocessor may be too (a) (Read, 5+8+11
Compress,
slow Memory and Store) =24 sec
– Or too big, power hungry, or
costly Image Read Compress
Sensor circuit circuit
.1+.5+.8
Sample digital camera task execution
(b) =1.4 sec
times (in seconds) on a microprocessor
Store a
versus a digital circuit: Memory
circuit
Digital Design
Copyright © 2007 19
Frank Vahid