Skip to content

silicondsp/ofdm-release

Repository files navigation

ofdm

Block Diagram C Modeling and Simulation of OFDM Systems

sdsp logo

Linux Tux Developed on Linux.



Icons link github and link building Noun Project.

Item

Description

Link

Type

1

Introduction to the Capsim® OFDM (IEEE 802.11a) Block Diagram Modeling and Simulation

link

Introduction

2

Capsim® Block Diagram End to End OFDM ( IEEE 802.11a) With Channel Model, SNR and Full Acquisition and Demodulation

link

Screen Shots

3

List of Topologies Included in Repository

link

Table

4

List of OFDM and Channel Model C Blocks Included in Repository

link

Table

5

List of OFDM and Channel Model C Subroutines Included in Repository

link

Table

6

Building Capsim® for OFDM Modeling and Simulation

link building

Instructions

7

Capsim® Text Mode Kernel (TMK) Installation

GitHub Repository

8

GitHub Repository Capsim® OFDM Block Diagram Modeling and Simulation

GitHub Repository

9

OFDM Video Tutorials by Silicon DSP Corporation

youtube

Video Tutorial

10

OFDM Release HTML README

link

HTML Link





Copyright (c) 1993-2007 Silicon DSP Corporation
Permission is granted to copy, distribute and/or modify this
document under the terms of the GNU Free Documentation License,
Version 1.2 or any later version published by the Free Software
Foundation; with no Invariant Sections, no Front-Cover Texts, and
no Back-Cover Texts. A copy of the license is included in the
section entitled "GNU Free Documentation License". 

Introduction

Silicon DSP Corporation has developed all the C code for a full implementation of the IEEE802.11a OFDM end to end Block Diagram Modeling and Simulation system. This includes full support for acquisition, equalization, and carrier offset correction. The modular architecture uses individual blocks (written in C) for the implementation of the various stages in modulation and demodulation. Subroutines ( C code) are also supplied with Include files shared between blocks and subroutines. See the Block Diagram of a full system here.

The majority of blocks were written in 2002 with major enhancements throughout the years. The OFDM system has been the basis for successfull FPGA implimentation for real time processing over the air.

In addition, the Capsim® OFDM Block Diagram system was extensively used in developing the youtube Tutorials on OFDM.

Click here for the OFDM Tutorial Videos on youtube.

Note: this repository supports the Text Mode Kernel version of Capsim®. The graphical block diagram is from the soon to be released Capsim® Version 7 which uses Qt® for interactive graphical interface. However, the topology in this Repository are the same. You can use the block names in the screen shot and then use the Capsim® command "to blockname" to go the the block, change parameters and run the simulation. There is a lot of benefit to the non graphical mode in portability and flexibility. The graphical version also supports the text mode operation.

An updated link to Capsim® Version 7 using Qt® will be provided in the Repostory on GitHub. Stay tuned.

Note: to view topology, right click, select Open Image in New Tab. Then zoom-in.

Capsim® OFDM (802.11a) End to End Block Diagram With Acquisition and Channel Modeling and SNR Specificaton

ofdm_ete_acq
constellations
xcorr_constellations

List of Topologies (Block Diagrams and Hierarchical Blocks and TCL Scripts)

