# DSP-OFDM Modulator Project

**Disclaimer:** This dissertation has been submitted by a student. This is not an example of the work written by our professional dissertation writers. You can view samples of our professional work here.

Any opinions, findings, conclusions or recommendations expressed in this material are those of the authors and do not necessarily reflect the views of UK Essays.

### Chapter One

### Introduction to the DSP-OFDM Modulator Project

### 1.1 Introduction

The Orthogonal Frequency Division Multiplexing (OFDM) digital communication technique has been attracting a great concern of researchers all over the world, due to its unique characteristics. The designers and engineers of mobile wireless communication systems and wireless multimedia broadband are looking forward to exploit the OFDM to be the air interface of these devices and systems. This exploitation has already been done with several systems and standards such as Wireless Local Area Networks 802.11a and Digital Video Broadcast-Terrestrial (DVB-T).

The DSP-OFDM Modulator project studies the essential parts of the OFDM modulator and demodulator and implements the OFDM modulator and demodulator on two separate DSP boards. For the OFDM modulator, the project studies the hardware DSP implementation of the OFDM modulator's different parts such as the QAM mapper and the IFFT. This applies on the OFDM demodulator too. Additionally, for the OFDM demodulator, the project studies the carrier recovery issue to recover the OFDM information signal from the carrier signal and the OFDM symbol timing recovery issue to correctly pinpoint each OFDM symbol's boundaries.

The Projects involves several aspects of the digital communications and the theoretical and practical DSP and uses the MATLAB and the Code Composer Studio (CCS) to analyze and simulate the designs to be practically implemented.

### 1.2 The Aim and the Objectives

The aim of the DSP OFDM Modulator project is to implement OFDM modulator and demodulator on two separate DSP boards. The implementation is not tied to any existing OFDM standard such that used in the DVB-T or other standards.

The DSP hardware implantation comprises many DSP and digital communication operations to be implemented through writing the C codes that perform these operations i.e. the QAM mapping and de-mapping, the IFFT and FFT, the digital IIR filters and the synchronization.

Therefore, the implementation will be first simulated by MATLAB and the Code Composer Studio (CCS) part by part before and with the hardware implementation on the DSP boards. The CCS will be used to simulate not only the modulator and demodulator but also the subparts of the hardware implementation such as the FFT and IFFT C codes. For example, the C code that will be used to perform N-Point IFFT to a complex array containing N complex elements to produce N outputs. These N outputs or discrete values will be compared with those N outputs or discrete values obtained from performing N-Point IFFT to the same N element-complex array in MATLAB in order to check that this C code will work properly in the DSP real time implementation of the OFDM modulator.

### 1.3 The Research Background and Motivations

The good presentation of the theoretical and practical DSP during the taught part of the course encouraged me to tackle this project, as I had not done any practical DSP before I enrolled in the MSc Wireless Communication Systems course. The good understanding of the discrete Fourier transform (DFT) allows presenting the Conjugate Symmetric approach. The use of the Conjugate Symmetric distribution of the subcarrier vectors on the IFFT input points makes the IFFT produce a multicarrier signal with a real part (In-phase) (I) only in the time domain, as the imaginary part (Quadrature) (Q) is always set to zero. It is easier to modulate and demodulate the OFDM information signal with a real part only, as the quadrature modulation is no longer required. The Conjugate Symmetric proposal allows applying the FM modulation to transmit and receive the multicarrier OFDM information signal.

### 1.4 The Thesis's Organization

The thesis consists of five chapters. Chapter two is considered as a literature survey. Chapter two explains the OFDM spectrum and the principles of the OFDM modulator and demodulator. It illustrates how the OFDM information signal carries or represents the digital data bits and how the IFFT N outputs (discrete values) are actually the samples of the OFDM multicarrier information signal for the current OFDM symbol being generated. It will be shown how the OFDM symbol has longer duration than those of other digital communication modulation techniques without affecting the data rate to be more resilient with dispersive channels and many other aspects of the OFDM modulation technique. This project is not tied to any existing OFDM standard. However, it resembles these standards in terms of the general block diagrams of the OFDM systems and the use of the pilot carriers, hence the employment of the OFDM in the DVB-T and the WLAN 802.11a are described briefly in chapter two.

Chapter three shows and simulates by using MATLAB the approaches and ideas that will be used for the hardware DSP implementation. It discusses the (Conjugate Symmetric) proposal that has come out of this project to facilitate the modulation and demodulation of the OFDM information signal and the use of the squared cosine method to recover the OFDM information signal from the modulated carrier signal. The use of the cyclic prefix (CP) to recover the OFDM symbol timing is also discussed in chapter three.

Chapter four presents the hardware implementation of the DSP OFDM modulator and demodulator on two separate DSP boards and shows the different results of the hardware implantation on the oscilloscope's screen as well as it shows the results of the CCS simulation of the OFDM modulator and demodulator and compares the OFDM spectrum of the generated OFDM information signal generated by the Conjugate Symmetric approach with that generated from the traditional method.

Chapter five is for the conclusion points that have come out of this project and the further work to be implemented in the future.

The attached CD contains the real time DSP implantation CCS projects of the OFDM modulator (OFDM-TX project) and OFDM demodulator (OFDM-RX project) and the CCS simulation of the OFDM modulator and demodulator (Simulation project) as well as the MATLAB codes and an electronic copy of the thesis.

### Chapter Two

### OFDM Basics

### 2.1 Introduction

In the digital communications, the transmitted signal over a wireless channel is more preferred, when the symbol duration is significantly greater than the delay spread (s) of this channel to avoid the intersymbol interference (ISI) due to the time dispersion of transmitted symbols. But unfortunately, the symbol duration is reversely proportional to the bit rate which means a great constraint when high data rate transmission is required over a wireless channel with a relatively high delay spread due to the multipath environment of that channel [1].

The OFDM technique produces the solution to this problem, as it divides the high rate bit stream into (N) very low rate bit streams that are transmitted simultaneously using (N) orthogonal subcarriers for every OFDM symbol. Each of these low rate bit streams modulates an individual subcarrier. Therefore, the symbol duration is increased as many as (N) times without reducing the actual bit rate.

### 2.2 The Spectrum of the OFDM Subcarriers

### Figure (2-1) y(t) (the dotted curve) is the algebraic summation of the 5 sinusoidal waves

### Figure (2-2) the spectrum of y(t) in the frequency domain (five stems or tones)

### Figure (2-3) the rectangular function with (?t) duration in the time domain

### Figure (2-4) the spectrom of the rectangular function in the frequency domain

### Figure (2-5) the spectrum of the OFDM symbol with five subcarriers

Suppose y(t) is a signal consisting of the algebraic summation of five sinusoidal waves (subcarriers) in the time domain with five different frequencies (f1, f2, f3, f4 and f5) respectively figure (2-1). Suppose these subcarriers have the same frequency spacing (?f) between each adjacent subcarriers in the frequency domain. The spectrum of y (t) in the frequency domain in terms of the magnitude has five stems at f1 to f5 respectively. Each stem (single tone) represents one of these five sinusoidal waves or subcarriers figure (2-2).

