Академический Документы
Профессиональный Документы
Культура Документы
a bit loud
Analog Computer
Digital Computer
DSP
DAC OUTPUT
ADC
1010 1001
LECTURE 1 1-1
Copyright 1998, Texas Instruments Incorporated All Rights Reserved
A Typical DSP System
MEMORY
DSP Chip
Memory
ADC
Converters (Optional)
DSP
Analog to Digital
Digital to Analog
DAC
Communication Ports
Serial
Parallel
PORTS
LECTURE 1 1-2
Copyright 1998, Texas Instruments Incorporated All Rights Reserved
Multiply and Add
Add 1+2 = 3 Multiply 5*3 = 15
A = B*C + D
Typically 70 Clock Cycles With
E = F*G + A Ordinary Processors
..
.
Multiply, Add, and Accumulate Typically 1 Clock Cycle With
MAC Instruction Digital Signal Processors
LECTURE 1 1-3
Copyright 1998, Texas Instruments Incorporated All Rights Reserved
Drop in Multiplication Times
TIME (ns)
600
500
400
300
200
100
0 5 ns
LECTURE 1 1-4
Copyright 1998, Texas Instruments Incorporated All Rights Reserved
Digital Computers
von Neuman Machine
A
STORED ARITHMETIC
PROGRAM INPUT/ A = ADDRESS
LOGIC
AND D OUTPUT
UNIT D = DATA
DATA
Harvard Architecture
A A
ARITHMETIC
STORED INPUT/ STORED
LOGIC
PROGRAM OUTPUT DATA
UNIT
D D
LECTURE 1 1-5
Copyright 1998, Texas Instruments Incorporated All Rights Reserved
An Example
TMS320C31 Architecture
CACHE RAM 0 RAM 1
64 x 32 1K x 32 1K x 32
A23-A0
7 SEPARATE BUSES ( P / D )
D31-D0
DMA SERIAL
PORT 0
MULTIPLIER ADDER
TIMER 1
LECTURE 1 1-6
Copyright 1998, Texas Instruments Incorporated All Rights Reserved
DSP Development
ADD A, B
CODE TEST
N
OK?
DSP
Y
PRODUCT
Tools of the Trade
LECTURE 1 1-7
Copyright 1998, Texas Instruments Incorporated All Rights Reserved
Why Digital Processing?
Programmability
Stability
Repeatability
Special Applications
LECTURE 1 1-8
Copyright 1998, Texas Instruments Incorporated All Rights Reserved
Programmability
One Hardware = Many Tasks
LECTURE 1 1-9
Copyright 1998, Texas Instruments Incorporated All Rights Reserved
Analog Variability
Tolerance of Components
Two Analog Systems using the same design and
components may differ in performance
LECTURE 1 1-10
Copyright 1998, Texas Instruments Incorporated All Rights Reserved
Digital Repeatability
Perfect Reproducibility
Nearly identical performance from unit to unit
Performance not affected by tolerance
No drift in performance due to temperature or aging
Guaranteed accuracy
LECTURE 1 1-11
Copyright 1998, Texas Instruments Incorporated All Rights Reserved
Performance
Some special functions are best implemented
digitally
Lossless Compression
gain f phase
frequency frequency
f1 f2
LECTURE 1 1-12
Copyright 1998, Texas Instruments Incorporated All Rights Reserved
Practical DSP Systems
Hi-Fi Equipment
Toys
Videophones
Modems
Phone Systems
3D Graphics
Image Processing
And More ...
LECTURE 1 1-13
Copyright 1998, Texas Instruments Incorporated All Rights Reserved
Analog Advantages
Low cost and simplicity in some applications
– Attenuators/amplifiers
– Simple filters
Wide bandwidth (GHz)
Low signal levels
Infinite effective sampling rate
– Infinite resolution in frequency
– No aliasing/reconstruction issues
Infinite resolution in amplitude
– No quantitation noise
LECTURE 1 1-14
Copyright 1998, Texas Instruments Incorporated All Rights Reserved
Digital Signal Processing (DSP)
Advantages
Repeatability
– Low sensitivity to component tolerances
– Low sensitivity to temperature changes
– Low sensitivity to aging effects
– Nearly identical performance from unit to unit
– Matched circuits cost less
LECTURE 1 1-15
Copyright 1998, Texas Instruments Incorporated All Rights Reserved
Analog’s Place in DSP
Most transducers are analog by nature
– Microphones, speakers, etc.
Analog circuits are required to pre-process low
level signals before ADC
Analog filters may be required to limit the
bandwidth of signals
– Anti-alias (before ADC) and reconstruction filters (after
DAC)
Analog circuits may be required to drive output
transducers
– A power amplifier is required to enable a DAC to drive
a speaker
LECTURE 1 1-16
Copyright 1998, Texas Instruments Incorporated All Rights Reserved
Number Systems
Represent numbers digitally
Decimal 128 64 32 16 8 4 2 1
Digit Number 7 6 5 4 3 2 1
2 2 2 2 2 2 2 2 20
Digit Number 7 6 5 4 3 2 1 0
Decimal 3 in binary
Decimal 0 0 0 0 0 0 2+ 1= 3
Digit Number 7 6 5 4 3 2 1 0
2 2 2 2 2 2 2 2 2
Digit Number 7 6 5 4 3 2 1 0
Binary 0 0 0 0 0 0 1 1 0000 0011
Decimal 26 in binary
Decimal 0 0 0 16+ 8+ 0 2= 0 26
Digit Number 7 6 5 4 3 2 1 0
2 2 2 2 2 2 2 2 2
Digit Number 7 6 5 4 3 2 1 0
Binary 0 0 0 1 1 0 1 0 0001 1010
LECTURE 1 1-17
Copyright 1998, Texas Instruments Incorporated All Rights Reserved
Binary and Hex
Decimal 0,1,2,…….,9
16 Decimal 0x10 Hex
Binary 0,1
20 Decimal 0x14 Hex
Hex 0,1,2,……..,A,B,C,D,E,F
LECTURE 1 1-18
Copyright 1998, Texas Instruments Incorporated All Rights Reserved
Signed Integers
Signed
Decimal Binary
Hex
Sign Number
2 00 00 00 02 0 000 0000 0000 0000 0000 0000 0000 0010
3 00 00 00 03 0 000 0000 0000 0000 0000 0000 0000 0011
-2 80 00 00 02 1 000 0000 0000 0000 0000 0000 0000 0010
-3 80 00 00 03 1 000 0000 0000 0000 0000 0000 0000 0011
LECTURE 1 1-19
Copyright 1998, Texas Instruments Incorporated All Rights Reserved
Two’s Complement Notation
LECTURE 1 1-20
Copyright 1998, Texas Instruments Incorporated All Rights Reserved
Two’s Complement
Conversion to two’s complement notation
Binary
Action Decimal
Sign Number
Signed integer -2 1 000 0000 0000 0000 0000 0000 0000 0010
Strip sign bit 0 000 0000 0000 0000 0000 0000 0000 0010
Invert 1 111 1111 1111 1111 1111 1111 1111 1101
Add one 1 1
Two’s complement 1 111 1111 1111 1111 1111 1111 1111 1110
Hex F F F F F F F E
LECTURE 1 1-21
Copyright 1998, Texas Instruments Incorporated All Rights Reserved
Fixed-Point Notation
Conventions
Number range is between 1 and -1
Decimal point is always in a fixed location (e.g., 0.74, 0.34, etc.)
Multiplying a fraction by a fraction always results in a fraction and will
not produce an overflow (e.g., 0.99 x 0.9999 = less than 1)
Successive additions may cause overflow
Why?
Signal processing is multiplication-intensive
Fixed-point notation prevents overflow (useful with a small dynamic
range)
Fixed-point notation is less expensive
How is fixed-point notation realized in a DSP?
Most fixed-point DSPs are 16 bits
The range of numbers that can be represented is 32767 to -32768
The most common fixed-point format is Q15
Q15 Notation
Bit 15 Bits 14 to 0
sign two’s complement number
LECTURE 1 1-22
Copyright 1998, Texas Instruments Incorporated All Rights Reserved
Q15 Format
Dynamic range in Q15
Number Biggest Smallest
Fractional number 0.999 -1.000
Scaled integer for Q15 32767 -32768
LECTURE 1 1-23
Copyright 1998, Texas Instruments Incorporated All Rights Reserved
Q15 Operations
Addition
Decimal Q15 Scale back
Q15 / 32767
0.5 + 0.05 = 0.55 16384 + 1638 = 0.55
18022
0.5 – 0.05 = 0.45 16384 – 1638 =
Multiplication
2 x 0.5 x 0.45 =
Decimal Q15 Back to Q15 Scale back
Product / 32767 Q15 / 32767
0.5 x 0.45 = 0.225 16384 x 14745 = 7373
241584537
0.225 + 0.225 = 0.45 7373 + 7373 = 0.45
14746
LECTURE 1 1-24
Copyright 1998, Texas Instruments Incorporated All Rights Reserved
TMS Floating-Point Format
TMS single-precision floating-point format
31 ... 24 23 22 .............. 0 Bit No
e s f
8 bits 1 bit 23 bits
Special case
s=0 X=0 e = -128 Exponent (e)
Decimal 0 1 127 -1 -128
Hex
two’s comp. 00 01 7F FF 80
LECTURE 1 1-25
Copyright 1998, Texas Instruments Incorporated All Rights Reserved
Floating-Point Numbers
Calculate 1.0e0
In hex 00 00 00 00
In binary 0000 0000 0000 0000 0000 0000 0000 0000
s=0 Equation 1 applies: X = 01.f x2 e
f=0
e=0
01.0 x 20 = 1.0
Calculate 1.5e01
In hex 03 70 00 00
In binary 0011 0111 0000 0000 0000 0000 0000 0000
s=0 Equation 1 applies: X = 01.f x2 e
LECTURE 1 1-26
Copyright 1998, Texas Instruments Incorporated All Rights Reserved
More on Floating Point
Calculate -2.0e0
In hex 00 80 00 00
In binary 0000 0000 1000 0000 0000 0000 0000 0000
s=1 Equation 2 applies: X = ( -2.0 + 0.f ) x 2 e
f=0
e=0
( -2.0 + 0.0 ) x 20 = -2.0
Addition
1.5 + (-2.0) = 0.5
Multiplication
1.5e00 x 1.5e01 = 2.25e01 = 22.5
LECTURE 1 1-27
Copyright 1998, Texas Instruments Incorporated All Rights Reserved
Dynamic Range
Ranges of number systems
Two’s
Numbers Base 2 Decimal Complement
Hex
31
Largest Integer 2 -1 2 147 483 647 7F FF FF FF
31
Smallest Integer -2 -2 147 483 648 80 00 00 00
15
Largest Q15 2 -1 32 767 7F FF
15
Smallest Q15 -2 -32 768 80 00
-23 127 38
Largest Floating Point (2-2 )x2 3.402823 x 10 7F 7F FF FD
127 38
Smallest Floating Point -2 x 2 -3.402823 x 10 83 39 44 6E
LECTURE 1 1-28
Copyright 1998, Texas Instruments Incorporated All Rights Reserved
Fixed vs. Floating Point
DSP devices are designed as floating point or fixed point
Fixed-point devices are usually 16-bits, e.g. TMS320C5x
Floating-point devices are usually 32-bits, e.g. TMS320C3x
Floating-point devices usually have a full set of fixed-point instructions
Floating point devices are easier to program
Fixed-point devices can emulate floating point in software
Comparison
Characteristic Floating point Fixed point
Dynamic range much larger smaller
Resolution comparable comparable
Speed comparable comparable
Ease of programming much easier more difficult
Compiler efficiency more efficient less efficient
Power consumption comparable comparable
Chip cost comparable comparable
System cost comparable comparable
Design cost less more
Time to market faster slower
LECTURE 1 1-29
Copyright 1998, Texas Instruments Incorporated All Rights Reserved
TMS320 Family
16-Bit Fixed Point Devices 32-Bit Floating Point Devices
LECTURE 1 1-30
Copyright 1998, Texas Instruments Incorporated All Rights Reserved
TMS320C54x Architecture
System control Program address generation Data address generation
interface logic (PAGEN) logic (DAGEN)
ARAU0, ARAU1
PC, IPTR, RC, AR0-AR7
BRC, RSA, REA ARP, BK, DP, SP
PA
B
P
B Memory
and
CA external
B interface
C
B
DA
B
D Peripheral
interface
B
EA
B
E
B
EXP
encoder
X D A B
MUX
T register
T D A P C D T A B C D S B A C D
A
Sign ctr Sign ctr A(40) B(40) Sign ctr Sign ctr Sign ctr
LECTURE 1 1-31
Copyright 1998, Texas Instruments Incorporated All Rights Reserved
ALU Functional Diagram
CB15 - CB0
DB15 - DB0
T
Y X OVM
A B
C16
C
ACC
ALU OVA/OVB
ZA/ZB
MUX TC
40
40 Legend:
A M U B A Accumulator A
40 B Accumulator B
C CB data bus
D DB data bus
MAC M MAC unit
output S Barrel shifter
T T register
U ALU
LECTURE 1 1-32
Copyright 1998, Texas Instruments Incorporated All Rights Reserved
Two C54x Memory Maps
'541 Program Memory '541 Data Memory
0000h OVLY = 0 0000h-13FFh External 0000h 0000h-005Fh Memory-mapped registers
OVLY = 1 0000h-007Fh Reserved 0060h-007Fh Scratch-pad DARAM
0080h-13FFh On-chip DARAM 0080h-13FFh On-chip DARAM
2000h 2000h
4000h 4000h
1400h-8FFFh External
6000h 6000h
1400h-DFFFh External
8000h 8000h
A000h A000h
LECTURE 1 1-33
Copyright 1998, Texas Instruments Incorporated All Rights Reserved
Direct Addressing Block Diagram
DP(9)
SP(16)
DAB(16) (read)
DAGEN
CPL CPL
LECTURE 1 1-34
Copyright 1998, Texas Instruments Incorporated All Rights Reserved
C54x Program Memory
PAGEN
PC
Repeat registers
RC
BRC
RSA
REA
LECTURE 1 1-35
Copyright 1998, Texas Instruments Incorporated All Rights Reserved
C54x Pipeline
Loads PAB with Loads IR with the contents Loads DB with the data1
the PC's contents of PB read operand
Decodes the IR's contents Loads CB with the data2
read operand
Loads EAB with the data3
write address, if required
Loads PB with the Loads DAB with the data1 read Executes the instruction
fetched instruction address, if required and loads EB with write
word Loads CAB with the data2 read data
address, if required
Updates auxiliary registers and
stack pointer
Time
LECTURE 1 1-36
Copyright 1998, Texas Instruments Incorporated All Rights Reserved
Serial Port Interface Block
Diagram
Data Bus
16 16
Load
(Load) control
DRR (16) logic DXR (16)
16 16
RINT on XINT on
Load (Load)
RSR-DRR DXR-XSR
Control
transfer transfer
Logic
(Clear) (Clear)
Byte/word Byte/word
counter (Clock) (Clock) counter
FSR FSX
DR CLKR CLKX DX
LECTURE 1 1-37
Copyright 1998, Texas Instruments Incorporated All Rights Reserved
C54x External Bus Interface
CLKOUT
PB Fetch
CB/DB Reads
EB Write
A(22 - 0)
LECTURE 1 1-38
Copyright 1998, Texas Instruments Incorporated All Rights Reserved