ItemTopology NameDescriptionAuthorDate
1 OFDM_11a_Acquisition_2.t Full end to end IEEE 802.11a OFDM with Fading Channel, Carrier Offset and Acquisition. Ardalan 2007
2 OFDM_11a_Acq_CO_Drift.t Demonstates Pilot Tracking correcting for residual carrier offset with low SNR. Ardalan 2007
3 MR_OFDM_SS_CH.t End to End All Rates Steady State with Channel Est. Equalization No Acquisition OFDM based on IEEE 802.11a Ardalan September 24, 2002
4 adjacent_channel.t Model adjacent channel in 802.11a Ardalan 2007
5 chm_80.t Hierarchical Block(HBlock) SISO Fading Channel Model used in MR_OFDM_SS_CH.t Ardalan 08/11/2002
6 constellation.t Plot Constellation and Compute EVM. Reads from file (qam64.dat) Ardalan March 2007
7 cxdecim.t HBlock Complex Decimation Ardalan February 1, 2002
8 cxrsmpl.t HBlock Resample Complex Interpolation. Specify oversampling ratio. Ardalan February 1, 2002
9 JakesModel.t HBlock Jake's Model Mobile Fading Channel. Used in OFDM_EE_JK2.t Ardalan September 29, 2001
10 MR_OFDM_SCRIPT.t OFDM Scriptable With TCL. End to End All Rates Steady State with Channel Est. Equalization No Acquisition OFDM based on IEEE 802.11a Ardalan September 24, 2002
11 MR_OFDM_SS_CH_SCRIPT.t OFDM Scriptable With TCL. End to End All Rates Steady State with Channel Est. Equalization No Acquisition OFDM based on IEEE 802.11a Ardalan September 24, 2002
12 per.tcl Packet Error Rate AWGN Channel Multiple Rates Steady State.TCL Script that tabulates the PER versus SNR for AWGN all rates. Uses topology MR_OFDM_SCRIPT.t. Long simulation run. Be patient. Use 'ls -lt' after run to check for results. Ardalan August 10, 2007
13 perfade.tcl Packet Error Rate Fading Channel ((rms delay spread)) and AWGN Channel Multiple Rates Steady State. Ardalan August 10, 2007
14 OFDM_EE_JK2.t IEEE 802.1a OFDM with Acquisition and wih Jake's Channel Model with Doppler Showing Pilot Tracking with High Vehicle Velocities. Ardalan 2007
15 plot_complex_mag.t Read complex data in file, convert to magnitude and plot 2007
16 QuardatureModulator.t Quadrature Modukator Heierchical Block (HBlock) specify carrier frequency and sampling rate. Complex input buffer. Used by adjacent_channel.t Ardalan 1992
17 signalFieldDecode.t Hierarchical Block (HBlock) Signal Field Decode from Signal Field OFDM Symbol 48 Carriers 2002
18 Tx80211aMR.t Hierarchical Block (HBlock) All Rates Transmitter OFDM based on IEEE 802.11a Ardalan September 2002

List of Blocks