Now, suppose an OFDM symbol (with symbol duration = (?t)) consists of the same five sinusoidal subcarriers mentioned earlier. The spectrum of this OFDM symbol in the frequency domain does not now consist of five stems; instead the spectrum is like that one in figure (2-5). The spectrum in figure (2-5) consists of five overlapped sinc functions each of which represents an individual subcarrier.

Actually, our OFDM symbol is not identical to y(t). More precisely, it is a (truncated y(t)) with truncation duration equal to the OFDM symbol duration (?t). When a signal is truncated in the time domain with equal gain over all the truncated points within the period (?t), that means mathematically multiplying this signal with a rectangular function in the time domain with a time duration equal to (?t) figure (2-3). The shape of the spectrum of rectangular function in terms of the magnitude is single sinc wave in the frequency domain cutting the horizontal axis at points equal to the integer multiples of the reciprocal of the time duration (1/?t) figure (2-4). Basically, when any two signals are multiplied in the time domain, the resultant signal of this multiplication has a spectrum in the frequency domain equal to the convolution of the spectrums of the two original signals. Therefore the spectrum in figure (2-5) represents the resultant of the convolution operation between the five stems of y(t) figure (2-2) and the sinc of the rectangular function figure (2-4) in the frequency domain.

Looking at figure (2-5) again, it is easy to notice that the peak of each subcarrier sinc occurs at a point where all other four sincs have magnitudes equal to zero at which. This situation is the condition of the orthogonality between the subcarriers as it ensures the least interference between the subcarriers in the frequency domain. The orthogonality between subcarriers is not achieved, unless the frequency spacing between the subcarriers (?f) is equal to the reciprocal of the OFDM symbol duration (1/(?t)) [2].

### 2.3 The OFDM Modulator

The OFDM Modulator uses the Quadrature Amplitude Modulation (QAM) Mapper and the Inverse Fast Fourier Transformer (IFFT) to simultaneously generate and modulate the subcarriers of each OFDM symbol. Figure (2-6) shows a general block diagram of the OFDM modulator.

The OFDM modulator builds and transmits each OFDM symbol consisting of a number of subcarriers equal to N as follows. The QAM mapper maps the data bits to (N) QAM vectors. Each of these vectors has real and imaginary components and represents a single subcarrier. The number of data bits that are mapped to each QAM vector (subcarrier) depends on the QAM order (M) as shown in table (2-1). Using QAM mapper with higher order produces higher data rate. However, this will be at the cost of the reception quality as the constellation of higher order QAM allows higher Bit Error Rate (BER) for a given

- The QAM Mapper stage maps data bits to QAM vectors in accordance with the QAM constellation.
- The Serial to Parallel (S/P) buffers the QAM vectors of each OFDM symbol to prepare them for the IFFT operation.
- The IFFT stage converts the buffered QAM vectors (the subcarriers) from the frequency domain to produce an OFDM symbol sequence equivalent to the algebraic summation of these sinusoidal subcarriers in the time domain to be buffered in the next stage.
- Guard Interval Insertion and Parallel to Serial stages add the guard interval to each buffered OFDM symbol sequence and produces it serially to the next stage.
- The DSP Low Pass Filter (LPF) and The Digital to Analogue Convertor (DAC) stages are to smooth the signal and convert the digital sequence into analogue signal.
- The Up Conversion and The Power Amplification stages.

### Figure (2-6) general block diagram of the OFDM modulator.

The 4-QAM constellation, which is identical to Quadrature Phase Shift Keying (QPSK) constellation, gives the receiver more tolerance to the changes of the amplitude and phase of any received QAM vector and allows the receiver to de-map it to the correct 2-bit-combination, as long as it still lies in the same quadrant from which it was originated at the transmitter, whereas 16 and 64 QAM constellations give less tolerance to the change in the phase and amplitude of the received QAM vector due to the noise and interference.

Not all subcarriers of an OFDM symbol are used to carry the data bits, some of which are used as pilot carriers for the synchronization and channel estimation purposes and for providing the receiver with specific information such as the order of QAM being used by the transmitter.

The Serial to Parallel (S/P) stage buffers the N vectors from the QAM stage for each OFDM symbol to produce them in parallel way to IFFT stage. The number of IFFT points is always greater than the number of the subcarriers (N), so the (S/P) pads the remaining IFFT points, which have not been assigned QAM vectors, with zeroes.

The IFFT stage is the heart of the OFDM modulator. It gives the QAM vectors the mathematical ability to be considered as the OFDM subcarriers in the frequency domain and converts them to the time domain to form the multi-subcarrier information signal. In other words, as all the (N) QAM vectors of each OFDM symbol are the parallel inputs of the IFFT operation, the IFFT stage considers these QAM vectors as tones or stems in the frequency domain and converts them into correspondent subcarriers in the time domain for the given OFDM symbol duration. Each QAM vector has a specific phase and amplitude which corresponds to the bit combination this vector represents in accordance with the QAM constellation. The IFFT coverts each QAM vector into a correspondent sinusoidal subcarrier in the time domain with amplitude and phase directly related to those of that vector and a frequency that is directly proportional with the sequence of IFFT point, to which the vector has been assigned. That means if a QAM vector with sequence (n) (assigned to an IFFT point with sequence n) generates a subcarrier with frequency equal to (f), the vector with sequence (n-1) generates a subcarrier with a frequency equal to (f - ?f) and the vector with sequence (n+1) generates a subcarrier with a frequency equal to (f + ?f). The IFFT stage can simultaneously produce all the N-subcarriers for each OFDM symbol as it performs the conversion from the frequency domain to the time domain for N (QAM vectors) in one parallel operation for each OFDM symbol. The OFDM symbol signal in the time domain represents the algebraic summation of all subcarriers of that symbol. Now, it is obvious how the OFDM modulator divides the high rate bit stream into (N) lower rate bit streams which are simultaneously transmitted over (N times higher OFDM symbol duration) without reducing the actual bit rate.

The Guard Interval Insertion stage appends a guard period at the beginning of each OFDM. The Guard Interval (GI) (also called the Cyclic Prefix (CP)) makes a separation between the consecutive OFDM symbols to contribute in the ISI reduction and to eliminate the Intercarrier Interference (ICI) between the subcarriers. The guard interval must be greater than the highest path difference duration. As a result, multipath signals with delay smaller than the GI cannot cause ICI [3]. The guard interval is generally equal to or less than the quarter symbol duration [4]. Practically, the guard interval is generated by taking an exact copy of the end part of the OFDM symbol and adding it to the beginning of the symbol. The guard interval (GI) can be used by the receiver to determine the beginning and end of each received OFDM symbol through the cross correlation operation.

Now, the sequence of the OFDM symbol is converted into serial sequence. The Guard Interval Insertion and the Parallel to Serial (P/S) stages are shown as one stage in figure (2-6). The DSP LPF smoothes the information signal.

The Digital to Analogue Convertor (DAC) converts the incoming digital sequence into analogue signal.

Finally, the Up Conversion and Power Amplification stage mixes the information signal with a locally generated carrier and boosts the resulted signal to be transmitted.

