main content

hdl ofdm transmitter -凯发k8网页登录

this example shows how to implement an ofdm-based wireless transmitter in simulink® that is optimized for hdl code generation and hardware implementation.

this example shows the custom design of an orthogonal frequency-division multiplexing (ofdm) based transmitter. this transmitter model accepts payload data through the input port. it enables you to choose the modulation type and the punctured convolutional code rate of the data from a set of values. these two parameters control the effective data rate of transmission and are provided through the input ports of transmitter. the maximum data rate supported by the transmitter is 3 mbps. the transmitter also accepts an input valid signal to control the transmission.

the transmitter in this example works in conjunction with the receiver in the hdl ofdm receiver example. the transmitter has a matlab® floating point equivalent function described in the example.

transmitter specification

this section explains the specifications of the transmitter related to the ofdm frame configuration and structure, bandwidth, and sample rate.

the transmitter model accepts two parameters, modtypeindex and coderateindex, which allow you to specify the modulation type and punctured convolutional code rate, respectively, of the data. these two parameters are explained in the following tables:

modtypeindex

    value    represents modulation type
    _____    __________________________
      0                bpsk
      1                qpsk
      2                16qam
      3                64qam

coderateindex

    value    represents code rate
    _____    ____________________
      0              1/2
      1              2/3
      2              3/4
      3              5/6

ofdm frame structure

every ofdm system has a frame structure that shows the distribution of samples in the frequency domain across all its subcarriers. the frame structure is as shown in the figure. each ofdm symbol is comprised of 72 subcarriers, and each ofdm frame consists of 36 ofdm symbols. the frame duration is 3 ms. the first ofdm symbol is formed by synchronization sequence (ss), second and third symbols are formed by reference signals (rs), and the fourth symbol is formed by header. data is filled from the fifth symbol to the last (36th) symbol. pilots are inserted between data such that there is one pilot for every five data subcarriers as shown below. these pilots help to detect and correct phase errors at the receiver.

the ofdm parameters used in the model are given below:

           parameter              value
    ________________________    _________
    sample rate                 1.92 msps
    subcarrier spacing          15 khz
    fft length                  128
    bandwidth of ofdm signal    1.4 mhz
    active subcarriers          72
    left guard subcarriers      28
    right guard subcarriers     27
    cyclic prefix length        32
    data symbols per frame      32
    pilots per data symbol      12

model architecture

the following figure shows the high-level architecture of the ofdm transmitter. there are five different signals that form the ofdm frame: ss, rs, header, pilots, and data. ss, rs, and pilots are same for every frame. they are stored in separate look up tables (lut) and accessed whenever required. header and data vary based on the inputs given to the transmitter. header bits are formed based on the input modulation type and code rate values. these header bits are processed through the header chain as shown in the figure. payload data is provided as an input to the transmitter. this data is processed through multiple stages in the data chain. individual stages in the header and data chains are explained in further sections.

these five signals are multiplexed based on their valid signals and stored in a ram. the ram holds these signals for a duration of one frame. data stored in the ram is read out and modulated by the block. the ofdm modulated signal is filtered with a passband frequency of 1.4 mhz and sent out as transmitter output.

file structure

this example contains two simulink models, an initialization script, and a matlab function:

  • whdlofdmtransmitter.slx — this is the top-level model in this example. it has an ofdm transmitter subsystem that refers to the whdlofdmtx.slx model. there is an external interface circuit for the ofdm transmitter subsystem, which provides inputs and collects outputs from the subsystem. simulating this model runs the remaining three files.

  • whdlexamples.ofdmtransmitterinit — this script initializes the whdlofdmtransmitter.slx model. the script is called in the initfcn callback of the model.

  • whdlofdmtx.slx — this model implements the transmitter with total configurability.

  • whdlexamples.ofdmtxparameters — this function generates parameters required for the whdlofdmtx.slx model. this function is called in the model workspace of the model.

transmitter interface

the whdlofdmtransmitter.slx model shows the ofdm transmitter subsystem and its interface.

