Real-Time Digital Signal Processing Intro

Τεχνίτη Νοημοσύνη και Ρομποτική

24 Νοε 2013 (πριν από 4 χρόνια και 5 μήνες)

87 εμφανίσεις

Real
-
Time Digital Signal Processing

Intro

I. Basic Definitions
/Concepts

A. Signal Processing

is the analysis, modification, and extraction of information from a
signal.

B. Analog Signal Processing

is concerned with a continuous
-
time signals and u
sing
analog devices (filters, modulators, and amplifiers) to ‘process’ the signal.

C
. Digital Signal Processing

is concerned with a digital representation of the signal and
then

using digital hardware to ‘process’ the signal.

D. Real
-
time DSP

is when

the processing of the signal occurs during the time between
samples of the signal.

II. Digital techniques vs. Analog techniques (circuitry)

A. Advantages of digital techniques

1. Flexibility
-

can easily modify & upgrade through SW

2.
Reproduci
bility of results from one unit to another

because DSP works with
binary sequences. Analog circuits have component tolerances.

3. Reliability
-

memory and logic don’t slowly ‘go bad’ with time and are not
effected by temperature.

4. Complexity

com
plex algorithms can be implemented on lightweight and low
power portable devices.

5. Only solution

some algorithms can only be done in the digital domain: linear
phase filters,
adaptive filters,
data compression, error correcting codes

6. Low overa
ll cost

B. Disadvantages of digital techniques

Reasons to go analog

1. BW
-
limited by sampling rate and peripherals

can’t
process high frequencies

2. Initial design cost may be expensive (esp. for large BW signals)

3. Data size

a fixed number o
f bits means limited range and quantization and

arithmetic errors (may not get theoretical performance).

4. Application too complex to do in RT

III. Basic Elements of a RTDSP System

(Fig 1)

A
. A/D Conversion

Consists of two functions

1. Sampl
ing

at every T, sampling period.

Sampling frequency
f
s

= 1/T

The sampling frequency must be 2x the highest frequency in the signal or
aliasing will occur. Aliasing means signals greater than f
s
/2 are ‘folding into’ or
‘showing up’ at l
ower frequencies. You can’t reconstruct the signal.

Some typical sampling frequencies:

-

Voice communications

8kHz

-

Audio CDs

44.1 kHz

-

Video

1
-
14MH
z

Timing jitter can be a problem but usually small with a high
-
precision clock.

2. Quantizing and Encod
ing

is the process needed to represent the signal as a binary
number

Quantizing represents the s
ample with

one of 2
B

levels, B=number of bits

Encoding represents the level with a binary word of B bits.

Quantization error is the difference between the
analog value and the quantized
value. Also called quantization noise. SNR ~= 6B dB

Potential problem is that you make be able to represent loud signals well but soft
sounds may not be distinguishable. One way to deal with this is the signal is first
‘c
ompressed’

an example is to apply a logarithmic scale to the input so that the
logarithmic
-
scaled input signal is quantized. After processing, the signal is
reconstructed by ‘expanding’ it. This is called companding (compressing and
expanding).

3. If
you are receiving a digital signal, you need to know at what sampling frequency
it was sampled. Then for your system you may need to do:

-

interpolation: increase the effective sampling rate

-

decimation: decrease the effective sampling rate

B. Inpu
t signal conditioning

preparing the analog signal for A/D conversion

1. Amplifier

provides a gain so that the range of the input signal matches the range
of the A/D. (Automatic Gain Controller

AGC

gain which varies with time)

2. Anti
-
aliasing
filter

a low
-
pass or band
-
pass filter
-

reduces the components of the
signal with frequencies greater than the Nyquist frequency.

A potential problem is that a filter introduces phase which may be non
-
linear. If
the ‘roll
-
off’ is steep, then the phase

effects are much greater. So often
‘oversample’, i.e. sample at greater than the Nyquist rate (2xf
s
), so you don’t need
a filter with a sharp roll
-
off.

C. D/A conversion

zero
-
order hold

convert digital
input to analog and hold it for
T
secs.

D. R
econstruction filter

a smoothing filter

low pass filter

E. Codecs

coder/decoder

a single chip with an anti
-
aliasing filter, an A/D, a D/A, and
a reconstruction filter.

Use a standard for quantization

A law or mu
-
law
(logarithmic quantizer) for
communications

based on application.

F. DSP Hardware

1. Options available based on requirements

a. General
-
purpose microprocessors
. Use when need large memory or advanced
operating systems. Size and power not an issue.

-

programmable so flex
ible, low
-
medium speed

-

short design time, development cost low

-

production cost low
-
medium

-

power consumption
-

medium

b. General
-
purpose digital signal processor (DSP chips)

basically a
microprocessor whose architecture has been optim
ized for DSP tasks

like
multiplication, summing, and looping.

