Anda di halaman 1dari 28

DSP C5000

Chapter 20
Polyphase FIR Filter
Implementation
for Communication Systems
Copyrigh

Multirate Processing 1 of 2

Multirate processing arises in many fields


of digital signal processing:

ESIEE, Slide 2

Digital audio: sampling frequency conversion


(32 kHz, 44.1kHz, 48kHz), sharp cut-off of FIR
filter,
Signal processing for digital communications:
symbol rate processing, bit rate processing,
sample rate processing,
Speech processing: 3G speech codec (Adaptive
Multi Rate), fractionnal pitch estimation, ...

Copyrigh

Multirate Processing 2 of 2

Involves two actions on the digital signal:

Downsampling: resampling downwards the


digital signal in the digital domain.

Fe

Fe/M

Retain one sample over M and discard


the M-1 others, every M samples.

Upsampling: resampling upwards the digital


signal in the digital domain.

Fe

ESIEE, Slide 3

LFe

Insert L-1 zeros between each sample

Copyrigh

Downsampling 1 of 2
x(n)

y(m)

n mM ,
x( n) if
y( m )
else.
0

1
1
y( m ) x ( mM ) x ( n) ( n mM )
x( n)
M
M
m
ESIEE, Slide 4

M 1

x( n)e

j 2

k
n
M

k 1

Folding term

Copyrigh

Downsampling 2 of 2

Anti-aliasing Filter
fc : (Fe/M)/2

x(n)

H(z)
Fe

H(zM)

ESIEE, Slide 5

y(m)

M
Fe/M

Noble identity for decimation


M

H(z)

Copyrigh

Upsampling 1 of 2
x(m)

y(n)

Y (z)

y( n) z

n
ESIEE, Slide 6

n mL ,
x ( m ) if
y( n)
else.
0

x( m ) z

L m

X zL

Copyrigh

Upsampling 2 of 2

Interpolating Filter
fC : (Fe/L)/2

x(m)

L
Fe

ESIEE, Slide 7

y(n)

LFe

H(z)

Noble identity for upsampling


H(zL)

H(z)

L
Copyrigh

Polyphase Implementation of FIR Filters


Decimation Case 1 of 4
H(z)

E(zM)
H z

mM 1

n
h
(
n
)
z

n0

Let n=lM+k

H z

ESIEE, Slide 8

M 1

z Ek z
k 0

with

Ek z

N / M 1

h
lM

k
z

l 0

Copyrigh

Polyphase Implementation of FIR Filters


Decimation Case 2 of 4
H(z)

Processing load (MAC/s)

E0(zM)
z-1
E1(zM)

MTe

z-1

Time

M-1 filter evaluation over M

EM-1(zM)
Fe
ESIEE, Slide 9

are discarded.
N filter length

Fe/M
Copyrigh

Polyphase Implementation of FIR Filters


Decimation Case 3 of 4

Using noble identity

E0(z)

z-1

Processing load (MAC/s)


N

E1(z)

EM-1(z)

z-1

Fe

MTe

Time

Fe/M

No more useless computations, but one sampling period over M, CPU is


burdned with N MAC/s.
ESIEE, Slide 10

Copyrigh

Polyphase Implementation of FIR Filters


Decimation Case 4 of 4

Equivalent commutator model


E0(z)

Processing load (MAC/s)

E1(z)
N/M

EM-1(z)
Fe

MTe

Time

Fe/M

Commutator runs at Fe,. At each input sample only one component is computed and accumulated with the result of the previous one. The result is output when the last component
is reached and accumulator is reset. This spreads the processing load over MTe.
ESIEE, Slide 11

Copyrigh

Polyphase Implementation of FIR Filters


Interpolation Case 1 of 5
L

H(z)

R(zL)

lL 1

H z h( n) z n
n0

Let n=mL+L-1-k
L 1

H z z
k 0

ESIEE, Slide 12

( L 1 k )

Rk z

with

Rk z

N / L 1

h
mL

k
z

m 0

Copyrigh

Polyphase Implementation of FIR Filters


Interpolation Case 2 of 5
L

H(z)

Processing load (MAC/s)


N

R0(zL)

z-1

R1(zL)

Te/L

z-1
RM-1(zL)
Fe
ESIEE, Slide 13

Time

L-1 multiplications by 0 over L


For each filter evaluation.
N filter length.

LFe
Copyrigh

Polyphase Implementation of FIR Filters


Interpolation Case 3 of 5

R0(z)
R1(z)

Using noble identity

-1

At each output sampling instant,


only one component is non zero

L
z-1

RM-1(z)
Fe
ESIEE, Slide 14

L
LFe
Copyrigh

Polyphase Implementation of FIR Filters


Interpolation Case 4 of 5

Equivalent commutator model

R0(z)

Processing load (MAC/s)

R1(z)
N/L

RM-1(z)
Te/L

Fe

Time

LFe

For each output sampling instant one polyphase component is computed.


When we reach again the first component (M-1) a new input sample is inputed
in the delay line of each polyphase component.
ESIEE, Slide 15

Copyrigh

Polyphase Implementation of FIR Filters


Interpolation Case 5 of 5

Linear Periodically Varying Time system

z-1
hL-1 h2L-1

h1

h0
ESIEE, Slide 16

z-1
h3L-1

z-1

z-1

z-1

z-1

hL+1

h2L+1

h0
h1

hL
hL+1

h2L
h2L+1

z-1

z-1

hL-1

h2L-1

h3L-1