The input data bits to the OFDM modulator in figure (2-6) may be first scrambled for the security purposes, encoded for the Forward Error Correction (FEC) purposes and interleaved (to randomize the bursts of error [5]). Therefore, scrambler, encoder and interleaver blocks may precede the other stages to provide the OFDM modulator with scrambled, encoded and interleaved coded bits [6].

It is also possible to up convert the signal whilst it is still in the digital signal processing domain before converting it to the analogue form.

- The Carrier Recovery and the Down Converting stage recovers the information signal from the carrier signal.
- The Sample and Hold circuit and the Analogue to Digital Convertor (ADC) stage converts the information signal from the analogue form to produce the digital sequence for the DSP processing.
- The Guard Interval Removal and the Serial to Parallel (S/P) stage removes the cyclic prefix (CP) and produces all the useful samples of the current OFDM symbol being processed to the FFT stage simultaneously.
- The FFT stage converts the subcarriers of the OFDM symbol from the time domain to the frequency domain and produces them to the QAM De-mapper as vectors through the (P/S) buffer. One tap Equalizer can be used to equalize the vector constellation after the FFT stage.
- The Parallel to Serial (P/S) stage buffers the vectors of each OFDM symbol to produce them serially to the QAM De-mapper.
- The QAM De-mapper assigns each vector to the correspondent bit combination to produce the data bits.

### Figure (2-7) general block diagram of the OFDM demodulator.

### 2.4 The OFDM Demodulator

The OFDM modulation operation is completely reversed in the demodulator. At first, the information signal must be recovered from the carrier. This is done by the carrier recovery and down converting stage. Figure (2-7) shows a general block diagram of the OFDM demodulator.

The analogue to digital convertor (ADC) converts the information signal into a digital sequence.

The guard interval removal stage removes the inserted guard interval or cyclic prefix from the beginning of each OFDM symbol. The OFDM demodulator could use the cyclic prefix at the beginning of each OFDM symbol to pinpoint the beginning and end of each symbol, as the cyclic prefix at the beginning of each OFDM symbol is identical to the end part of that symbol within a duration equal to the cyclic prefix duration.

Now, the digital sequence of each OFDM symbol, which represents the algebraic summation of the subcarriers' signals in the time domain, is simultaneously presented to the FFT stage to convert these subcarriers into their correspondent vectors in the frequency domain. The parallel presentation of the symbol's digital sequence to the FFT stage involves the idea of serial to parallel conversion of this sequence.

The subcarriers may also be equalized before being presented to the QAM de-mapper using a one tap equalizer.

The QAM de-mapper assigns each vector in the frequency domain to the correspondent binary bit combination in accordance with the QAM constellation being used in the transmitter and receiver.

The serial sequence of the received coded bits must be de-interleaved and then decoded and descrambled, if the scrambling, encoding and the interleaving are applied in the transmission side.

The number of data bits per each OFDM symbol can be easily calculated by multiplying the number of subcarriers that are used to carry the data bits (Payload subcarriers) by the number of bits represented by the QAM vector in accordance with the QAM constellation table (2-1). The carrier recovery operation can also be done after the sample and hold stage within the digital signal processing unit.

### 2.5 Digital Video Broadcasting-Terrestrial (DVB-T)

The DVB-T employs the OFDM due to its excellent performance in the multipath environments which are common in the terrestrial broadcasting, as the OFDM distributes a high bit stream over a high number of orthogonal subcarriers, each of which carries a low bit rate stream simultaneously, which makes the symbol duration much higher than the delay of the indirect paths [7].

The DVB-T has two modes 2K and 8K. As 2K and 8K modes have the same data rata, selecting which mode should be used depends on the requirements. The 2K mode has about 250 µ S symbol duration and 4 KHz spacing between its subcarriers, whereas the 8K mode has about 1 m S symbol duration and 1 KHz spacing between its subcarriers. These characteristics make the 8K mode with its higher symbol duration more resilient with multipath situations and channels with a high delay spread but the 2K mode resists better the shift in the frequency caused by Doppler effects due to the relative mobility between the transmitter and receiver, as it has higher frequency spacing between its subcarriers. The DVB-T has (FEC) similar to that of the DVB-S (Satellite) [8]. It has the following code rates (1/2, 2/3, 3/4, 5/6 and 7/8). Not all subcarriers are used as payload carriers to carry the coded bits (data bits + redundant bits); some subcarriers are used for channel estimation and correction. These subcarriers are the pilot carriers which have vectors lying on the I (In-phase) axis of the QAM constellation with angles equal to either 0 degrees or 180 degrees, hence they have only real components unlike the payload vectors which have real and imaginary components in order to recognize between them. The mapping of the pilot carriers to be delivered as vectors to the IFFT stage in the OFDM modulator is achieved through the BPSK modulation which uses the I (in-phase) axis of the constellation. Figure (2-8) shows the locations of DVB-T subcarriers on the 4-QAM constellation.

- The locations of the payload carriers
- The locations of the continual and scatter pilot carriers
- The locations of the TPS pilot carriers

### Figure (2-7) general block diagram of the OFDM demodulator.

The DVB-T uses 4, 16 or 64 QAM to modulate the coded bits to be represented as payload subcarrier vectors, therefore each payload subcarrier can carry 2, 4 or 6 coded bits every OFDM symbol respectively. The DVB-T uses a guard interval length equal to (1/4, 1/8, 1/16 or 1/32) of the OFDM symbol duration [8].

### 2.5.1 The DVB-T OFDM Subcarriers

The DVB-T 2K mode has 2048 subcarriers, but it only uses 1705 subcarriers and sets the rest to zero. The 1705 carriers are numbered from 0 to 1704. It uses 1512 subcarriers as payload carriers and the remaining 193 subcarriers as pilot carriers. There are three types of the pilot carriers the continual pilots, scatter pilots and the (Transmission Parameter Signaling) (TPS) pilots. The continual pilots have fixed positions in the OFDM symbol spectrum. For example the sequences 0, 48, 969, 1683 and 1704 in the range (0 - 1704) are reserved as positions for the continual pilots. The continual pilots are used by the receiver to estimate the amount of phase rotation of the received QAM vectors. Every group of 12 subcarrier vectors has only one scatter pilot. The scatter pilots do not have fixed positions. Among each 12 carriers' positions there is one variable position for one scatter pilot. The position of each scatter pilot regularly varies from symbol to symbol by jumping 3 positions forward with respect to its position in the previous symbol. The scatter pilots are used to estimate the channel too. The TPS pilot carriers have fixed positions and are used by the transmitter to inform the receiver about the transmission parameters such as.

- The DVB-T mode (2K or 8K)
- Modulation type of the payload subcarrier vectors (4, 16, or 64) QAM
- FEC code rate (1/2, 2/3, 3/4, 5/6 or 7/8)
- Length of the guard interval (1/4, 1/8, 1/16 or 1/32)

