What Is Digital?
Download
Report
Transcript What Is Digital?
CS1103 電機資訊工程實習
What Is Digital?
(Part 1)
Prof. Chung-Ta King
Department of Computer Science
National Tsing Hua University
(Contents from MIT EECS 6.01/6.02, Wikipedia)
What Is This?
1
Music Tapes Were Popular
Not worry about illegal copy?
2
Why Not?
Distortion during copying
Tape worn out
causing more distortions and noises
May be good for copyright, but certainly not
good product
Fundamental problem:
Information recorded in analog form
(and mechanical parts and tape media)
3
Problem Processing in Continuous
How to locate a song in an audio tape?
How to tune to a radio station?
very difficult!
4
It seems ...
representing, processing, and
storing things in discrete/digital
form has benefits
Outline
Continuous versus discrete
Building digital devices
Problems with “continuous”
Going into discrete/digital
IC to digital logic to computing devices
Transforming analog inputs into digital
Transforming digital to analog outputs
6
Continuous versus Discrete
Which are “continuous”?
Color
Light
Cars
Sound
Height and weight
Dogs
Electric current and voltage
English letters
Many natural phenomena are continuous
7
Problems with Continuous Things
Which one is 桃紅色?
Imprecise in communication
8
Problems with Continuous Things
Difficulties in processing and storage:
What if there
is a stain?
Detect/remove a stain in photocopy
Remove background noises from sound recording
Copy from an old tape
9
But Continuous Carries Huge Info.
Let us use “bits” as an indicator of the
amount of information
70 minutes of music ? bits
A4-sized picture ? bits
2 hours of movie (DVD) ? bits
Information carried in continuous things may
be of higher density and processed quicker
10
Analog Signals
Representing continuous things
Example:
Fluctuations in air pressure (i.e. sound) strike the
diaphragm of a microphone, which causes
corresponding fluctuations in a voltage or the
current in an electric circuit
The voltage or current is an "analog" of the sound
voltage
strength
time
time
11
Analog Signals
Analog signaling: simulation or duplication of
one continuous time varying quantity in
another
e.g. sound and voltage; hands of a clock and time
The former may specify properties or information
of some physical phenomena
In electronic circuits, the latter is often voltage,
frequency, current, or charge
American Heritage Science Dictionary:
Measuring or representing data (or things?) by
means of one or more physical properties that can
express any value along a continuous scale
12
Analog Devices
Devices that process analog signals
(Analog) television: encodes television and
transports the picture and sound information as
an analogue signal, e.g. NTSC, PAL
Analog computer: a form of computer that uses
electrical, mechanical or hydraulic phenomena to
model/simulate the problem being solved, e.g.
mathematical functions
13
Disadvantages of Analog
No system is perfect; can’t reliably engineer
perfect components
noise and inaccuracy inevitable
As the analog signal is copied and re-copied,
processed, or transmitted over long distances,
noises or random variations become dominant
‒ May be diminished by using better components, e.g.
shielding, good connections
Noises make signal loss and distorted, impossible
to recover, since amplifying the signal to recover
its attenuated parts amplifies the noise as well
Must design system to tolerate some amount
of error if it is to process information reliably
14
Going into Digital
Easier to communicate if colors are numbered
23
20
37
39
43
46
15
Going into Digital
Can correct some errors
1
2
If the following is received, we know there
must be some errors in transmission and can
correct to the nearest valid one
16
Advantages of Going Digital
Increased robustness
Enables compression of information
Efficient use of resources, e.g. storage and
transmission
Supports a wide variety of contents
Allows error correction to be achieved
Less sensitivity to imperfections, noises, and
environmental interferences
Voice, text, video represented as bit stream
Data copied with no reduction in quality
Easy manipulation and editing
Data can be encrypted
Outline
Continuous versus discrete
Building digital devices
Problems with “continuous”
Going into discrete/digital
IC to digital logic to computing devices
Transforming analog inputs into digital
Transforming digital to analog outputs
18
Digital Devices
A digital system uses discrete (discontinuous)
values to represent information for input,
processing, transmission, storage, etc.
A digital device processes digital information
Representations are discrete, but information
represented can be discrete or continuous
Need a way to represent continuous info. in digital
19
Building Digital Electronic Devices
Electric circuits are built from a basis set of
primitive components such as voltage sources,
resistors, capacitors, inductors and transistors
They carry voltage and current, but voltage
and current are continuous things
How to make digital devices out of them
Much easier if binary
We have the theory: Boolean algebra
We have the component: transistor
20
Transistors
21
A Working Transistor (1/5)
Transistors consist of three terminals: the
source, the gate, and the drain
22
A Working Transistor (2/5)
In the n-type transistor, both the source and
the drain are negatively-charged and sit on a
positively-charged well of p-silicon
23
A Working Transistor (3/5)
When positive voltage is applied to the gate,
electrons in the p-silicon are attracted to the
area under the gate forming an electron
channel between the source and the drain
24
A Working Transistor (4/5)
When positive voltage is applied to the drain,
the electrons are pulled from the source to
the drain. In this state the transistor is on
開
25
A Working Transistor (5/5)
If the voltage at the gate is removed,
electrons are not attracted to the area
between the source and drain. The pathway
is broken and the transistor is turned off
關
26
Transistor as Electronic Switch
“gate” as the switch
27
Transistor Abstraction
Hide the complexity of low-level circuits
28
With Switches, Can Build Logic
CMOS
29
灌溉渠道的類比
Vdd
以水流來控制
閘門開關
水滿水乾
電晶體以電壓
來表達資訊
水乾水滿
灌溉渠道以水流
來表達資訊
CMOS NAND
31
Combining Gates
Full adder:
32
灌溉渠道的類比
運算所用的資料, x, y,
其實是控制邏輯閘
的信號
水庫 (Vdd)
X
Cin
Cout
33
4-Bit Parallel Adder
34
Integrated Circuit (IC)
35
Combinational Circuit
A type of logic circuit whose output is a pure
function of the present input, i.e. y=f(x)
one or more digital inputs/outputs
a functional specification that details the value of
each output for every possible combination of
valid input values
a timing specification on the required time for the
device to compute the specified output values
from an arbitrary set of stable, valid input values
No state
No memory
36
In Reality, Circuits Have Delays
Propagation delay (tPD):
An UPPER BOUND on the delay from valid inputs
to valid outputs
10
01
當輸入端的水道開始由滿到乾
輸出端的水道何時由乾到注滿
37
Key to System Design
A system is a structure that is guaranteed to
exhibit a specified behavior, assuming all of
its components obey specified behaviors
How is this achieved?
Contracts!
Every system component will have clear
obligations and responsibilities
If these are maintained, we have every right to
expect the system to behave as planned
38
The Combinational Contract
• If read output here, guarantee correct/valid value
• No promises during
Timing is important!!!
39
Propagation Delay of Circuit
If NAND gates have a tPD = 4ns
tPD = _______ ns
tPD is the maximum
cumulative propagation
delay over all paths from
inputs to outputs
Contract:
After changing input signals, you must wait at least tPD
until output is steady before you can read the output
40
灌溉渠道的類比
11
01
01
10
要等多久全部水位
才能到達穩定狀態?
41
Can Do Memory from Logic
A logic circuit that can store one bit
(D flip-flop)
產生蓄水池的效果
clock
Often controlled by “clock”
42
Edge-triggered D Flip-Flop
On the rising edge of CLK, the value of D is
saved in the flip-flop and then shortly
afterwards appears on Q
Q
D
CLK
Multiple D flip-flops make a register
43
Sequential Logic
A type of logic circuit whose output depends
not only on the present input but also on the
history of the input, i.e. recorded in the
internal storage, c.f. combinational circuit
蓄水池
44
Synchronous Sequential Logic
There is a 'clock' signal, and all internal
memory (the 'internal state') changes only on
a clock edge
Nearly all sequential logic today is synchronous
Period greater than every combinational delay
Implications:
• Processor clock rate
• Static/dynamic power
clock
Propagation delay
45
Synchronous versus Asynchronous
Synchronous logic is simple
Every operation in the circuit must be completed
inside a fixed interval of time between two clock
pulses, called a clock cycle
As long as this condition is met (ignoring certain
details), the circuit is guaranteed to be reliable
Only care about value of combinational circuits
just before rising edge of clock
Change saved state after noise-inducing logic
transitions have stopped!
46
Problem with Synch. Circuits
Clock must be distributed to every flip-flop in
the circuit
Distribution consumes power and dissipates heat
Distribution causes delays
Maximum possible clock rate determined by
slowest logic path in the circuit, critical path
Every logical calculation must complete in one
clock cycle
Can split complex operations into several simple
operations, a technique known as 'pipelining'
47
With Memory, Logic Computer
暫存器
記憶體
控制信號
控制器
clock
N
Z
IR
ALU
PC
48