model inputs:

  • modtypeindex — selects the type of symbol modulation to be applied to payload data, specified as a ufix2 scalar. this port accepts values 0, 1, 2, and 3, which correspond to modulation types bpsk, qpsk, 16qam, and 64qam.

  • coderateindex — selects the code rate of punctured convolutional code to be applied to payload data, specified as a ufix2 scalar. this port accepts values 0, 1, 2, and 3, which correspond to code rates 1/2, 2/3, 3/4, and 5/6.

  • data — input payload data, specified as a boolean scalar.

  • valid — valid signal for the input data, specified as a boolean scalar.

all input ports run at a sample rate of 30.72 msps to support different configurations.

model outputs:

  • txdata — transmitter output, returned as a complex scalar with fixdt(1,16,13) datatype sampled at 1.92 msps.

  • txvalid — control signal that validates txdata, returned as a boolean scalar sampled at 1.92 msps.

  • ready — control signal that is used to sample input data, modtypeindex, and coderateindex values, specified as a boolean scalar sampled at 30.72 msps.

index selector

the index selector subsystem samples the modtypeindex and coderateindex signals at the rising edge of the ready signal. the subsystem retains the previous outputs if no rising edge exists on the ready signal.

data and valid selector

the data and valid selector subsystem selects the input payload data and input valid signal based on the ready signal.

structure of the transmitter

the whdlofdmtx.slx model is called within the ofdm transmitter subsystem. it generates an ofdm transmitter waveform by processing input signals in multiple stages as shown below.

whdlofdmtx

frame controller and input sampler

the frame controller and input sampler subsystem generates control signals for later stages of the model. the subsystem also generates a ready output signal that is used for external interfacing. this subsystem samples the input modtypeindex and coderateindex values along with the first valid input sample. the transport block size for the current frame is selected from the transport block size lut based on the sampled modtypeindex and coderateindex values. the subsystem also generates control signals for header generation followed by the preamble generation along with the first valid sample. preamble generation refers to the generation of ss, rs, and pilot signals. the control signal for data generation is asserted either after 9562 (maximum transport block size corresponding to 64-qam modulation and 5/6 code rate) clock cycles from the first valid sample or after the transport block length of valid input data is stored for the current frame, whichever is later. along with the data control signal, the ofdmmodready signal is asserted, which indicates the block to start modulation.

frame generator

the frame generator subsystem generates ss, rs, header, pilot, and data signals, which are later ofdm-modulated. the generate preamble control signals subsystem that is in the frame generator subsystem, splits the input preambleset control signal into ss set, rs set, and pilot set control signals, which generate ss, rs, and pilot signals, respectively.

frame generator/synchronization sequence

the synchronization sequence subsystem accepts ss set control signal generated from the frame controller and input sampler subsystem. it is generated considering the length of ss sequence. the counter keeps incrementing and returns ss from an lut. once ss set becomes inactive, the counter stops. output from lut is upsampled by a factor of 2 to maintain the same sample time as that of the header and data subsystems. reference signals and pilot subsystems operate in a similar way by storing the sequences in luts and accessing them whenever required.

frame generator/header

the header subsystem accepts modtypeindex, coderateindex and fftlenindex as inputs. a headerset signal starts the header formation. the header formation function converts the modtypeindex and coderateindex values into their binary equivalents. for example, a modtypeindex value of 1 is converted into two bits 01. similarly, coderateindex values are converted into two equivalent bits. to learn more about these indices, refer to transmitter specification. fftlenindex is not configurable and its value is fixed to 0. it is converted to 000, which represents an fft length of 128. fftlenindex, modtypeindex, and coderateindex are represented using 3, 2, and 2 bits, forming a total of 7 bits. additionally, 7 spare bits are added, all currently set to 0, forming a total of 14 header bits.

these 14 bits are processed as shown in the figure. for proper error detection, block pads 16 crc bits with [16 12 5 0] as the crc polynomial. the block encodes these 30 bits, that is 14 16, with [171 133] as the polynomial and a constraint length as 7. the encoding is processed in terminated mode, adding 6 null bits, that is 7&endash;1, to the crc padded data. after encoding, these 36 bits result in 72 bits due to the 1/2 rate encoding. the output of the block is a two-element vector that is serialized in the serialized subsystem using the (hdl coder) block, leading to rate transition by a factor 2. the serialized data is interleaved using the interleaver block with 72 as the maximum block size and 18 as the number of columns. for more information on the interleaver block, see the example. the interleaved bits are bpsk-modulated using the block to form a header symbol.