Like the continual and scatter pilots, the TPS pilot carriers lie on the I (in-phase) axis. Each OFDM symbol in the 2K mode has 17 TPS pilot carriers with fixed positions. Within the same symbol all the 17 TPS pilots are either at 0 degrees or 180 degrees. The receiver determines the state of TPS pilots whether the TPS pilots of the received symbol are at 0 degrees or 180 degree based on the majority voting rule. Through the TPS pilots, the transmitter sends the receiver 67 information bits every OFDM frame. The OFDM frame consists of 68 OFDM symbols. The TPS pilots are Differential Bi-Phase Shift Keying (DBPSK) modulated. That means the receiver considers receiving an information bit = (0), if the state of the TPS pilots change from the previous symbol to the current symbol and considers receiving an information bit = (1), if the phase or state of the TPS pilots does not change from the previous symbol to the current symbol. 68 OFDM symbols are required to transmit the 67 information bits, as the first symbol is used to determine the initializing state of the TPS pilots. The 67 bits inform the receiver about the transmission parameters, for example:

- Bits 26 and 27 represent the QAM order (00=4, 01=16, 10=64)
- Bits 31, 32 and 33 represent the code rate (000=1/2, 001=2/3, 010=3/4, 011=5/6, 100=7/8)

The DVB-T 8K mode has 6817 subcarrier per each OFDM symbol. The subcarriers of the 8K have the same principles and use of those of 2K with difference in their numbers only. Table (2 - 2) shows the different subcarriers of both 2K and 8K modes.

The scatter pilot carriers have two different numbers of the subcarriers, as the scatter pilot carriers coincide with fixed locations of the continual pilot carriers due to their jumping [8].

### 2.6 WLAN 802.11a

Wireless Local Area Networks (WLANs) 802.11a employ OFDM as a digital communication technique for reliable and high data rate transmission. Each OFDM symbol is expressed by 64 subcarriers, but the actual used subcarriers are (52) (64 - 52 =12 subcarriers are set to zero). There are 48 payload carriers to carry the coded bits (data and redundancy bits) and 4 pilot carriers. The frequency spacing between the subcarriers is (?f = 312.5 KHz). The required channel bandwidth can be calculated by multiplying the total number of subcarriers by the frequency spacing = 312.5 K * 64 = 20 MHz. To achieve the orthogonality between the subcarriers the OFDM symbol duration (?t) must be equal to the reciprocal of (?f) (?t = 1/ ?f), hence ?t = 1/312.5 KHz = 3.2 µs. 802.11a appends a guard interval (GI) equal of (1/4) the OFDM symbol duration at the beginning of each OFDM symbol (GI = 0.25 * 3.2 µs = 0.8 µs), therefore each OFDM symbol occupies (3.2 µs + 0.8 µs = 4 µs) time interval. That means a wireless device transmits 250,000 OFDM symbol per second. 802.11a allows wireless devices to have (8) transmission data rates or modes (6, 9, 12, 18, 24, 36, 48 and 54) M bits/sec. 802.11a uses (BPSK, QPSK, 16-QAM or 64-QAM) to modulate the payload carriers and uses (1/2, 2/3 or 3/4) code rate for the FEC in accordance with transmission data rate being used.

The different (8) modes use different modulation types and different code rates as shown in table (2-3) [6]. 802.11a uses BPSK modulation to modulate the payload carries in modes 1 and 2 unlike the DVB-T which only uses QAM modulation to modulate the payload carriers. For each mode, the OFDM symbol has the same total duration (4 µs) (250,000 OFDM symbol/Sec) and the same channel bandwidth (20 MHz), as it has the same number of subcarriers (48 payload carriers and 4 pilot carriers).

Looking back at table (2-3) (Mode (8) 54 Mbps), as the 64-QAM modulation is used to modulate the payload carriers, each payload carrier in the OFDM symbol carries (log2 (64) = 6 coded bits). Each OFDM symbol carries (48 payload carriers/OFDM symbol * 6 coded bits/payload carrier = 288 coded bits / OFDM symbol). The number of data bits per each OFDM symbol = 288 * (code rate = 3/4) = 216 data bits / OFDM symbol. There are 250,000 OFDM symbols / Sec, hence the data bit rate = 216 * 250,000 = 54 Mbps.

### Chapter Three

### The MATLAB Analyses for the Hardware Implementation Approaches

### 3.1 Introduction

Throughout this chapter the ideas and approaches that will be used for the DSP hardware implementation of the OFDM modulator and demodulator on two separate DSP boards will be discussed and simulated by using the MATLAB.

There are mainly three approaches.

- The use of the (Conjugate Symmetric) with the carrier vectors which are the inputs of the IFFT stage in the OFDM modulator to produce an OFDM information signal in the time domain with a real part only for easier modulation and demodulation, which is the proposal that has come out from this project.
- The use of the squared cosine to recover the OFDM information signal from the carrier signal in the receiver (the synchronization of the carrier frequency signal).
- The make use of the guard interval (GI) or the cyclic prefix (CP) for the synchronization of the OFDM symbol (i.e. The Symbol Clock Recovery) to allow the receiver to know the correct boundaries of each received OFDM symbol to set the FFT window at the correct positions of the received OFDM signal.

### 3.2 The Mathematical Analysis of a Multicarrier Signal

To understand the idea of the (Conjugate Symmetric) and the role of the IFFT and FFT in the OFDM system, let's consider y(t) as a continuous multicarrier signal with a real part only in the time domain consisting of the algebraic summation of five sinusoidal waves or subcarriers which have the following frequencies (1, 2, 3, 4 and 5) KHz and phase shifts (p4,,3p4, 5p4, 7p2, 9p4) respectively with equal amplitude = (28) for each. For our y(t), each two adjacent subcarriers (in the frequency domain) have 90 degrees phase shift. y(t) can be expressed in the time domain as in Eq. (3-1)

It is not necessary for the five subcarriers forming y(t) to have the same magnitude. It is just to simplify this discussion.

Now, if y(t) is sampled with sampling frequency (Fs). Fs must be greater than (2 * 5 KHz = 10 KHz), where 5 KHz is the highest frequency of y(t) according to the Nyquist-Shannon theorem. Nyquist-Shannon theorem stipulates that the sampling rate or frequency must be at least two times greater than the highest frequency of the sampled signal to avoid the aliasing which prevents providing the DSP system with a right copy of the sampled signal [9]. When a continuous signal in the time domain is sampled, a sample is taken at every (t = n * Ts). Ts is the sampling interval (Ts = 1 / Fs) and n is zero or positive integer number representing the sequence of the sample. y(t) is no longer continuous. Now, y(t) represents a sequence of discrete values. In Eq. (3-1), y(t) is replaced by y(n) in the left hand side and (t) is replaced by (n * Ts) or (n / Fs) in the right hand side as in Eq. (3-2).

If Fs is set to 16 KHz (16 KHz > 10 KHz) and 16-point FFT operation is performed to y(n) to produce y(n)'s spectrum in the frequency domain in order to study it.

The 16 point FFT operation needs 16 discrete values or samples of y(n) for n = 0, 1, 2,...13, 14, 15. The results of 16 point FFT operation are 16 complex vectors in the frequency domain. The 16 discrete values (samples) of y(n) are the inputs of the FFT in the time domain and the outputs are 16 complex vectors of Y(m) which represents y(n)'s spectrum in the frequency domain. Table (3-1) lists the 16 discrete values of y(n) in the time domain and table (3-2) lists the 16 vectors of Y(m) in the frequency domain.