hL

h2L
Copyrigh

Case Study

Shaping filters for a QPSK modem :

Emitter: interpolation case.


Receiver: decimation case

Efficient Algorithm Implementation :

ESIEE, Slide 17

Good ordering of computations,


Efficient memory organization and management.

Copyrigh

Emitter 1 of 4
s(t)=1/2[cos(2fot).cos((Ak,Bk))-sin(2fot).sin((Ak,Bk))]
s(t)=1/2[cos(2fot).cos((Ak,Bk))-sin(2fot).sin((Ak,Bk))]

QPSK modulator
Ak
bits
Bk

Fb

: Phase

Cos()

RCF

DAC

Sin()

RCF

DAC

computation

Fs

Fe

Bit

Symbol

Sample

frequency

frequency

frequency

ESIEE, Slide 18

Copyrigh

Emitter 2 of 4

Let Fe=16Fs (16 sample / symbol)

Define a raised cosine filter with:

6 symbols length.
Roll_off : 0.5

Matlab command

h=RCOSFIR(0.5,3,16,1);

Equivalent system
16

H(z)

In red: ideal interpolating filter


In blue: actual RC filter
ESIEE, Slide 19

Copyrigh

Emitter 3 of 4

The 16 Polyphase filters are defined by :

Filter length is 97, impulse response is padded with 0 to reach 112=7*16

Rk z

N / L 1

h
mL

k
z

With N=112 and L=16

m 0

r0 m h 15 , h 31 , h 47 , h 63 , h 79 , h 95 , h 111
r1 m h 14 , h 30 , h 46 , h 62 , h 78 , h 94 , h 110

r15 m h 0 , h 16 , h 32 , h 48 , h 64 , h 80 , h 96

ESIEE, Slide 20

Copyrigh

Coefficients

1 sample
2nd sample
st

h(0)
h(16)
h(32)
h(48)
h(64)
h(80)
h(96)
h(1)
h(17)
h(33)
h(49)
h(65)
h(81)
h(97)

15th sample

Emitter 4 of 4

Symbols
x(0)
x(1)
x(2)
x(3)
x(4)
x(5)
x(6)

Shuffle coefficients
R=flipud(reshape(h,8,12));
R=round(R*2^15);
fid=fopen('coef.inc','wt');
for p=1:8
fprintf(fid,'\t.word\t%d\n,R(p,:))
end

h(15)
h(31)
h(47)
h(63)
h(79)
h(95)
h(111)

ESIEE, Slide 21

fclose(fid);

When coefficient pointer reaches this address a new


symbol will be input at the next output sample period
Copyrigh

Emitter (C callable)
.sect "coefs2"
Ncomp

.set

16

coefs2

.include

;number of polyphase component


"coefpoly2.inc"

coefsfin:
coefsize

.set coefsfin-coefs2

Lfil

.set

filbufQ

.usect "filtre2",Lfil

coefsize/Ncomp

;polyphase component length


;data buffer

.text
_firinit:
ST

#coefs2,*(adbufQ)

;pointer to current coefs pointer

STM

#filbufQ,AR2

;zeroed initial buffer condition

RPT

#Lfil-1

STL

A,*AR2+

RET

ESIEE, Slide 22

Copyrigh

_firTxQ:

;context save

LD

#var,DP

STM

#coefsize,BK

MVDM

adbufQ,AR2

STM

#1,AR0

STM

#filbufQ,AR3

;symbol buffer

STL

A,*AR3

;new sample (guess hold during 16 samples)

RPTZ

A,#Lfil-1

;compute one polyphase component

MAC

*AR2+0%,*AR3+,A

MVMD

AR2,adbufQ

SFTA

A,-16

SFTA

A,-1

;output of RCF can be greater than 1 !

CMPM

@adbufQ,#coefs2

;test if delay symbols is needed

BC

endTxQ,NTC

;jump if not necessary

MAR

*+AR3(-2)

RPT

#Lfil-2

;current coefs pointer

;save new current coefs pointer

DELAY *AR3endTxQ:

;context restore

RET
ESIEE, Slide 23

Copyrigh

Symbol vs Sample Output


Symbol output

Fe: 16 khz

Sample output

f= Fs/8=125 Hz

Fs: 1 khz
constant for each symbol

ESIEE, Slide 24

Copyrigh

Receiver 1 of 2

Bit

Symbol

processing processing
ADC

RCF

ADC

RCF

Fe

ESIEE, Slide 25

Fb

Fs

Copyrigh

Receiver 2 of 2

Receiver structure is quite similar, except


that:

Each polyphase component has its own delay tap


Each polyphase output has to be accumulated for M
polyphase computations and accumulator is outputed
every M input sample and reset.

E0(z)
E1(z)

EM-1(z)
ESIEE, Slide 26

Copyrigh

Follow on Activities

Laboratory 10 for the TMS320C5416 DSK

Laboratory 11 for the TMS320C5416 DSK

Illustrates the effects of interpolation and antiimaging filters.

Application 9 for the TMS320C5416 DSK

ESIEE, Slide 27

Illustrates the effects of decimation and antialiasing filters.

Uses interpolation and decimation to produce


sharper cut-offs FIRs than would be obtained
otherwise.

Copyrigh

Reference

Digital Signal Processing a Practical


Approach by Emmanuel C. Ifeachor and
Barrie W. Jervis. Chapter 9. Multirate
digital signal processing.

ESIEE, Slide 28

Copyrigh

Anda mungkin juga menyukai