frame generator/data

the data subsystem stores input payload data, datain, and processes it through the data chain.

frame generator/data/data and control signal generation

the data and control signal generation subsystem consists of a ram, where the input payload data, datain, is stored. a dataset signal reads data from this ram. this subsystem generates start, end, and valid control signals for the ram data. it also selects the puncture vector based on the coderateindex.

frame generator/data/data chain

the block appends a 32-bit crc to the payload data from the ram with [32 26 23 22 16 12 11 10 8 7 5 4 2 1 0] as the crc polynomial. this crc-padded data is scrambled with $x^7 x^4 1$ as the polynomial and [1 0 1 1 1 0 1] as the initial state. the block encodes the scrambled data in terminated mode with [171 133] as the polynomial and constraint length as 7. the encoded output is punctured using the block with the puncture vector selected in the data and control signal generation subsystem. the output of the block is a two-element vector and is serialized using (hdl coder) block. the resultant data is interleaved in the symbol interleaver subsystem where the split data into symbols subsystem splits the input data into symbols and each of these symbols are bit-interleaved using the interleaver block with 360 as the maximum block size and 15 as the number of columns. the supported input data symbol sizes to the interleaver block are 60, 120, 240, and 360 for bpsk, qpsk, 16-qam, and 64-qam modulations, respectively. for more information on the interleaver block, see the example. the block modulates the interleaved data using the modulation pattern selected based on the input modtypeindex.

multiplexer

the multiplexer subsystem multiplexes the ss, rs, and pilot signals in the multiplex preamble signals subsystem and the header and data signals in the multiplex header and data signals subsystem based on the valid signals generated by the frame generator subsystem.

frame formation and ofdm modulation

the frame formation and ofdm modulation subsystem accepts the preambledata and data signals, and then multiplexes and writes them into a (hdl coder). this ram reads and writes data at different rates. the ram writes data at 61.44 msps. the ram is filled with data such that it forms an ofdm frame structure as shown in the transmitter specification section.

the generate ofdm modulator valid subsystem generates a valid input signal for the block at a sample rate of 1.92 msps and generates a ram address to read data from the ram. the valid signal is in synchronization with the ready signal of the ofdm modulator. the make ofdm valid continuous subsystem selects the ofdm modulator output based on the validin signal. it gives out valid ofdm output in the presence of the validin signal and a dummy ofdm symbol in the absence of validin signal.

discrete fir filter

the block filters the output of the make ofdm valid continuous subsystem with a passband frequency of 1.4 mhz. the whdlexamples.ofdmtxparameters function computes the filter coefficients. the output of the filter is the final output of the transmitter.

run the transmitter

the transmitter can be connected back-to-back with the receiver that is explained in the hdl ofdm receiver example. for more information on how to use the transmitter and receiver simulink models back-to-back, refer to the example.

to run the transmitter model, ofdmtxverification.m script is provided with this example. the script chooses a custom frame configuration, payload data, and simulates the model. the script also collects the simulation outputs and validates them.

note: these files are not available on the matlab search path. to copy these files locally to the user path, you must open this example.

verification and results

in this section, the ofdm transmitter simulink model is validated by comparing its output with its floating point equivalent function, whdlexamples.ofdmtx. for more information on this matlab function, see the example. to compare the output of the simulink model with the matlab function, run the ofdmtxverification.m script.

>> ofdmtxverification

### starting serial model reference simulation build
### model reference simulation target for whdlofdmtx is up to date.
build summary
0 of 1 models built (1 models already up to date)
build duration: 0h 0m 10.643s

hdl code generation

to generate hdl code for this example, you must have hdl coder™. use makehdl and makehdltb commands to generate hdl code and hdl testbench for the ofdm transmitter subsystem. testbench generation time depends on the simulation time.

the resulting hdl code is synthesized for the xilinx® zynq®-7000 zc706 evaluation board. the post place and route resource utilization is shown in the table below. the maximum frequency of operation is 230 mhz.

       resources       usage
    _______________    _____
    slice registers    6373
    slice lut          4197
    ramb36             5
    ramb18             15
    dsp48              24

see also

blocks

  • | | | | | | (hdl coder)

related topics

网站地图