ItemBlock NameDescriptionAuthorDate
1 byte2bit.s Convert Byte Buffer to Bits Buffer Ardalan August 1, 2007
2 carroffsetcorr.s Function has a single complex input buffer, and output buffer. The parameter is the carrier offset normalized to the carrier spacing. Ardalan August 1, 2001
3 carroffset.s Function has a single complex input buffer, and output buffer. The parameter is the carrier offset frequency. Ardalan August 1, 2001
4 convenca.s Accepts 27 ints carrying 27*8 = 216 bits packed as b7 b6 b5 b4 b3 b2 b1 b0. Bits are repacked to form 7 unsigned long int ~~ 32 bit words. Call to function convenc.c produces the same number of output bits packed the same way. Within the block function output bits are repacked as 8 bits per int to form 27 output integers. prev6 contains 24 last bits from the previous input stream (only 6 bits are needed hence the name). It is initialized to 0 when convenc.c is first called. Ardalan 2001
5 convencm.s Convolutional encoder Ardalan August 15, 2001
6 cxaddnoise54new.s This block adds white gaussian noise to the input complex data stream.Sep 16, 2002 Bin Huang, add the calculated noise deviation in terms of SNR(Eb/No). James Faber November, 1987
7 cxagc.s This block adjust the gain to achieve a target rms value. Ardalan Sept. 1, 2006
8 cxautocorr.s Autocorrelation Complex Ardalan 2007
9 cxavgchannel.s Input the two LTS and average them in the time domain. Then output. Ardalan September 11, 2006
10 cxchmodel.s This block models a fading channel. Given the sampling rate in MHz and the delay spread in ns the complex impulse response is computed and convolved with the complex input stream. Reference: Evaluating the Performance of HRb Proposals in the Presence of Multipath Steve Halford, Karen Halford, and Mark Webster ** Intersil Corporation September, 2000 Submission to IEEE doc.: IEEE 802.11-00/282r2 Matlab coded converted to C Ardalan August 28, 2006
11 cxcorr.s This block correlates the input samples with the sequence given in a file. Adali Tulay September 23, 1988
12 cxdc.s This block adds DC to the incoming complex data stream by the complex parameter coefficient, and outputs the resulting complex data values. Auto fanout is supported. Ardalan 2007
13 cxequalizezf.s Equalize channel using zero forcing. Get channel estimates from buffer 0. Ardalan January 2007
14 cxgphase.s Multiplies input complex samples by amplitude*exp(j*phase) Ardalan 2007
15 cxinterf.s Add sinusoidal interference to complex stream. Ardalan October 18, 2006
16 cxstats.s This block calculates the statistics of the incoming signal. The parameter is a filename for storage of the results.TCL variables are created. Prayson W. Pate December 8, 1987
17 cxwstat.s This block calculates the statistics of the incoming signal. The parameter is a filename for storage of the results.TCL variables are created. Prayson W. Pate December 8, 1987
18 dataField11a.s Will create data field which includes 16 service bits, data bits(PSDU) 6 tail bits and Pad bits. In this function, the number of OFDM symbols and the number of Pad bits will be decided. The number of OFDM symbols will be sent to Signal packet. Bin Huang 10/4/2001
19 dataField.s Will create data field which includes 16 service bits, data bits(PSDU) 6 tail bits and Pad bits. In this function, the number of OFDM symbols and the number of Pad bits will be decided. The number of OFDM symbols will be sent to Signal packet. Bin Huang 10/4/2001
20 dataSelectioncx.s To select meaningful 48 data out of 64 point FFT result. Bin Huang 8/14/2002
21 dataSelection.s To select meaningful 48 data out of 64 point FFT result. Bin Huang 8/14/2002
22 deinterleaver.s Fixed point 802.11a Deinterleaver for rate=48,54 Mbps, total number of input bits is 288*n. n is the number per soft bit and it can be any of 3, 4,5,6,7,8. In order to implement this code easily, we put each soft bit into an integer. Bin Huang 8/24/2001
23 demapper11a.s Demmapper Bin Huang 6/20/2002
24 depuncture.s Inserts "weak" zeros Bin Huang 6/20/2002
25 descrambler.s descramble Anisim Silivra Oct. 12, 2001
26 estsplit.s This block is used to split an input buffer into two output buffers. The first output buffer outputs 64 complex zeroes at the beginning. It then forwards the input buffer samples to the output buffer. The second output buffer outputs 64 complex samples followed by all zeroes for each input sample. The first 64 samples represent an all pass channel estimate ( H(jw)=1). Thre purpose of the start is to create the inputs that the fftofdm star needs as it exepcts that for each packet, the channel estimation correction factors are present on the second input buffers. The fisrs input buffer has the OFDMs symbols follwing 64 zeroes. Again the purpose of this star is to use fftofdm in cases where we are not doing carrier freq. offset correction or channel estimation which provide these signal Ardalan September 27, 2001
27 evm.s This routine will produce a evm plot of the two input channels. channels. Optionally, the input channel data can 'flow through' to the correspondingly numbered output channel. This is useful if this block is to be placed in line in a simulation (e.g. probe). Ardalan 8/16/1987
28 fft54.s This block produces the FFT of the input signal. The points are output as complex numbers. The number of points input is npts and the number of points generated is npts.Bin Huang, added pilot tracking block Ardalan/Bin Huang July 26, 2001
29 forksignalfield.s Given stream with 48 carriers per symbols select the first 48 as signal field and fork it out passing through remaining symbols. Bin Huang 8/14/2002
30 FQAM_64map.s Floating point 802.11a 64-QAM mapping function, total number of input bits is 288. The output should be 48 complex symbols. Bin Huang 8/21/2001
31 framesynch.s This block correlates the input samples with the sequence given in a file. Ardalan October 2002
32 freqoffsetcorr54.s This block produces the FFT of the long term training samples based on the moditoring of the frame synch input. It then computes the frequency offset using the ML estimate. It then corrects the frequency offset in the input complex stream prior to output for FFT processing. Ardalan July 26, 2001
33 fwfft.s Forward FFT Ardalan 2001
34 ifft_ofdm11a.s Includes the training sequences, cyclic extention and windowing. Bin Huang 7/22/2002
35 ifftofdm54.s Includes the training sequences, cyclic extention and windowing. Bin Huang/Ardalan 7/22/2002
36 interlr.s Fixed point 802.11a interleaver all rates. Bin Huang 10/6/2001
37 invfft.s Inverse FFT Ardalan Dec. 2001
38 jkfadenew.s This blok models multipath fading channels for mobile radio applications. Ardalan Dec. 27, 1990
39 jkfade.s This blok models multipath fading channels for mobile radio applications. Ardalan Dec. 27, 1990
40 longsynchss.s Long symbol synchronization for steady state (no acquisition). Ardalan September 2, 2006
41 mapper11a.s Floating point 802.11a QAM mapping function, total number of input bits depends on rate. The output should be 48 complex symbols. Bin Huang 8/21/2001
42 noisedev.s Calulate the noise variance in term of Eb/No. Bin Huang 11/9/2001
43 packstats.s Calculate statistics of packet (also AGC) store in a file Ardalan 2007
44 parseSignalField.s Parse 802.11a signal field and provide rate, length and parity as TCL variables. Bin Huang 8/5/2002
45 pilot.s Perform pilot insertion. Bin Huang 6/11/2002
46 pkdet64x.s OFDM packet detection (IEEE 802.11a) Ardalan September 1, 2006
47 pkdetcarroffset.s Packet Detection Autocorrelation and Coarse Carrier Offset Ardalan March 2003 Revised 2007
48 puncture11a.s Puncture IEEE 802.11a puncturing function used to come up the coding rate with 1/2,2/3 and 3/4. Bin Huang 10/11/2001
49 puncture.s Puncturing function used to come up the coding rate with 1/2,2/3 and 3/4. Bin Huang 10/11/2001
50 qam64cx.s QAM64 OFDM Soft and Hard Option Bin Huang 2002
51 qammapper.s This block inputs data and ouputs the coordinates based on the 64-QAM encoding defined in 802.11a. It produces an in phase and quadrature component. Not very efficient but illustrative. Ardalan July 26, 2001
52 rdscrfile.s This function performs the simple task of reading sample values in from a file, and then placing them on it's output buffer. The file may have multiple sample values per line, which can be integer or float. An example use for this routine is to access a stored waveform as input to a simulation. R. T. Wietelmann / D.G.Messerschmitt June 5, 1982
53 rmcpfx.s Cyclic Prefix Removal Ardalan Dec. 12, 2001
54 scramble11a.s Sasan Ardalan, August 3,2007 Hacked to make it work on a bit at a time Anisim Silivra Oct. 5, 2001
55 scramble.s scramble_216 Anisim Silivra Oct. 5, 2001
56 signalDecod.s SIGNAL field decoding on the receive and provides the data rate and length Bin Huang 8/5/2002
57 skipshort.s Skip Short Symbols Used in Steady State Ardalan 2007
58 symbolenergy.s Calulate the average symbol energy. Each sysmbol has 64 complex samples. Bin Huang 11/12/2001
59 synchlong.s For steady state no acquisition skips over short preamble and outputs long symbols for channel estimation and outputs OFDM symbols. Ardalan March 2007
60 synchltscfc.s Long Symbole Fine Carrier Offset Estimation Ardalan September 2, 2006
61 test.s Desciption Author Date
62 trackpilots.s Modified 9/26/2002, Bin Huang, revised the pilot tracking and made it even more robust. Algorithm basically derived based on known pilots. So this algorithm works associated with pilot.s on the transmit. Also, this algorithm can deal with up to 35m/s mobile velocity. Modified 10/29/2002, Bin Huang, added amplide adjustment(ampAdjust) in order to adjust signal amplitude changes due to doppler shift. This adjustment helps this PHY work up to 82mi/hr(37m/s). Bin Huang 9/26/2002
63 vitdec_pars.s Viterbi Decoder Ardalan August 15, 2001
64 zdummy.s Dummy Block