MATLAB code (3-1) gives the 16 discrete values of y(n) in the time domain and the 16 vectors of Y(m) in the frequency domain.

Note: - The MATLAB does not start the indexing of arrays with zero. It starts with one, hence the first location in array has index=1 instead of 0 and the second location has index=2 instead of 1 and so on.

### * Zero vectors do not have specific phase.

Looking at table (3-2), Y (0) = 0+j0 as y(n) has no DC component in the time domain. The points m = 1 to m = 5, have five vectors with equal magnitudes. Each vector has 90 degrees phase shift with respect to the previous one. These five vectors represent the five sinusoidal waves which form y(n) and have equal magnitude and phase shifts of 90 degrees between each other. The magnitude of each vector is not equal to its correspondent sinusoidal wave's amplitude, but it is proportional to it. The five vectors at points m=15 back to m=11 completely depend on the vectors of points m = 1 to m = 5. The vectors of points m = 15 back to m = 11 are the conjugates of the vectors at points m = 1 to m = 5 respectively, as Y (m).real = Y (16-m).real and Y(m).imag = - Y(16-m).imag in terms of real and imaginary components or R(m) = R(16 - m) and ?(m) = - ?(16 - m) in terms of the magnitude and phase. Y(m).real and R(m) have even symmetry around point m=8 whereas Y(m).imag and ?(m) have odd symmetry around point m = 8. The points of spectrum where m < 8 are called the independent portion of the spectrum while the points of the spectrum where m > 8 are called the dependent portion of the spectrum because all the spectral information can be read from Y(m) for m < 8 while the vectors of Y(m) for m > 8 are just the conjugate vectors of their counterparts at m < 8 portion.

This applies for any number (N) of the FFT points when y(n), as in equation (3-2), has only real part. The spectrum will be symmetric around point m = N/2. That means for m < N/2 every Y(N-m) vector is the conjugate of Y(m) vector and vice versa.

This type of symmetry is called the Conjugate Symmetric in the literature [10].

Now, if we provide the inputs of 16 point IFFT with the 16 values of Y(m) in table (3-2), there is no doubt that the output sequence will be identical to y(n) sequence in table(3-1), which has real part only.

From the above discussion, performing the FFT operation for a signal in the time domain with a real part only produces a spectrum of conjugate symmetric vector set, hence performing the IFFT operation to a symmetric conjugate vector set produces a signal in the time domain with a real part only.

The main conclusion of this section is “providing the IFFT stage with the OFDM symbol carrier vectors having a conjugate symmetric distribution at the IFFT input points, will generate a sequence representing the OFDM symbol multicarrier signal in the time domain with a real part only”.

For the conjugate symmetric, it is not necessary that all the non-zero vectors have the same magnitudes. The conjugate symmetric is achieved as long as each vector (A + jB) at point (m) of the spectrum has its conjugate vector (A - jB) at points (N - m) of the spectrum, where A and B can be any real numbers (negative, zero or positive).

This project proposes and uses the conjugate symmetric distribution of vectors to generate every OFDM symbol as this distribution assures the generation of a multicarrier information signal in the time domain with a real part only. Any other distribution of the subcarrier vectors on the inputs of the IFFT stage of the OFDM modulator generates a multicarrier information signal in the time domain with real and imaginary parts, which requires more complexity to modulate the transmitted signal and to demodulate the received signal.

Although, the conjugate symmetric approach does not require the use of the quadrature modulation to modulate the transmitted signal, it makes use of the spectral efficiency given by the quadrature modulation [11], because it uses the QAM modulator to modulate the payload carriers before the IFFT stage.

The pilot carriers are always represented with vectors lying on the (in-phase) axis, therefore the conjugate of a vector representing a pilot carrier is identical to that vector, as they both have imaginary components equal to zero (the conjugate of A +j 0 = A +j 0).

The above discussion has also shown the role of the IFFT stage in OFDM modulator. For each OFDM symbol being generated, the IFFT stage looks at the carrier vectors of that symbol arranged at its input points as the spectrum of a multicarrier signal in the frequency domain and produces the discrete samples of this multicarrier signal in the time domain. This also implies the serial to parallel conversion as the serially coming data bits are mapped to the set of the payload vectors of each OFDM symbol and the IFFT operation is performed to this set simultaneously.

The FFT stage at the reception side reverses this operation. It takes the samples of each received OFDM symbol in the time domain and produces its carrier vectors in the frequency domain.

### 3.3 The OFDM Information Signal Recovery

The previous section shows that producing of each OFDM symbol's carrier vectors to the IFFT stage with the conjugate symmetric distribution ensures that the output OFDM information signal has only real part I(t), as the imaginary part Q(t) is always set to zero.

As the quadrature modulation is no longer needed to modulate the OFDM information signal I(t). A traditional modulation technique can be used to modulate I(t) such as the AM or FM. This project uses the (DSB-LC) AM to modulate the information signal.

First a DC offset value should be added to I(t) to form the message signal M(t). M(t) is multiplied by the carrier frequency signal cos(wct) to be transmitted, where wc = 2 p fc and fc is the carrier frequency.

M(t) = I(t) + DC

The transmitted signal Tx(t) = Gain * M(t) * cos(wct), where Gain is the transmitter's gain. M(t) can be considered as the envelope of the carrier signal.

The received signal Rx(t) = K * M(t) * cos(wct), where K is a constant proportional to Gain.

Many techniques can be used to recover M(t) from Rx(t) i.e. the Costas loop or the Hilbert based AM receiver [12] and [13].

This project uses the squared cosine technique to recover M(t) signal. The receiver directly squares the received signal Rx(t).

Rx2(t)= K2 * M2(t) * cos2(wct) = K2/2 * M2(t) * (1 + cos(2wct)) (3-3)

The cos(2wct) portion of Eq. (3-3) can be removed by using an optimum LPF. The LPF's output = K1 * M2(t), where K1 = K2/2 * LPF's gain. Taking the square root to the LPF's output yields f(t) = K2 * M(t), where K2 = K1.

Now f(t) = K2 * M(t) = K2 (I(t) + DC) = (K2 I(t) + K2 DC) is the time domain input signal to the FFT stage of the OFDM modulator. The FFT will convert f(t) from the time domain to the frequency domain. The FFT's output of point m=0 will be proportional to the DC portion of f(t) (K2 DC). The multicarrier information portion (K2 I(t)) will be converted into vectors at the FFT's output points identical to those vectors used as the inputs of the IFFT stage in the modulator in terms of number and locations and proportionate to them in terms of the magnitude. For example, if the number of the IFFT and FFT points is 16 and each OFDM symbol has 6 carriers. Hence each 6 carrier vectors will be assigned to points (1 to 6) of the IFFT input points and there conjugates to points (15 back to 10 respectively) to assure the conjugate symmetric at the modulator. At the demodulator after reception, the outputs of the FFT will be a vector at point (0) representing the DC and vectors at points (1 to 6) and (15 back to 10) representing their counterparts at the modulator and proportional to them. Fortunately, unlike the normal AM receiver, there is no need to use any technique to remove the DC from the received M(t) such as the notch filter [12] and [13], since the FFT stage in the OFDM demodulator expresses this DC component as the output at point (m=0).

