hdl implementation of wlan receiver -凯发k8网页登录
this example shows how to design a wireless local area network (wlan) receiver that can recover signal and data field information from a wlan signal. this example supports both binary convolutional coding (bcc) and low-density parity-check (ldpc) channel coding techniques. the simulink® model in this example is optimized for hdl code generation and hardware implementation.
the example supports single-input single-output (siso) orthogonal frequency division multiplexing (ofdm) modulation, 20 mhz bandwidth option for non-high-throughput (non-ht), high-throughput (ht), and very-high-throughput (vht) frame formats and 40 mhz bandwidth option for high-throughput (ht) and very-high-throughput (vht) frame formats for bcc channel coding. the example supports 20 mhz and 40 mhz bandwidth options for ht and vht frame formats for ldpc channel coding. you can select the channel coding type from the input generation
subsystem. for more information on the wlan frame formats and frame structure, see (wlan toolbox). the block diagram shows the high-level overview of a wlan receiver design. the wlan hdl time and frequency synchronization explains the functionality of the time and frequency synchronization
subsystem. this subsystem accepts rx input waveform and outputs time and frequency synchronized waveform.
to design a wlan receiver, along with the time and frequency synchronization
subsystem, the model requires a few more blocks as shown in the block diagram.
the ofdm demodulation block converts the time-domain signal to frequency-domain subcarriers. the channel estimator block uses demodulated legacy long training fields (l-ltfs) of a wlan signal to estimate the channel frequency response. to equalize the pilot and data subcarriers of non-ht portion of the wlan signal, the channel equalizer uses the estimated channel frequency response. the non-ht portion of the wlan signal includes legacy signal(l-sig) field, high-throughput signal fields 1 and 2 (ht-sig 1 and 2), very-high-throughput signal fields a and b (vht-sig-a and vht-sig-b) and legacy data field. similarly, the channel is estimated using the demodulated ht or vht ltfs of a wlan signal to equalize the pilot and data subcarriers of ht or vht portion of the wlan signal. the ht or vht portion of the wlan signal includes vht-sig-b, ht-data, and vht-data.
after equalization, non-ht common phase error (cpe) estimation is performed using non-ht pilots. the estimated cpe is used to correct data subcarriers of the non-ht portion of the wlan signal. similarly, ht or vht common phase error (cpe) estimation is performed using ht or vht pilots. the estimated cpe is used to correct data subcarriers of the ht or vht portion of the wlan signal. common phase noise error corrected data is used for frame format detection, signal, and data field recovery.
frame format detector and signal field recovery detects the frame format between non-ht, ht, and vht frames and decodes the transmitted bits from wlan signal fields l-sig, ht-sig 1 and 2 and vht-sig-a 1 and 2. if the detected frame format is non-ht, the frame format controller passes non-ht cpe corrected data to data recovery. alternatively, if the detected frame format is ht or vht, the frame format controller passes ht or vht cpe corrected data to data recovery. data recovery decodes the transmitted bits from wlan data fields l-data, ht-data and vht-data using signal parameters such as modulation and coding scheme (mcs), physical layer convergence protocol service data unit (psdu) length, and the channel coding type. vht-sig-b is also decoded as part of data recovery for the vht frame. the example validates the simulink® wlan receiver model output by using matlab® functions in wlan toolbox™.
model architecture
open the wlanhdlreceiver
model to run the example. this figure shows the high-level overview of a wlan receiver model.
modelname = 'wlanhdlreceiver';
open_system(modelname);
time and frequency synchronization
the time and frequency synchronization
subsystem performs receiver filtering and coarse time and frequency estimation and corrections on the filtered signal. then, the subsystem fine tunes the time and frequency estimation and corrections to remove any residual offsets. the wlanhdlreceiverinit.m
file initializes filter coefficients.
open the wlantimeandfrequencysynchronization
subsystem to see the synchronization process.
open_system([modelname '/wlanhdlreceiver/wlantimeandfrequencysynchronization'],'force');
ofdm demodulation
the ofdm demodulator block converts time-domain signals to frequency-domain subcarriers. the block provides the flexibility to change the orthogonal frequency division multiplexing (ofdm) parameters fft length, cyclic prefix length, number of left guard subcarriers, and number of right guard subcarriers during the runtime. in this example, based on bandwidth option, the cyclic prefix (cp) length varies for different fields in the wlan signal. for example, the first symbol of l-ltf uses a cp length of 32 or 64, the second symbol of the l-ltf uses a cp length of 0, and the remaining fields of the wlan signal uses a cp length of 16 or 32 for 20 mhz and 40 mhz, respectively. in this example, the fft length parameter is set to 64
for 20 mhz and 128
for 40 mhz and the number of left guard subcarriers and number of right guard subcarriers parameters are set to 4
and 3
for 20 mhz and 6
and 5
for 40 mhz, respectively.
open_system([modelname '/wlanhdlreceiver/ofdmdemodulation']);
the ofdmdemodulationparametercalculator
matlab function controls the ofdm demodulator block parameters for different fields of the wlan packet. the ofdmdemodulationparametercalculator
matlab function calculates the number of used subcarriers to determine the number of ofdm symbols in the wlan packet.
non-ht channel estimation and equalization
the nonhtchannelestandequalize
subsystem is used for l-ltf channel estimation. the input is given to the ofdm channel estimator block. the ofdm channel estimator block implements least squares (ls) estimation for the channel estimation and performs averaging on the estimates from two l-ltf symbols of the wlan signal. the ofdm equalizer block uses the resultant averaged channel estimate to perform zero forcing (zf) equalization on data.
open_system([modelname '/wlanhdlreceiver/nonhtchannelestandequalize']);
ht or vht channel estimation and equalization
the htorvhtchannelestandequalize
subsystem is similar to the nonhtchannelestandequalize
subsystem. for a siso configuration, only one ht or vht ltf exists, so averaging is disabled in the ofdm channel estimator block.
open_system([modelname '/wlanhdlreceiver/ht_vhtchannelestandequalize']);
non-ht common phase noise estimation and correction
the nonhtcpeestandcorrection
subsystem estimates the common phase noise or residual frequency offset for the non-ht portion of the wlan signal. cpe estimation requires references such as non-ht pilot positions, a non-ht pilot sequence, and pseudo-noise (pn) sequence as described in equation 17-25 in [ 1 ]. the wlanhdlrxinint.m
script initializes these known references and stores them in 1-d lookup tables in the subsystem. the polaritygenerator
subsystem gives the polarity of the pilots based on the symbol number. the reference pilots are multiplied with polarity for cpe estimation. the estimated cpe is averaged on all of the pilot subcarriers in an ofdm symbol and is used for the correction of data subcarriers of non-ht portion of the wlan packet.
open_system([modelname '/wlanhdlreceiver/nonhtcpeestandcorrection']);
ht or vht common phase noise estimation and correction
the htorvhtcpeestandcorrect
subsystem is similar to the nonhtcpeestandcorrect
subsystem. this subsystem performs cpe estimation and correction using ht or vht pilot positions and a ht or vht pilot sequence.
open_system([modelname '/wlanhdlreceiver/ht_vhtcpeestandcorrection']);
frame format identification and controller
to recover the signal and data field information from a wlan signal, you must use the wlan receiver frame format. this example supports non-ht, ht, and vht frame formats. the frameformatdetector
subsystem detects the frame format as non-ht, ht, or vht by buffering 3 ofdm symbols after l-ltfs, at the output of the nonhtcpeestandcorrect
subsystem. this flow chart describes the frame format detection. for more information, see [ 2 ].
the signal recovery
subsystem decodes the mcs from the first symbol l-sig. if the mcs is not 0, the frameformatdetector
subsystem detects the frame format as non-ht. if the mcs is 0, it checks the modulation scheme of ofdm symbol 2. if the modulation scheme of symbol 2 is qbpsk, the subsystem detects the format as ht. if the modulation scheme of symbol 2 is bpsk, it checks the modulation scheme of ofdm symbol 3. if the modulation scheme of symbol 3 is qbpsk, the subsystem detects the format as vht. if the modulation scheme of symbol 3 is bpsk, the subsystem detects the format as non-ht.
if the frameformatdetector
subsystem detects frame format as non-ht, then the remaining ofdm symbols, including ofdm symbols 2 and 3, are treated as l-data. the frameformatcontroller
subsystem passes the output of the nonhtcpeestandcorrect
subsystem to the datarecovery
subsystem to decode l-data.
if the frameformatdetector
subsystem detects the frame format as ht or vht, the frameformatcontroller
subsystem passes the output of the ht_vhtcpeestandcorrect
subsystem to the datarecovery
subsystem to recover ht-data or vht-data.
signal recovery
the signalrecovery
subsystem recovers the header information to decode data bits from l-sig, ht-sig, and vht-sig fields. the output of the nonhtcpeestandcorrect
subsystem corresponding to signal fields is streamed into the signalrecovery
subsystem. the symbol demodulator block performs bpsk and qbpsk soft symbol demodulation on signal fields in the wlan packet. the channel decoding includes deinterleaver
subsystem and viterbi decoder block.
the deinterleaver
subsystem performs deinterleaving on the symbol demodulated data with a maximum block size of 48 and the number of columns as 16. the viterbi decoder block performs 1/2 rate viterbi decoding on deinterleaved data. for more information on the deinterleaver
subsystem, see .
l-sig uses the parity to check the error in wlan l-sig field, whereas 8-bit cyclic redundancy check (crc) is used to check the error in the wlan ht-sig 1 and 2 and vht-sig-b field. the general crc syndrome detector hdl optimized block is used for crc error detection and paritycalculator
subsystem performs parity calculation. if the crc checksum or parity fails, the signal field recovery returns the status of parity check or crc (pass or fail).
open_system([modelname '/wlanhdlreceiver/frameformatdetectionandsignalrecovery/signalbitrecovery']);
data recovery
the datarecovery
subsystem uses the wlan signal fields to decode data bits. the registers are used to store wlan signal field information. these registers access the wlan signal field information. the symbol demodulator block performs soft-bit bpsk, qpsk, 16-qam, or 64-qam symbol demodulation associated with the modulation type retrieved from the wlan signal field information.
if the decoded wlan channel coding type is bcc, the deinterleaver
and the bcc decoder
subsystems perform deinterleaving and viterbi decoding on the symbol demodulated data. the deinterleaver
subsystem consists of different deinterleavers for non-ht and ht or vht data. the deinterleaver for non-ht data is configured with a block size of 48 and number of columns as 16. the deinterleaver for ht or vht data is configured with a block size of 52 and number of columns as 13 for 20 mhz and a block size of 216 and number of columns as 18 for 40 mhz, respectively. the bcc decoder
subsystem is equipped with depuncturer and viterbi decoder blocks. each code rate is assigned a predefined punctured vector pattern. based on the code rate retrieved from the wlan signal field information, the bcc decoder
subsystem performs depuncturing followed by viterbi decoding.
if the decoded wlan channel coding is ldpc, the ldpctonedemapping
subsystem in the dataselector
subsystem performs the ldpc tone demapping for vht data before symbol demodulation. the ldpc decoder
subsystem in this example decodes one ldpc codeword data. the ldpcparameterscalculator
subsystem computes the required ldpc parameters such as the ldpc length, the number of payload bits, the number of shortened bits, and the number of punctured bits for the codeword. the ldpc codeword formation
subsystem depunctures the symbol demodulated data to form one ldpc codeword using the ldpc parameters. the block decodes the depunctured data based on the codeword block length index and the code rate index.
the decoded bits are streamed through the descrambler
subsystem.
open_system([modelname '/wlanhdlreceiver/datarecovery']);
file structure
this example uses one simulink models and three matlab files.
wlanhdlreceiver.slx
— open the top-level ofdm receiver simulink model.wlanhdlreceiverinit.m
— this script is initialized in theinitfcn
callback of thewhdlhdlreceiver.slx
. this script useswlanwaveformgenerator.m
to generate the input waveform to the example.wlanhdlrxparameters.m
— generate the input parameters according to the standard ieee 802.11-2016 to run thewlanhdlreceiver.slx
model. the parameters correspond to non-ht, ht, and vht frame formats for 20 mhz and 40 mhz bandwidth options.wlanhdlmatlabrxreference.m
— implement a matlab floating-point equivalent wlan receiver using functions from the wlan toolbox.
model inputs and outputs
the inputs and outputs to the example model are described below
datain — input data, specified as a complex signed 16-bit signal sampled at 20 msps for 20 mhz and 40 msps for 40 mhz bandwidth options.
validin — control signal to validate the datain, specified as a boolean scalar.
startin — control signal to reset the receiver, specified as a boolean scalar.
dataout — decoded output data bits, returned as a bits.
validout — control signal to validate the dataout port, returned as a boolean scalar.
diagbus — status signal with diagnostic outputs, returned as a bus signal.
verification and results
this example model accepts a wlan transmit waveform as an input along with valid and start signals. the model returns decoded information bits as an output along with a valid signal. the wlanhdlreceiverinit.m
script provides the input to the model. for the demonstration of the example, the wlanwaveformgenerator.m
function in the script generates the vht mode, 20 mhz bcc channel coded frame, which is passed through the tgac channel with a delay profile of model a. the additive white gaussian noise (awgn) at a 30 db signal-to-noise ratio (snr) is added to the transmit waveform with other channel impairments such as 20 khz cfo and a timing offset of 256. to verify the example for ldpc channel coding, set the channel coding parameter to ldpc
on the input generation
subsystem, and run the example.
fprintf('\n simulating wlan hdl receiver \n'); out = sim(modelname); close_system(modelname,0); fprintf('\n hdl simulation complete. data decoded. \n');
simulating wlan hdl receiver hdl simulation complete. data decoded.
verify the outputs of this example using wlan toolbox™ functions. specify the same input waveform to the simulink model and to the matlab equivalent receiver. compare the outputs to validate the example.
fprintf('\n comparing wlan matlab reference receiver \n') wlanhdlmatlabrxreference; fprintf('\n matlab simulation complete. \n'); simout = squeeze(out.rxbits(out.rxbitsvalid)); errsig = (bitxor(logical(psdu),simout)); err = sum(errsig); hconstdata = out.headerconstellation(out.headerconstellationvalid); figure; plot(hconstdata,'o'); xlabel('in-phase'); ylabel('quadrature') title('equalized signal field constellation'); m = double(max(abs([real(hconstdata(:)); imag(hconstdata(:))])) * 1.1); axis([-m m -m m]); dconstdata = out.dataconstellation(out.dataconstellationvalid); figure; plot(dconstdata,'o'); xlabel('in-phase'); ylabel('quadrature') title('equalized data field constellation'); m = double(max(abs([real(dconstdata(:)); imag(dconstdata(:))])) * 1.1); axis([-m m -m m]); figure; plot(errsig); xlabel('sample number'); ylabel('error magnitude'); legend('error') title('error magnitude between simulink and matlab wlan receiver output'); if err == 0 fprintf('\n simulink and matlab outputs match \n'); else fprintf('\n simulink and matlab outputs do not match \n'); end
comparing wlan matlab reference receiver matlab simulation complete. simulink and matlab outputs match
hdl code generation and implementation results
to generate the hdl code for this example, you must have the hdl coder™ product. to generate hdl code and an hdl testbench for wlanhdlreceiver
subsystem, use the makehdl
and makehdltb
commands. the resulting hdl code was synthesized for a xilinx® zynq® ultrascale rfsoc zcu111 evaluation board. the table shows the post place and route resource utilization results. the design meets timing with a clock frequency of 306 mhz for 20 mhz and 40 mhz bandwidth options.
f = table(... categorical({'clb lut'; 'clb registers'; 'ramb36'; 'ramb18';... 'dsp48'}),... categorical({'99,978'; '94,294'; '262'; '10'; '323'}),... categorical({'1,02,237'; '96,758'; '266'; '14'; '351'}),... 'variablenames',... {'resources','usage for 20 mhz', 'usage for 40 mhz'}); disp(f);
resources usage for 20 mhz usage for 40 mhz _____________ ________________ ________________ clb lut 99,978 1,02,237 clb registers 94,294 96,758 ramb36 262 266 ramb18 10 14 dsp48 323 351
references
ieee 802.11-2016 - ieee standard for information technology--telecommunications and information exchange between systems local and metropolitan area networks--specific requirements - part 11: wireless lan medium access control (mac) and physical layer (phy) specifications.
nanda kishore chavali, 'system and method for detecting a frame format' (march 2013), .
see also
blocks
- | | | |