Table of Subroutines

ItemBlock NameDescriptionAuthorDate
1 ComputeFreqOffset.c Compute Frequency Offset Adalan 2002
2 convenc.c Convolutional Encoder Bin Huang 2001
3 convolution.c industial standard convolution encoding with coding rate of 1/2 and constraint length of 7. The generator polynomials are (177,133). Bin Huang 6/1/2002
4 conv_punc.c interface between convolutional coding and puncturing, the output of conv. coding are two packed 32-bit integers, the inputs to puncturing should be a data array and each element only contains value 0 or 1, so need a small function to covert packed 32-bit data into parse 0 or 1. Bin Huang i9/25/01
5 dataselect.c Perform data selection: data reorder, remove the zeros. Bin Huang 8/6/2002
6 demap_bpsk.c Perform soft decision BPSK demapping scheme. This routine is used in SIGNAL field. Bin Huang 8/11/2002
7 demap.c Perform both soft decision and hard decision modulation demapping with quantization on 64 QAM, 16QAM, 4 QAM and BPSK. Bin Huang 8/7/2002
8 descramble.c De-Scarmble Anisimm 2001
9 dummy2.c Dummy Subroutine
10 fbpsk.c Floating point 802.11a BPSK mapping, total number of input bits is 48. The output should be 48 complex symbols(Q15) Bin Huang 7/19/2001
11 fft2s.c Perform both FFT and IFFT by setting FFTswitch 1 and -1 respectively. General input N = 2^n, n is any integer and n>=0 && n<=31. Source Ardalan 1992
12 fftofdm54.c Perform both FFT and IFFT by setting FFTswitch 1 and -1 respectively. general input N = 2^n, n is any integer and n>=0 && n<=31. Ardalan 2001
13 fpilot_insertion.c IEEE 802.11a pilot isertion, total number of input symbols is 48(complex). The output pattern should be like index: 0,1, 2,....,26, 0,0....0,-26, -25, -24,.....-1. This file doesn't include polarity of pilot subcarriers. Bin Huang 7/30/2001
14 interbpsk_conver.c Interface between interleaving coding and BPSK mapping. The output of interleaving coding are distributed in three 32-bit registers in for PEs. The inputs to BPSK mapping should be packed data. So the data conversion between interleaving and BPSK mapping is needed. Bin Huang 9/25/2001
15 Interleave.c This is straight out of the IEEE 802.11a standard Ncbps: number of bits in a coded bits per symbol, Nbpsc: number of coded bits per subcarrier 2002
16 intrlvr_unit.c Interleave Test Unit Ayman 2001
17 myatan2.c atan2 Bin Huang 2002
18 mycos_32.c Cos 2002
19 mycos_32s.c Cos Bin Huang 2002
20 myfloor.c Floor Bin Huang 2002
21 myfmod.c FMOD Bin Huang 2002
22 mysin_32.c Sin Bin Huang 2002
23 polarity.c Perform the polarity to the inserted pilots Bin Huang 7/31/2002
24 punctureofdm.c Perform puncturing in order to come up different coding rate after convolution encoding with coding rate of 1/2 and constraint length of 7. Bin Huang 6/31/2002
25 scrambler_216.c Scrambler Anisim Silvara 7/2/2001
26 signalfield.c Fixed point 802.11a signal field, total number of signal bits are 24. The input 'rate' should be 0(6),1(9),2(12),3(18),4(24),5(36),6(48),7(54) respectively. The input 'length' should be any number between 1--4095. Bin Huang 9/17/2001
27 signalpacket.c This signalPacket.c file is a control code for sending SIGNAL field through convolutional coding, puncturing, interleaving and BPSK mapping. Bin Huang 9/25/2001
28 swap_p.c Perform the data swap in order to come up with the IFFT input requirment Bin Huang 7/5/2002
29 tables.c Floating point 802.11a table file. Bin Huang 8/19/2001
30 unpackdeinter6.c Fixed point 802.11a Deinterleaver for rate=6,9 Mbps, total number of input bits is 48 in float format. Bin Huang 11/09/2001