The benefit of the DC offset is to prevent the negative values of I (t) to become positive after being squared, as the square root operation always gives the positive root. For example at specific time if I(t) = -5, I2(t) = + 25 and +25 = 5 (not - 5) but if a DC offset value = 9 is added to I(t) = -5 then I(t) + DC = -5 + 9 = 4 = M(t), M2(t) = 16 and 16 = 4 and 4 - 9 = (- 5). Therefore, the DC offset value must be greater than the highest absolute value of the negative values of I(t) to protect the negative values of I(t) from the square and square root operations. This project resembles the OFDM modulation used in the DVB-T and Wi-Fi 802.11a with a very simple manner in terms of using the payload and pilot carriers and the CP.

The MATLAB code (3-2) simulates OFDM modulator and demodulator with 16 IFFT and FFT points, with 6 subcarriers. 4 subcarriers are used as payload carriers and 2 as pilot carriers. One of the 2 carriers is a continual pilot carrier and the other is a scatter pilot carrier. Unlike the DVB-T, the scatter pilot does not change its position in the frequency domain; instead it changes its phase between 0 and 180 degrees from symbol to symbol (to be discussed next section). For each OFDM symbol the 4 payload carriers are mapped to points m = 1, 2, 4, and 5 and their conjugates at points m = 15, 14, 12 and 11 respectively. The continual pilot carrier is mapped to point m = 3 and its conjugate is mapped to point m = 13 while the scatter pilot carrier is mapped to m = 6 and its conjugate is mapped to m = 10. Producing this distribution of the OFDM symbol's subcarriers as the input of the 16 point IFFT assures that the 16 output values of IFFT, representing the 16 samples of the OFDM symbol in the time domain having only real parts (Q = 0). As 4-QAM is used to modulate the payload carriers, each payload carrier carries 2 data bits. Each OFDM symbol carries 4 * 2 = 8 data bits. The pilot carriers do not carry any data bits and they are BPSK modulated.

Below is MATLAB code (3-2) with its explanation.

- Lines (5-21) initialize the variables.
- Lines (25-68) represent the OFDM modulator.
- Line (25) indicates the sequence of the OFDM symbol being transmitted and received to simulate the transmission and reception of a number of OFDM symbols equal to (OFDM_Symbols) which is set to 100 in the initialization.
- Lines (26-29) compel the last two OFDM symbols (99 and 100) to carry the same data (to be discussed next section). Line (27) randomly generates 8 data bits for each OFDM symbol.
- Line (30) maps each 2 bits of the 8 bits to the one of the 4 payload carrier vectors in accordance with the 4-QAM constellation.
- Lines (36-51) distribute subcarrier vectors on the IFFT input points with Conjugate Symmetric arrangement to assure that the IFFT output has only real part in the time domain.
- Lines (36-43) distribute the payload carrier vectors and their conjugates on the IFFT inputs points (the arrays in MATLAB do not have index equal to zero, hence the array (IFFT_Inputs), whose length = FFT_Points = 16 from the initialization, has 16 complex variable indexed from 1 to 16).
- Lines (45-46) assign the continual pilot vector and its conjugate to points (3 and 13) respectively (in MATLAB (4, 14)).
- Lines (48-51) assign the scatter pilot vector and its conjugate to points (6 and 10) respectively (in MATLAB (7, 11)). If the OFDM symbol's sequence is odd the scatter pilot vector = 2 + J0 and if it is even the scatter pilot vector = -2 + J0 (to be discussed next section)
- Line (52) performs the IFFT operation to produce the 16 samples of the 6-subcarrier signal or the multicarrier information signal in the time domain.
- Lines (55-57) slice the signal in the time domain by repeating each sample 20 times [14] to overcome the distortion in the signal due to the group delay of the digital filters. The slicing operation can be done by using a unity impulse response FIR filter [14] but this way is more optimized.
- Line (58) adds the DC offset.
- Lines (60-64) insert the guard interval (GI) or the cyclic prefix (CP). In this simulation the duration of the CP is set to 1/4 of the OFDM symbol duration in the initialization. Therefore last quarter of the OFDM symbol is copied and append to the beginning of the symbol. The duration of the OFDM symbol with the CP is equal to 1.25 of the original OFDM symbol duration.
- Lines (66) LPF filters the signal. Butterworth IIR filters are used in OFDM modulator and demodulator. The generation of the coefficient of these filters is done in the initialization. The IIR filters will be discussed next chapter.
- Line (68) boosts and modulates the transmitted signal by multiplying the LPF's output signal by the transmitter's gain and the cosine signal of the carrier frequency.
- Lines (74-94) represent the OFDM demodulator.
- Line (74) receives the transmitted signal after being exposed to the AWGN with SNR = 25. The study of the effects of the channel on the received signal is outside the scope of this project.
- Lines (76-79) recover the information signal and the DC offset from the carrier signal as was illustrated earlier in this chapter. In this simulation the OFDM demodulator resembles the practical separate DSP OFDM demodulator, as it does not has any knowledge about the carrier signal (the Cosine) used by the modulator.
- Line (81) removes the CP from the beginning of the OFDM symbol.
- Lines (83-85) de-slice of the received signal by peaking up one sample from every group of 20 samples. It would better to peak a sample from the last five samples of each group as they are less affected by the group delay of the digital filters.
- Line (87) perform the FFT to the received OFDM symbol which contains a DC offset to produce a set of vectors at the FFT output points similar to that set of vectors used as the input to the IFFT in the modulator with proportional magnitudes and a vector at point (0) (in MATLAB (1)) proportional to the DC offset, hence there is no need to any circuit before the FFT stage to remove this DC offset such as the notch filter.
- Lines (89-92) extract the independent payload carrier vectors. The output of the FFT is a set of 13 non-zero vectors in the frequency domain with the following positions. The DC is at (0) and 4 payload carriers are at (1, 2, 4 and 5) and the conjugates are at (15, 14, 12 and 11) respectively and 2 pilot carriers and their conjugates are at (3, 6, 13, 10) respectively. However, to recover the data bits we only need to the payload carrier vectors in the independent portion of the spectrum (at the positions 1, 2, 4 and 5). For the MATLAB notation, please add one to each frequency position mention above.
- Line (94) de-maps the 4 payload carrier vectors to produce the received data bits. Each vector is de-mapped to 2 data bits in accordance with the 4-QAM constellation. Each 8 bits generated at the modulator carried by an OFDM symbol is received at this point in the demodulator.
- Line (96) compares the transmitted and the received data bits of each OFDM symbol to find the number of bits being in error and the BER of the currently received symbol.
- Lines (98-99) calculate the total number of bits being in error for the entire received OFDM symbol and accumulate the independent payload vectors for all the received OFDM symbols for scatter plotting them.
- Lines (101-104) hold the 2 last OFDM symbols (99 and 100 in this simulation) for the CP Comparison plots (figures (3-3 & 4)) to study the CP Comparison operation (to be discussed next section).
- Lines (106-108) display the total number of received bits being in error and calculate and display the total BER. The total BER is equal to (total number of received bits being in error) divided by (the total number of received bits which is equal to number of the received OFDM symbols multiplied by the number of data bits per OFDM symbol). For this simulation the total number of bits being in error and the BER are zero.
- Lines (109-110) scatter plot the constellation of the payload carrier vectors of all received OFDM symbols in figure (3-1).
- Lines (111-129) plot figures (3-3) and (3-4) to study the CP Comparison operation (to be discussed next section)

