Design Fpga Modulation

Embed Size (px)

Citation preview

  • 7/21/2019 Design Fpga Modulation

    1/51

    1copyright 1998,1999,2000 Andraka Consulting Group, Inc. All Rights reserved

    Modulation and Demodulation

    Techniques for FPGAs

    Ray Andraka P.E., president,

    AndrakaConsultingGroup, Inc.the

    16 Arcadia Drive North Kingstown, RI 02852-1666 USA

    401/884-7930 FAX 401/884-7950

  • 7/21/2019 Design Fpga Modulation

    2/51

    2copyright 1998,1999,2000 Andraka Consulting Group, Inc. All Rights reserved

    You can do Math

    in them things???

  • 7/21/2019 Design Fpga Modulation

    3/51

    3copyright 1998,1999,2000 Andraka Consulting Group, Inc. All Rights reserved

    Overview

    Introduction

    Digital demodulation for FPGAs

    Filtering in FPGAs

    Comparison to other technologies

    Summary

  • 7/21/2019 Design Fpga Modulation

    4/51

    4copyright 1998,1999,2000 Andraka Consulting Group, Inc. All Rights reserved

    Digital Communications

    Historically only base-band processing

    High sample rates for down-converters

    Down-conversion traditionally analog

    Digital down-conversion with specialty chips

    FPGAs can compete

  • 7/21/2019 Design Fpga Modulation

    5/51

    5copyright 1998,1999,2000 Andraka Consulting Group, Inc. All Rights reserved

    Why Digital?

    Frequency agility

    Repeatability

    Cost

  • 7/21/2019 Design Fpga Modulation

    6/51

    6copyright 1998,1999,2000 Andraka Consulting Group, Inc. All Rights reserved

    Digital Challenges

    A to D converter

    High sample rates

    Arithmetic intensive

  • 7/21/2019 Design Fpga Modulation

    7/51

    7copyright 1998,1999,2000 Andraka Consulting Group, Inc. All Rights reserved

    e-jct=cos(ct)-jsin(ct)

    Decimateby R

    Video

    BandpassFilter

    2f(t) cos(ct)

    PhaseSplit

    c-c -c c -2c0 0 0

    2f(t)ejct

    Conventional Demodulator

  • 7/21/2019 Design Fpga Modulation

    8/51

    8copyright 1998,1999,2000 Andraka Consulting Group, Inc. All Rights reserved

    -jsin(

    ct)

    cos (ct)

    Lowpass Filter

    2f(t)

    Lowpass Filter

    2f(t)

    I

    Q

    Decimate

    by R

    c-c -2c0 0-2c 0

    e-jct

    Re-arranged Demodulator

    *

  • 7/21/2019 Design Fpga Modulation

    9/51

    9copyright 1998,1999,2000 Andraka Consulting Group, Inc. All Rights reserved

    Complex Mixer

    Re[Ak]

    Im[Ak]

    Complex

    Baseband

    Signal

    (Passband for

    Demodulator)

    Complex

    Passband

    Signal(Baseband for

    Demodulator)

    Numerically

    ControlledOscillator

    sin(ct) cos(ct)

    Re[Sk]

    Im[Sk]

    cPhase orfrequencyinput

  • 7/21/2019 Design Fpga Modulation

    10/51

    10copyright 1998,1999,2000 Andraka Consulting Group, Inc. All Rights reserved

    Frequency

    Synthesizer

    Phase Angle

    to Wave

    Shape

    Conversion

    Waveform

    Out

    Phase Angle

    Modulation

    Waveform Synthesis (NCOs)

    Various Methods

    Look up table (LUT)

    Partial products

    Interpolation Algorithmic

    Most methods use a

    frequency synthesizer

  • 7/21/2019 Design Fpga Modulation

    11/51

    11copyright 1998,1999,2000 Andraka Consulting Group, Inc. All Rights reserved

    Phase(phase increment)

    Sample Clock

    Phase Accumulator Design

    Direct Digital Synthesis

    Essentially integrates phase increment

    Increment value may be modulated

    Frequency and PSK modulation

    Binary Angular Measure (BAMs)

    Most significant bit =

  • 7/21/2019 Design Fpga Modulation

    12/51

    12copyright 1998,1999,2000 Andraka Consulting Group, Inc. All Rights reserved

    Addr

    Data

    Phase Angle

    (BAMs)

    Waveform

    Out

    Read OnlyMemory

    Waveform Synthesis by LUT

    Phase resolution limited

    Arbitrary waveshapes

    Sampled waveshape must be

    band-limited Complex requires 2 lookups

    fosc=fs/4 special case

  • 7/21/2019 Design Fpga Modulation

    13/51

    13copyright 1998,1999,2000 Andraka Consulting Group, Inc. All Rights reserved

    Using Symmetry to Extend

    LUT Phase Resolution

    00 N N 00 N N

    0 N0 N 0N0N

    - -++

    00 01 10 11

    --++

    Q1 Sin

    LUT

    Q1 Sin

    LUT

    Q

    MSB

    MSB-1

    remaining

    bitsI

    Phase MSBs

    Count

    sequence

  • 7/21/2019 Design Fpga Modulation

    14/51

    14copyright 1998,1999,2000 Andraka Consulting Group, Inc. All Rights reserved

    Waveform Synthesizer plus Multiplier

    Obvious Solution

    Separate into functional

    parts

    Treat each part

    independently

    NumericallyControlled Oscillator

    sin(ct) cos(ct)

    Re[Sk]

    Im[Sk]

    c

  • 7/21/2019 Design Fpga Modulation

    15/51

    15copyright 1998,1999,2000 Andraka Consulting Group, Inc. All Rights reserved

    a Cos() phase

    signal 000 001 010 011 100 101 110 111-4 -4 -2.8 0 2.8 -4 2.8 0 -2.8

    -3 -3 -2.1 0 2.1 3 2.1 0 -2.1

    -2 -2 -1.4 0 1.4 2 1.4 0 -1.4-1 -1 -0.7 0 0.7 1 0.7 0 -0.7

    0 0 0 0 0 0 0 0 0

    1 1 0.7 0 -0.7 -1 -0.7 0 0.72 2 1.4 0 -1.4 -2 -1.4 0 1.4

    3 3 2.1 0 -2.1 -3 -2.1 0 2.1

    Look Up Table Modulator

  • 7/21/2019 Design Fpga Modulation

    16/51

    16copyright 1998,1999,2000 Andraka Consulting Group, Inc. All Rights reserved

    6-LUTA[1:0]

    6-LUTA[3:2]

    6-LUTA[5:4]

    6-LUTA[7:6]

  • 7/21/2019 Design Fpga Modulation

    17/51

    17copyright 1998,1999,2000 Andraka Consulting Group, Inc. All Rights reserved

    6-LUTI[0]

    6-LUTI[1]

    6-LUTI[2]

    6-LUTI[3]

  • 7/21/2019 Design Fpga Modulation

    18/51

    18copyright 1998,1999,2000 Andraka Consulting Group, Inc. All Rights reserved

    n+8

  • 7/21/2019 Design Fpga Modulation

    19/51

    19copyright 1998,1999,2000 Andraka Consulting Group, Inc. All Rights reserved

    CORDICRotator

    IinQin

    PhaseAccumulator

    IoutQout

    Signal In ModulatedSignal Out

    CORDIC Modulator

    Iout = Iincos - QinsinQout= Qin* cos + Iinsin

  • 7/21/2019 Design Fpga Modulation

    20/51

    20copyright 1998,1999,2000 Andraka Consulting Group, Inc. All Rights reserved

    CORDIC Algorithm Explained

    Coordinate rotation in a plane:

    x = xcos() - ysin()

    y = ycos() + xsin()

    Rearranges to:

    x = cos() [x - ytan()]

    y = cos() [y + xtan()] cos

    sin

    I

    Q

  • 7/21/2019 Design Fpga Modulation

    21/51

    21copyright 1998,1999,2000 Andraka Consulting Group, Inc. All Rights reserved

    >>3

    x0 y0 z0

    xn yn zn

    >>3 constsign

    >>2

    >>2 constsign

    >>1

    >>1 constsign

    >>0

    >>0 constsign

    >>4

    >>4 constsign

    CORDIC Structure

  • 7/21/2019 Design Fpga Modulation

    22/51

    22copyright 1998,1999,2000 Andraka Consulting Group, Inc. All Rights reserved

    Digital Filtering

    y[k]=x[k-i]Ci

    Z-1 Z-1

    C0 C1 Ci-2 Ci-1

    Z-1x[k]

    Many ConstantMultipliers

    Delay Queues

    Products Summed Advantages

    No tolerance drift

    Low cost

    precise characteristic

  • 7/21/2019 Design Fpga Modulation

    23/51

    23copyright 1998,1999,2000 Andraka Consulting Group, Inc. All Rights reserved

    Distributed Arithmetic Filter

    Shift Reg

    Shift Reg

    Shift Reg

    Shift Reg

    C0

    C1

    C2

    C3

  • 7/21/2019 Design Fpga Modulation

    24/51

    24copyright 1998,1999,2000 Andraka Consulting Group, Inc. All Rights reserved

    Take Advantage of Symmetry

    SREG

    X[k]

    SREG

    SREG

    Real filters are

    symmetric

    Add bits with

    like coefs before

    filtering

    Uses SerialAdders

    Halves taps

    SREG

    SREG

    SREG

    SREG

    x[k]+x[k-6]

    x[k-1]+x[k-5]

    x[k-2]+x[k-4]

    x[k-3]

  • 7/21/2019 Design Fpga Modulation

    25/51

    25copyright 1998,1999,2000 Andraka Consulting Group, Inc. All Rights reserved

    Decimating FIR Filters

    Low pass filter then discard samples

    Keep only every 4th output

    Yn+0=akC0 +ak-1C1 +ak-2C2 + ak-3C3 +ak-4C4 +Yn+4= ak+4C0+ak+3C1 +ak+2C2 +ak+1C3 +akC4 +

    Yn+8=ak+8C0 +ak+7C1 +ak+6C2 +ak+5C3 +ak + 4C4 +

    reduces to n parallel filters fed every nth sample sub-filter results summed to get result

  • 7/21/2019 Design Fpga Modulation

    26/51

    26copyright 1998,1999,2000 Andraka Consulting Group, Inc. All Rights reserved

    16 Tap FIR (c1,c9)

    16 Tap FIR (c2,c10)

    16 Tap FIR (c0,c8)

    16 Tap FIR (c3,c11)

    16 Tap FIR (c5,c13)

    16 Tap FIR (c6,c14)

    16 Tap FIR (c4,c12)

    16 Tap FIR (c7,c15)

    40 MHzInput

    5 MHz

    Output

    128 tap 8:1 Decimating FIR Filter

    a0,a8,a16...

    a1,a9,a17...

    a2,a10,a18...

    a7,a15,a23...

  • 7/21/2019 Design Fpga Modulation

    27/51

    27copyright 1998,1999,2000 Andraka Consulting Group, Inc. All Rights reserved

  • 7/21/2019 Design Fpga Modulation

    28/51

    28copyright 1998,1999,2000 Andraka Consulting Group, Inc. All Rights reserved

    Multiplier-less Filtering

    Boxcar or Moving Average filter

    FIR with unity coefficients

    Nulls at Fs/N

    y[k]=x[k-i]

    Z-1 Z-1 Z-1x[k]

    -35

    -30

    -25

    -20

    -15

    -10

    -5

    0

    Fs/2Boxcar response (dB) with N=10 i=1

    N

  • 7/21/2019 Design Fpga Modulation

    29/51

    29copyright 1998,1999,2000 Andraka Consulting Group, Inc. All Rights reserved

    Z-N

    +

    -Z-1

    +

    +

    Z-N

    +

    -Z-N

    +

    -

    R

    Z-1

    +

    +

    Z-1

    +

    +

    M Comb sections (zeros)M Integrator section (poles)

    Cascaded Integrator-Comb Filters

    Response same as M cascaded N*R boxcar filters

    High order multiplier-less interpolation or decimation

    Constant response relative to decimated sample rate

    Use small FIR to shape response

  • 7/21/2019 Design Fpga Modulation

    30/51

    30copyright 1998,1999,2000 Andraka Consulting Group, Inc. All Rights reserved

    Frequency Sampling with CIC

    0

    35

    30

    25

    20

    15

    10

    -5

    0

    F0

    CIC (M=1, N=1,R=10)

    fc

    2fc

    2*F0 3*F0 4*F0

    F0=FS /R

    Output from clean-up filter

  • 7/21/2019 Design Fpga Modulation

    31/51

    31copyright 1998,1999,2000 Andraka Consulting Group, Inc. All Rights reserved

    Half Band Filters

    Special case of FIRfilter

    Nearly half of the

    coefficients are zero Response is anti-

    symmetric about Fs/4

    15th order half-band

    filter is only 5 taps

    Ci= [ -15, 0, 84, 0, -296, 0, 1251, 2048, 1251, 0, -296, 0, 84, 0, -15]

  • 7/21/2019 Design Fpga Modulation

    32/51

    32copyright 1998,1999,2000 Andraka Consulting Group, Inc. All Rights reserved

    Comparison to dedicated digital

    modulator chips

    Performance similar to dedicated chips

    Can be tailored to exact requirements

    Other logic can be integrated into chip Filtering in dedicated chips sometimes better

    Some development required

    FPGA generally cheaper than DigitalModulator Chips

  • 7/21/2019 Design Fpga Modulation

    33/51

    33copyright 1998,1999,2000 Andraka Consulting Group, Inc. All Rights reserved

    Comparison to DSP Micros

    Higher performance than DSP micro

    Higher integration

    Cost is comparable considering performance

    Hardware vs. software development

  • 7/21/2019 Design Fpga Modulation

    34/51

    34copyright 1998,1999,2000 Andraka Consulting Group, Inc. All Rights reserved

    Design Considerations

    Floorplanning required forperformance and density

    Macro generator tools simplifyingdesign task

    Use instantiation in logic synthesis

  • 7/21/2019 Design Fpga Modulation

    35/51

    35copyright 1998,1999,2000 Andraka Consulting Group, Inc. All Rights reserved

    Other Considerations Transmitter

    filter needed to mimimize ISI

    Carrier can be coordinated with symbol rate

    Receiver

    filter for noise rejection, correction of channel

    distortion

    Accurate phase reference for carrier needed

    Timing normally recovered from signal Coordinate IF, sample frequency, symbol frequency

  • 7/21/2019 Design Fpga Modulation

    36/51

    36copyright 1998,1999,2000 Andraka Consulting Group, Inc. All Rights reserved

    Summary

    Approach depends on performance,resolution and size

    Competes with dedicated digital modulator

    chips Can be tailored to exact requirements

    Each design has potential for hardwareshortcuts

  • 7/21/2019 Design Fpga Modulation

    37/51

    37copyright 1998,1999,2000 Andraka Consulting Group, Inc. All Rights reserved

    Resources

    FPGA Vendor Application Notes Xilinx web page http://www.xilinx.com

    DSP applications notes

    Tools

    DSP toolbox for Xilinx Vendor DSP Macro Generators

    Consulting services, Training, etc.

    Andraka Consulting Group, Inc

    401/884-7930

    web page: http://users.ids.net/~randraka

  • 7/21/2019 Design Fpga Modulation

    38/51

    38copyright 1998,1999,2000 Andraka Consulting Group, Inc. All Rights reserved

    References

    M. Frerking, Digital Signal Processing in Communication Systems,Kluwer Academic Publishers, 1994

    R. Andraka, A survey of CORDIC algorithms for FPGA based

    computers, ACM, 1998

    E.B. Hogenauer, An Economical Class of Digital Filters forDecimation and Interpolation, IEEE Trans on ACSSP vol ASSP-29

    no.2 April 1981

    A. Peled & B. Liu, A New Hardware Realization of Digital Filters,

    IEEE trans on ACSSP, vol. ASSP-22 no. 6, December 1974.

    ASSP and other transactions are a goldmine of hardware implementations

  • 7/21/2019 Design Fpga Modulation

    39/51

    39copyright 1998,1999,2000 Andraka Consulting Group, Inc. All Rights reserved

    Example:

    North American

    TDMA Digital Cellular

    /4 DQPSK Modem

  • 7/21/2019 Design Fpga Modulation

    40/51

    40copyright 1998,1999,2000 Andraka Consulting Group, Inc. All Rights reserved

    Specifications

    Differential phase encoding

    /4 or 3/4 phase offset

    Non-coherent receiver

    28.6 kbps I

    Q

    /4 DQPSKConstellation

  • 7/21/2019 Design Fpga Modulation

    41/51

    41copyright 1998,1999,2000 Andraka Consulting Group, Inc. All Rights reserved

    Transmitter

    Differential coding

    Uses 2 bits per symbol

    I and Q take values 0, 1, 1/

    2

    Filter interpolates to upsample

    Similar to QAM modulator example

  • 7/21/2019 Design Fpga Modulation

    42/51

    42copyright 1998,1999,2000 Andraka Consulting Group, Inc. All Rights reserved

    Receiver

    Non-coherent differential detection

    Digital demodulation from IF to baseband

    Equalizers left out of example

    Nyquist filter is RRC w/ 35% excess BW

    48.6 kbps (24.3 kbaud)

  • 7/21/2019 Design Fpga Modulation

    43/51

    43copyright 1998,1999,2000 Andraka Consulting Group, Inc. All Rights reserved

    /4 DQPSK Demodulator

    NCO-sin(ct)cos(ct)

    RRC

    Filter

    RRC

    Filter

    CMULT

    I

    Q

    Slicer

    Symbol

    Timing

    Recovereddata

    Modulated

    data

    Symbol Delay

  • 7/21/2019 Design Fpga Modulation

    44/51

    44copyright 1998,1999,2000 Andraka Consulting Group, Inc. All Rights reserved

    Receiver

    Sample baseband at 4x baud rate = 97.2Khz

    Bit serial detection logic

    16 bit baseband I and Q = 16x bit clock

    Sample IF using bit clock then decimate

    IF center frequency = bit clock/4 = 16*B

    simplifies mixer

  • 7/21/2019 Design Fpga Modulation

    45/51

    45copyright 1998,1999,2000 Andraka Consulting Group, Inc. All Rights reserved

    NCO-sin(ct)cos(ct)

    Re[Ak]

    Im[Ak]

    64 Tap

    Matched

    Filter

    Modulateddata

    Down-Converter and Filters

    DAC sampled at bit rate IF at bit rate/4

    NCO sequence is 1,-j,-1,j

    Decimate 16:1 Decimating filter reduces

    to 16 parallel filters

    Use 4 tap filters Net filter is 64 taps

    64 Tap

    Matched

    Filter

  • 7/21/2019 Design Fpga Modulation

    46/51

    46copyright 1998,1999,2000 Andraka Consulting Group, Inc. All Rights reserved

    4 Tap FIR (C0,C

    16,C

    32,C

    48)*(1)

    Reduced Down-Converter and Filters

    4 Tap FIR (C1,C17,C33,C49)*(-j)

    4 Tap FIR (C2,C18,C34,C50 )*(-1)

    4 Tap FIR (C3,C19,C35,C51)*(j)16 step

    sequencer

    (drives

    load

    enables)

    4 Tap FIR (C4,C20,C36,C52)*(1)

    4 Tap FIR (C5,C21,C37,C53)*(-j)

    4 Tap FIR (C6,C22,C384,C54 )*(-1)

    4 Tap FIR (C7,C23,C39,C55)*(j)

    I Output

    To Q

    Output

    SampledIF input

    Extended to 16 filters

  • 7/21/2019 Design Fpga Modulation

    47/51

    47copyright 1998,1999,2000 Andraka Consulting Group, Inc. All Rights reserved

    Further Filter Reduction

    Each 4 tap filter is 4 LUT and Scaling Acc

    Move SA to end of adder tree

    Each filter is a 4 LUT with delay queue

    Mixer and 64 tap filter (I and Q) is 152 CLBs

    Filter bit rate is a low 1.55 MHz

    Present data LSB first Allows serial LSB first output from filter

  • 7/21/2019 Design Fpga Modulation

    48/51

    48copyright 1998,1999,2000 Andraka Consulting Group, Inc. All Rights reserved

    Detector

    CMULT

    I

    QSlicer

    Symbol

    Timing

    Recovered

    data

    Symbol Delay Differential Detection x[k] x*[k-1] yields

    sin(k- k-1 ),cos(k- k-1 )

    Implement CMULT withscaling accumulators

    4 Samples per symbol

    Delay is 64 clocks fixed

    Symbol timing selects

    which sample to output

  • 7/21/2019 Design Fpga Modulation

    49/51

    49copyright 1998,1999,2000 Andraka Consulting Group, Inc. All Rights reserved

    Complex Multiply

    SREG

    I

    SREG

    SREG

    SREG

    Cos(k- k-1) =xk

  • 7/21/2019 Design Fpga Modulation

    50/51

    50copyright 1998,1999,2000 Andraka Consulting Group, Inc. All Rights reserved

    Symbol Timing

    Error statistic controls state machine e= xk

    2 + yk2

    proportional to magnitude squared

    Use larger + 1/2 smaller approx

    Compute for each sample

    Compare to previous sample

    if difference is less than a threshold no change to sample point

    otherwise if current larger, advance sample point or if previous larger, retard sample point

    29 CLBs

  • 7/21/2019 Design Fpga Modulation

    51/51

    51copyright 1998,1999,2000 Andraka Consulting Group, Inc. All Rights reserved

    Modem Implementation

    1.55 MHz master clock (slooowww) Entire design in 3/4 XCS30-3 (or 4013E-4)

    Device cost under $10

    Performance compares favorably with heavilyloaded TMS320C50

    TI DSP can only implement 20 Tap filters,

    Tx and Rx not concurrent in TI DSP

    TI DSP design in/out is complex baseband, not IF TI DSP design cant handle equalizer or viterbi decoder