Instructions for Running Capsim® OFDM Block Diagram Simulation.

1- Obtain the Capsim® Text Mode Kernel (CapsimTMK) for Linux from:

GitHub Capsim Text Mode Repository

CapsimTMK is distributed with hundreds of blocks. To simulate OFDM systems the blocks in this repository have to be incorporated into Capsim® including subroutines.

This Repository contains the Topologies for IEEE 802.11a OFDM block diagram modeling including required blocks and subroutines.

Note: Follow the Getting Started Guidelines in the CapsimTMK Repository.

2- Once CapsimTMK is installed just run 'make' in this repository's main directory.

3- Then change to the directory '11a_tops' and run:

../capsim OFDM_11a_Acquisition_2.t

The block diagram for the OFDM_11a_Acquisition_2.t topology is shown here.

The following is the console report:

 
 Welcome to Capsim Text Mode Kernel (CapsimTMK)
(c)1989-2017 Silicon DSP Corporation
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
http://www.silicondsp.com
Version 6.2
Running topology OFDM_11a_Acquisition_2.t
model name: OFDM_11a_Acquisition_2
fs(MHz)=20.000000 delay spread (ns) =50.000000 
Kmax=10
ANormIdeal=0.154303
nData=6048 nPad=26 nSym=28 
SIGNAL FIELD: 25dcc , rate=c , length=2ee 
cxagc rmsVal=0.162479 gain=0.492370 
pkdetcarroffset:    preamble detected
THETA= -99458.976562 
carroffsetcorr0 using CFO Estimate:-99458.976562
THETA= -99724.640625 
carroffsetcorr0 using CFO Estimate:-99724.640625
pkdetcarroffset:    preamble detected
THETA= -99841.218750 
carroffsetcorr0 using CFO Estimate:-99841.218750
THETA= -99558.742188 
carroffsetcorr0 using CFO Estimate:-99558.742188
pkdetcarroffset:    preamble detected
THETA= -99579.929688 
carroffsetcorr0 using CFO Estimate:-99579.929688
THETA= -99459.906250 
carroffsetcorr0 using CFO Estimate:-99459.906250
pkdetcarroffset:    preamble detected
THETA= -98679.234375 
carroffsetcorr0 using CFO Estimate:-98679.234375
THETA= -99011.054688 
carroffsetcorr0 using CFO Estimate:-99011.054688
pkdet64x found long at: 288 currentRMS= 0.078526 mag=0.520235 thresh*rms=0.314106
synchltscfc: IndexIn=288 OffsetAdj=63PEAK at index 0 sampleCount=288 
synchltscfc: fine(rad)=0.014848 fine(freq)=738.483582  coarse=0.000000 TOTAL=-738.483582 
Data rate(MHz): 54 
Data length in bytes: 750 
Signal Field Parity PASS
plot created file: 64xcorr.tim 
plot created file: plot.tim 
scatter created file: PreEqualization.sct 
plot created file: Long.tim 
plot created file: Mag.tim 
scatter created file: Equalized.sct 
scatter created file: Track_Applied.sct 
scatter created file: Pilots.sct 
scatter created file: SigField.sct 
scatter created file: Data.sct 
evm created file: EVM.sct 
EVM=0.007907	EVM_DB=-21.019665
ecount: hits/samples = 0/6016  (ignore 0)  BER = 0/6016 = 0

In the simulation the SNR was set to: 35 DB.

Note that the OFDM receiver correctly reports the rate: 54 Mbps.

Use the plotting tool provided with the CapsimTMK repository:

java -jar $CAPSIM/TOOLS/IIPPlot.jar 64xcorr.tim

java -jar $CAPSIM/TOOLS/IIPPlot.jar -scatter Track_Applied.sct

java -jar $CAPSIM/TOOLS/IIPPlot.jar -scatter Data.sct

There are multiple results you can plot.

Note the EVM in DB= -21.02

For IIPPlot and its User Guide see here.

With Linux you can send the plot application to run in the background to put plots side by side when you want to display multiple plots. Then bring them to the forgound and use Control C to exit.

To run the TCL scripts, for example per.tcl, use this command:

../capsim -t per.tcl

Note that per.tcl runs many simulations over all rates with different SNR and will take a while to run. So patience is recommended.

About

Block Diagram C Modeling and Simulation of OFDM Systems

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published