### Figure (3-1) the scatter plot of the received payload carriers of 100 OFDM symbols

### 3.4 The Synchronization of the OFDM Symbols

The practical separated OFDM demodulator requires not only to recover the information multicarrier signal from the carrier frequency signal but to also know the beginning and end of each OFDM symbol in the received signal. Without the knowledge of the exact boundaries of the received OFDM symbol, the OFDM demodulator is likely to perform the FFT operation for the received time domain signal in such a way that the adjacent parts of two successive symbols are involved in the FFT operation which yields wrong FFT output carrier vectors and consequently wrongfully received data bits.

This project utilizes the guard interval (GI) or the cyclic prefix (CP) of the received OFDM signal to know the boundary of each received OFDM symbol, as the cyclic prefix at the beginning of each OFDM symbol is an identical copy to the end part of that symbol for the same duration of the cyclic prefix.

When the DSP receiver has received a number of samples equal to those of the entire OFDM symbol and its cyclic prefix, the DSP receiver makes a comparison between the beginning of this symbol and its end part for a number of samples equal to those of the cyclic prefix duration. If the beginning and end parts are identical the receiver removes the cyclic prefix or the guard interval from the beginning of the OFDM symbol to introduce the correct OFDM symbol to the FFT stage to transform it to the frequency domain and produce the correct payload carrier vectors to the QAM de-mapping stage. Let's call this comparison operation the CP Comparison.

If the beginning and end parts of the received OFDM are not identical, the receiver skips one DSP sample and repeats the operation again till it captures the exact boundaries of the OFDM symbol. The DSP receiver does this comparison operation in the time domain.

Figure (3-2) illustrates the CP Comparison operation. A and B are two buffers, each of which has a duration equal to the CP's duration. The distance between A and B is equal to the distance between the CP appended at the beginning of an OFDM symbol and the end part of that symbol which has the same CP's duration. The CP Comparison operation always compares the part of the received signal being held by A with that being held by B. If these two parts are not identical, A and B buffers step forward one DSP sample duration and the comparison is done again. When the CP Comparison operation gives an indication that the two parts being held by A and B are identical, this indication means that A is holding the CP of an OFDM symbol and B is holding the end part and as a result; the receiver is capturing the correct OFDM symbol and the FFT window is in the right position to perform the FFT operation on the information signal to produce the subcarrier vectors in the frequency domain. In figure (3-2), the current positions of A and B make A and B hold two correspondent parts of two consecutive OFDM symbols ((n-1) and (n)). As these two parts have different shapes in the time domain, the CP Comparison operation will show that the two parts are not identical. A and B will step one DSP sample duration forward and the comparison is repeated. This stepping forward will continue till A holds the entire CP of symbol (n) and B holds the entire end part of symbol (n). At this moment, the receiver is locking on the right boundaries of the OFDM symbol. The CP is removed and the original OFDM portion (the multicarrier information signal) is handed to the FFT stage to produce all the subcarriers vectors simultaneously.

### Figure (3-2) the CP Comparison operation to lock on the right boundaries of the received symbol

If two consecutive OFDM symbols carry the same the data bits, they will be identical in the time domain and the frequency domain, because they have the same payload carriers. In other words, any part in the middle of one of the OFDM symbols is identical to its counterpart in the other symbol, so the receiver is not able to recognize the right boundaries of each of these two consecutive and identical OFDM symbols by using the CP Comparison. A and B are always holding two identical parts. However, they are not always the CP and the end part of one of these two identical OFDM symbols.

To overcome this problem, the shape of each two consecutive OFDM symbols must not be identical, even when they carry the same payload data. The way to do so is to use some pilot carriers that change their positions in the frequency domain or their phases from symbol to symbol to assure that there are no two consecutive symbols identical, even when they carry the same data bits.

At this point we understand why the scatter pilot carrier in the lines (49-51) of MATLAB code (3-2) changes its phase from symbol to symbol to be 0 or 180 degrees consecutively. This assures that even when two consecutive OFDM symbols carry the same data bits, their shapes in the time domain are different from each other because their spectrums are not identical in the frequency domain. The practical OFDM demodulator will never wrongfully consider the two parts of consecutive OFDM symbols under the CP Comparison the beginning and end of an OFDM symbol, as they are different, even when their OFDM symbols carry the same payload.

Lines (26-29) of MATLAB code (3-2) are to compel the last two OFDM symbols in the simulation to carry the same payload data bits. MATLAB code (3-2) simulates the transmission and reception of 100 OFDM symbols (numbered from 1 to 100). Therefore symbols numbered 99 and 100 carry the same data bits. However, they have different shapes, because their scatter pilots have different phases in the frequency domain.

In lines (101-104) of MATLAB code (3-2) the Symbol_Holder array with two rows holds the samples of the last two received OFDM symbols (99 and 100), each of which in the columns of one row. We will make use of these two symbols to compare the CP of each symbol with its end part and to compare the two symbols.

Figure (3-3) shows the absolute difference between the CP of symbol 99 and its end part and the CP of symbol 100 and its end part. The transmitter generates the CP of each OFDM symbol as an identical copy to the end part of that symbol for the CP duration. However, figure (3-3) does not show zero differences over the whole CP duration, as it is theoretically expected. The reasons behind that are the group delay of the digital filters and the effects of the noise. The first (5 to 10) samples show very great differences; therefore the receiver should practically skip the first samples of the CP duration of the two parts under the CP Comparison and accept an absolute difference within a narrow limit as an indication of the similarity in the CP Comparison process.

### Figure (3-3) the absolute difference between the CP of symbol 99 and its end part and the CP of symbol 100 and its end part in the time domain

Figure (3-4) shows the absolute difference between the shapes of the last two received OFDM symbols in the time domain. Even though they carry the same data bits (the same payload carriers), the phase change of the scatter pilot from symbol to symbol makes their shapes different in the time domain. Therefore the CP Comparison operation will not make a mistake while it is comparing two parts of such consecutive symbols, thanks to scatter pilot carrier which change from symbol to symbol to assure such a difference. MATLAB code (3-2) does not use the CP Comparison, as the transmitted OFDM symbol is directly handed to the receiver in the same code. However, the hardware implementation uses it, because the transmitter and receiver are on separate DSP boards.

### Figure (3-4) the absolute difference between consecutive symbols 99 and 100 in the time domain

### Chapter Four

### The Real Time DSP Hardware Implementation

### 4.1 Introduction

This chapter shows the hardware implementation of the OFDM modulator and demodulator on two separate laboratorial DSP boards figure (4-1). Each board is programmed by using the C programming language and the Code Composer Studio (CCS) software. The CCS provides an Integrated Development Environment (IDE) for real time digital signal processing applications based on C programming language. It incorporates a C compiler, an assembler, and a linker. It has graphical capabilities and supports real time debugging [15].