Multiplication and add can be done in one
cycle.

Several accesses to memory in one instruction cycle, unlike
microprocessor. Special addressing modes (indirect and circular) efficient to
impl
ement many signal processing algorithms.

-

programmable so flexible, medium
-
high speed

-

short design time, development cost low

-

production cost

low
-
medium

-

power consumption low
-
medium

c. Digital building blocks such as multiplier,

adder, program controller

-

build a custom DSP architecture, not flexible but fast

-

design time medium, development cost medium

-

production (components) cost high

-

power consumption medium
-
high

-
reliability low
-
medium

d. Applicat
ion
-
specific integrated circuits (ASIC)

-

designed for specific tasks that require a lot of MIPS, not flexible but fast

-

design time high, development cost high

-

production cost low

-

power consumption low

IV.
Some t
hings to consider in

choosing a DSP

A. Fixed or Floating Point

1. Fixed point

represent a number in 16 or 24 bit integer format. Intermediate
values may be 32 bit.

a.
Cheaper and faster. Have to apply scaling factors to prevent arithmetic
overflow.

This is time c
onsuming and difficult.

b.
Often use ‘
fixed
-
point fractional representation

: The data is scaled so values
lie between
-
1 and 1.

X =
b
0

.
b
1
b
2

b
M

b
0

sign bit

2. Floating point

stores a 24 bit mantissa and an 8 bit exponent. Large
range.
Resolution is still only 24 bits.
Use when coefficients vary in time, signals have a
large range, or development costs are high.

B. Processing time measures

are based on the clock

(150MHz for our case)

1. MACS

multiplies and accumulates. I
f 2 per clock cycle, the
n

300 million MAC
s
per second

2. MFLOPS

million floating
-
point operations per second

If 6 units capable of doing floating
-
point operations, then can do 900MFLOPS

3. MIPS

million of instructions per second

If 8 units capa
ble of doing fixed and floating
-
point operations, then have a
1200MIPS system.

C. Misc

1.
Software development tools, simulators?

2. Commercially available DSP boards for SW development and testing before the
target DSP HW is available?

3. The like
lihood of having higher
-
performance devices with upwards
-
compatible
SW in the future.

V. Software and SW development tools

A. Programming a DSP

1. Language

options

a.

C/C++ high level with access to low
-
level routines.

Portable

Easier for SW upgrades and maintenance

C compilers
/optimizers

much more efficient

b. Assembly (.asm)

one step from machine code.
Gives engineer full control of
processor functions, so allows for optimizing the program by hand.

Time
-
consuming

c
. Linear assembly

(.sa)

-

a compromise between coding effort and coding
efficiency. A cross between C and assembly. An
assembler optimizer

creates
an assembly source program (.asm).

2. Choice of Language

Efficie
ncy

Coding Effort

C Compiler/Optimizer 50
-
80% Low

Linear Assembler/Optimizer 80
-
100% Medium

ASM

ASM Hand Optimized 100% High

In practice, start with C.

If processing rate not met, time
-
consuming portions identified and converted to
linear assembly or assembly.

Result: overall program controlled by C.

Critical loops in assembly which
are

in
-
line coded
in C or called as a
function.

B. Development tools

need development tools to create programs, compile, assemble,
link, debug, simulate, benchmark, memory viewing, etc.

VI. Our system

A. General description: We will be working with the TI TMS320C6711

DSP chip. For
development purposes, the chip is on a board which has additional (external) memory
and a codec for input and output along with a
daughter card expansion (connector)

for
other types of I/O. This board is called the C6711 DSK (DSP Starter K
it). The DSK
comes with development software called Code Composer Studio (CCS) to develop
the programs, load them onto the DSP chip, and analyze their performance.

B. C6711 chip: Floating
-
point DSP, 150MHz clock, 900MFLOPS, 1200MIPS

Can fetch 8 32
-
bit
instructions per cycle.

72kB internal memory, 8 functional or execution units, 2 sets of 32
-
bit registers.

Capable of fixed and floating point operations.

VLIW

very long instruction word architecture

/ VelociTI

C. DSK

Inexpensive (\$300). Includes t
he C6711 and the TI 16
-
bit AD535 codec for input and
output. Fixed sampling rate of 8kHz.

16 MB of SDRAM and 128 kB of flash ROM.

D. CCS

Te
x
t

Editor

Assemb
er

Optimizer

Compiler

.sa

.
c

.asm

.asm

Assembler

.obj

Linker

*.cmd
m

.out

Debug

Profile

Graph

Watch

-

compiler converts source code to assembly code with different levels of optimization

-

assembler converts assembly code to machine code

-

linker combines all the *.obj files to make the final executable file *.out. It also
places code, constant, and variable sections into locations in memory based on the
linker.cmd file.

The .cmd file

sets up the memory on the board and sets aside
certain areas of memory for program, data, variables, etc.