### Figure (4-1) the OFDM modulator & demodulator DSP boards

Each laboratorial DSP board is a Texas Instruments DSP starter kit (DSK) board. The DSK board is a circuit board mainly containing a digital signal processor (either a 255-MHz C6713 floating point digital signal processor or 1-GHz C6416 fixed point digital signal processor), a 16-bit stereo Codec (Coder-Decoder) TLV320AIC23 (AIC23) and other peripherals. The AIC23 codec uses (sigma-delta technology [16]) which provides signed 16-bit analogue to digital conversion (ADC) to the input analogue signal to be processed by the DSP system and provides signed 16-bit digital to analogue conversion (DAC) to the output digital signal after being processed by the DSP system [15].

The ideas and approaches which have been discussed and simulated by MATLAB in the last chapter will be implemented. Real time DSP implementation is more complex than MATLAB simulation. However, it is more interesting, as it allows you to realize how DSP theories are practically implemented.

Most communication and digital signal processing operations such as QAM, FIR, IIR, FFT and IFFT are executed in MATLAB with one line commands, whereas our real time DSP implementation requires writing a specific C code for each of these operations and maintaining a special kind of harmony and synchronization among the whole parts, operations and mathematical expression of the C program written for real time DSP implementation.

### 4.2 The FFT and IFFT Hardware Implementation

The N-point FFT is a faster way to implement N-point (Discrete Fourier Transform (DFT), (when N = 2k where k is a positive integer) to convert the discrete signal from the time domain to the frequency domain [17]. The general expression for the N-point DFT for m= 0, 1... N-1 is given in Eq. (4-1)

X[m] = n=0N-1 xne-j2pmn/N = n=0N-1 xn WNmn (4-1)

The (Twiddle Factor) notation WN = e-j2p/N is used for more compact notation. The general expression for the N-point Inverse DFT can be expressed as in Eq. (4-2) [18].

x[n] = 1N m=0N-1 Xmej2pmn/N = 1N m=0N-1 Xm WN-mn (4-2)

In our implementation the constant factor 1/N has no effect, as the signal is multiplied by other constants i.e. the gain. Therefore the same C code used for calculating the N-point FFT outputs can be used for calculating the N-point IFFT outputs with just changing the twiddle factor's sign. [18] provides a C code for non-real time calculating of N-point FFT. This code has been modified for real time N-point FFT and IFFT calculations for this implementation. In this implementation, the C code of the modulator calls the IFFT function to convert the subcarrier vectors in the frequency domain into a multicarrier signal's samples in the time domain. The C code of the demodulator reverses the operation by calling the FFT function.

### 4.3 The IIR LPFs Hardware Implementation

This project uses Butterworth IIR filters as LPFs in both the modulator and demodulator. The main advantage of the IIR filters over the FIR filters is that IIR filters require far fewer multiplications (have much lower number of coefficients) to achieve the same output's characteristics [19].

If x[n] holds the current input sample and y[n] holds the current output sample of a Butterworth IIR filter with order M. y[n] and x[n] have the following relation

y[n]x[n] = k=0k=Mbk*z-kk=0k=Mak*z-k (4-3)

The M-order Butterworth filter has two sets of coefficients b[k]s and a[k]s. each set has (M+1) coefficients. Let's denote the b[k]s as the numerator coefficients and a[k]s as the denominator coefficients. a[0] is always = 1, hence the current output sample y[n] can be expressed as in Eq. (4-4)

y[n] * a[0] = (k=0M xn-k*b[k]) - (k=1M yn-k*a[k]) (4-4)

y[n] = (num) - (den) (4-5)

num represents the sum of products (SOP) of the buffered inputs (x[n-k]s) and the numerator coefficients (b[k]s). den represents the sum of products (SOP) of the buffered outputs (y[n-k]s) and the denominator coefficients (a[k]s) except y[0]*a[0] which is on the left hand side of Equations (4-4) and (4-5). Equations (4-4 and 5) can be depicted in figure (4-2) for IIR filter with M = 3. Figure (4-2) and equations (4-4 and 5) facilitate writing the C code for a third order (M=3) IIR filter or any order. In figure (4-2) b[k]s and a[k]s hold the numerator and denominator coefficients respectively. x[0] holds the current input sample (x[n]) and x[1] hold the previous sample (x[n-1]) and x[2] and x[3] hold the previous samples x[n-2] and x[n-3] respectively. y[0] holds the current output y[n] and y[1, 2 or3] hold the previous output samples y[n-k] for k=1, 2 or 3 respectively.

### Figure (4-2) the third order Butterworth IIR digital filter block diagram

x[k]s and y[k]s are called the delays or the buffers of the IIR filter. x[k]s and y[k]s must be shifted after producing each output to be prepared for the next input. The shift is done in a consecutive way, so x[3]=x[2], x[2]=x[1] and x[1]=x[0] and the same way for y[k]s, hence all the previous value are shifted and now x[0] and y[0] are ready to receive or hold the next input and output respectively. This method is called the circular buffer and also can be done with the FIR filters [20].

For each new input sample, x[0] buffer receives or holds this input and the products between x[k]s and their correspondent b[k]s for k=0, 1, 2 and 3 are performed. The sum of these products is stored in the variable (num); this operation is called the feed-forward calculations [19]. Variable (den) stores the sum of products between y[k]s and a[k]s for k=1, 2 and 3; this operation is also called the feed-back calculations [19]. The product of y[0]*a[0] is not involved in the feed-back calculations, as it is on the left hand side of equations (4-4 and 5). a[0] is always equal to one, hence y[0] is equal to (num - den) which is given to the output and the circular buffer operation is done to update the delays and to prepare them to next sample to be filtered. C code (4-1) execute the third order Butterworth IIR filter routine

#include<math.h>

#include “coef.h” /* Call the file (coef.h) which stores the IIR filter's coefficients */

//Variable Declaration

short x[4], y[4]; //The delays or buffers of the IIR filter

float Input, Output; // The input & output samples

float num, den; // Store the feed-forward & feed-back calculations

short j, k; // Index the loops

/*Both b[4] and a[4] are declared as float type variables and store the IIR filter's coefficient in the separate file (coef.h) which is called in the execution*/

//The C routine to implement the DSP IIR filter

Input = input_sample ( ); //read a new sample from the ADC

x[0] = Input; //The current input sample

y[0] = 0; num = 0; den = 0; /*Initialize the variables [(y[0]*a[0]) will not be involved in the feed-back calculations]*/

for (k=0;k < 4;j++)

{num+ = x[k] * b[k]; //(SOP) Feed-forward calculations

den+ = y[k] * a[k] ;}//(SOP) Feed-back calculations

y[0] = num - den; // Store the filtered sample in y[0]

for (j=3; j > 0; j++)

{x[j] = x[j-1] ; y[j] = y[j-1] ;} // Update the delays of the IIR filter

Output = y[0]; //The current output filtered sample

output_sample ((short) Outpu

### Cite This Dissertation

To export a reference to this article please select a referencing stye below: