Professional Documents
Culture Documents
INDEX
1. OBJECTIVES...............................................................................................2
1.1 GENERAL OBJECTIVE...................................................................................................2
1.2 SPECIFIC OBJECTIVES..................................................................................................2
2. DEVELOPING THE SYSTEM.........................................................................2
2.1 Choosing the FPGA and the Architecture...................................................................2
2.2 Architecture of the system.........................................................................................3
2.2.1. Components of the system...................................................................................5
2.2.1.1. Clock Wizard..................................................................................................5
2.2.1.2. Processor System Reset.................................................................................5
2.2.1.3. Micro-Blaze controller...................................................................................7
2.2.1.4. Pheripherical Bus Controller – AXI Interconnect...........................................8
2.2.1.5. RAM memory.................................................................................................8
2.2.1.6. General Purpose Input – Output.................................................................10
2.2.1.7. Analog to Digital Converter Driver / XADC Wizard......................................11
2.2.1.7.1. Configuration of the ADC Driver............................................................13
2.2.1.7.2. Resolution of the analog to digital conversion......................................14
2.2.1.7.3. Analog to Digital conversion..................................................................14
2.2.1.8. AXI Timer.....................................................................................................16
2.2.1.8.1. Configuration of the AXI Timer as PWM...............................................16
2.2.1.8.2. Configuring registers TLR 0∧TLR 1 for period and duty cycle of PWM.. .
19
2.2.2. Results.................................................................................................................23
2.2.2.1. Flow Diagram...............................................................................................23
2.2.2.2. C Code..........................................................................................................24
2.2.2.3. Laboratory measurements..........................................................................26
3. BIBLIOGRAPHY........................................................................................27
4. ANNEXES.................................................................................................28
4.1 Constraints file..........................................................................................................28
1. OBJECTIVES
1.1 GENERAL OBJECTIVE
2.2.1. Modulator
2.2.1.1. Description
Inside the modulator we have the sequential modulator and a ROM memory containing the
data of a cosine function, this entity simulates the Analog to Digital Converter in order to
test the interface and all the circuits inside the complete design.
The sequential modulator produces all the addresses to access the data which is steed in
the ROM memory, this block has a synchronization input in order to send address 768d with
a value of 0d when this input “sync_in” is enabled.
The ROM is a memory with 10-bit (1024) addresses and a word of 10-bit (1024 with sign
-512 TO 511).
MASTER 2 - ESECA
ASIC
PROJECT REPORT
400
200
Data
0
3 5 7 1 111 6 52 192 7 33 273 8 14 354 8 95 435 9 76 517 0 57 598 1 38 679 2 19 75
-200
-400
-600
Address
2.2.1.3. Simulation
On the next graphic, we can see how the modulator sends the data data[9:0] which is
stored inside the memory ROM to de data output, the address addr[9:0] is an inside signal
which allows us to access to the memory ROM in order to take the stored data out from the
modulator.
MASTER 2 - ESECA
ASIC
PROJECT REPORT
2.2.2. Mixer
2.2.2.1. Description
The mixer block has two inputs, the first one comes from the modulator, the other
one is an input with some complex numbers [1, -i, -1, i] in order to obtain the two data
outputs that go directly to the FFT, one output is for real numbers and the other for
imaginary, since the task of the mixer is to combine both real and imaginary frequency
generators. We did this arrangement in order to couple the modulator output to the FFT. In
fact the second input of the mixer is the complex frequency generator.
First, the mixer takes the first data x0 which is purely real, mixes this with the first
element of the constant array [1, -i, -1, i] and send it for the real output because the
multiplication is between 2 real numbers. As a second step, the mixer takes the first data x1,
mixes this with the second element of the constant [1, -i, -1, i] and send it for the imaginary
output because the result of the multiplication is imaginary. This process continues as many
times as there are samples in the input.
MASTER 2 - ESECA
ASIC
PROJECT REPORT
2.2.2.3. Simulation
In the next figure we can observe how the mixer works, it takes the data[9:0] from the input
which is purely real combines it with the imaginary generator and sends this complex
number to the 20 bit output in a fixed arrangement, the first 10 LSB are the real ones,
phase_ri RE on the plot and the second 10-bits MSB are the imaginary ones, phase_ri IM on
the plot.
After the mixer, for the signal processing unit, we need to develop a system with three
stages: fist, we have a filter, second, is the decimation and, in the third stage, we have the
FFT.
MASTER 2 - ESECA
ASIC
PROJECT REPORT
For filtering we will use standard FIR and symmetric filters with decimation, and for the FFT a
radix 2 FFT of 64 points algorithm will be used.
2.2.3.1. FIR
The finite impulse response (FIR) filter is used in many digital signal processing (DSP) systems
to perform signal preconditioning, antialiasing, band selection, decimation/interpolation,
low-pass filtering, and video convolution functions.
Conventional FIR
The next figure shows a conventional 8-tap FIR filter architecture. This filter has eight 8-bit
registers arranged in a shift register configuration.
Symmetric FIR
For a linear phase response FIR filter, the coefficients are symmetric around the center
values. This symmetry allows the symmetric taps to be added together before they are
multiplied by the coefficients. Taking advantage of the symmetry lowers the number of
multiplies from eight to four, which reduces the circuitry required to implement this filter.
MASTER 2 - ESECA
ASIC
PROJECT REPORT
===================================================================================
// Filename: c_filter.hpp
// Description:
// Version: 1.0
// Revision: none
// Compiler: g++
// Author: Mathieu Lebon (ML),
// Company: Thales Alenia Space
===================================================================================
#ifndef __C_FILTER__
#define __C_FILTER__
#ifndef __SYNTHESIS__
#include <cstdlib>
#include <fstream>
#include <iomanip>
#include <sstream>
using namespace std;
#endif
#include <ac_int.h>
#ifdef __SYNTHESIS__
#undef assert
#define assert(x)
#endif
enum filter_mode {
standard,
symmetric
};
//=================================================================================
// Class: c_filter
// Description:
// mode = standard or symmetric
// t_data = type of filter input data
// t_acc = type of filter accumulator
// size = Number of taps
//=================================================================================
template<filter_mode mode, typename t_data, typename t_acc, int size>
class c_filter {
public:
// ------------------------------------------------
// TAPS registers initialization
// Reset TAPS to 0
// ------------------------------------------------
c_filter() {
// ...
for(int i = 0; i < size ; i++)
reg[i] = 0; //initialization to zero for taps
}
// ------------------------------------------------
// Filter main process
// ------------------------------------------------
template<typename t_coef>
void process(t_data in, const t_coef * coef, t_acc & out) {
shift(in);
if(mode == symmetric) {
mac_sym(coef);
} else {
mac(coef);
}
out=acc;
}
private :
// ------------------------------------------------
// Shift TAPS registers
// ------------------------------------------------
void shift(t_data in) {
// ...
for(int i = size - 1; i > 0; i--)
{
reg[i] = reg[i - 1];
}
reg[0] = in;
}
// ------------------------------------------------
// Multiply Accumulate for symmetric filter
// ------------------------------------------------
template<typename t_coef>
void mac_sym(const t_coef * coef) {
// ...
t_data out; // la sortie
acc= 0;
for (int i = 0; i < size-1; i++) {
acc+= coef[i] * (reg[size-1-i] + reg[i]);
}
out = acc;
}
// ------------------------------------------------
// Multiply Accumulate for standard filter
// ------------------------------------------------
template<typename t_coef>
void mac(const t_coef * coef) {
// ...
acc= 0;
for (int i = 0; i < size; i++) {
acc += coef[i] * reg[i];
}
}
}; // ----- end of class c_filter -----
#endif
MASTER 2 - ESECA
ASIC
PROJECT REPORT
2.2.3.2. FFT
DFT is most widely used technique for converting the samples from time domain to
frequency domain. Fast Fourier Transform performs this operation at a very fast rate and
hence it is known as a n efficient technique for calculating the DFT of signals. It does these
tasks with less overhead in the calculation of complex terms.
Figure 9. Butterfly diagram for FFT designed with a radix 2 FFT of 64 points
//========================================================================
// Filename: c_fft.hpp
// Description:
// Version: 1.0
// Revision: none
// Compiler: g++
// Author: Mathieu Lebon (ML),
// Company: Thales Alenia Space
// =======================================================================
#ifndef __C_FFT__
#define __C_FFT__
#ifndef __SYNTHESIS__
#include <cstdlib>
#include <fstream>
#include <iomanip>
#include <sstream>
using namespace std;
#endif
#include <ac_int.h>
#include "rnd.h"
MASTER 2 - ESECA
ASIC
PROJECT REPORT
#ifdef __SYNTHESIS__
#undef assert
#define assert(x)
#endif
// =======================================================================
// Class: c_fft
// Description:
// =======================================================================
template<int size, typename t_data_mem, typename t_coef, int
butterfly_lsb_delete>
class c_fft {
t_data_mem mem[size];
static const int size_log2 = ac::log2_ceil<size>::val;
static const int size_div2 = size/2;
typedef ac_complex<int32> t_data_mult;
public:
// ------------------------------------------------
// No internal memory initialization
// ------------------------------------------------
c_fft() {
FFT_Init_Loop:
for ( int i = 0; i < size; i += 1 ) {
t_data_mem dc;
mem[i] = dc;
}
}
// -----------------------------------------------------
// Bit reverse
// -----------------------------------------------------
template<int qt, bool s>
ac_int<qt,s> bit_reverse(ac_int<qt,s> x) {
// ...
x = (((x & 0xaaaaaaaa) >> 1) | ((x & 0x55555555) << 1));
x = (((x & 0xcccccccc) >> 2) | ((x & 0x33333333) << 2));
x = (((x & 0xf0f0f0f0) >> 4) | ((x & 0x0f0f0f0f) << 4));
x = (((x & 0xff00ff00) >> 8) | ((x & 0x00ff00ff) << 8));
return((x >> 16) | (x << 16));
unsigned int v = x;
unsigned int r = v & 1;
const int CHAR_BIT = 8;
int s = sizeof(x) * CHAR_BIT - 1;
for (x >>= 1; x; x >>= 1)
{
r <<= 1;
r |= x & 1;
s--;
}
r <<= s; // shift when v's highest bits are zero
return x;
}
// -----------------------------------------------------
MASTER 2 - ESECA
ASIC
PROJECT REPORT
// -----------------------------------------------------
// Copy result memory to output memory
// -----------------------------------------------------
void write(t_data_mem * mem_out) {
// ...
FFT_Write_Loop:
for ( int i = 0; i < size; i += 1 )
mem_out[i] = mem[i];
//*(mem_out + i) = mem[i];
printf("Writing finished");
}
BUTTERFLY_LOOP:
for (int j=0; j<size_div2; j++) {
// Update data address
// Memory Read
MASTER 2 - ESECA
ASIC
PROJECT REPORT
// Memory write
mem[index_high] = x;
mem[index_low] = y;
// Sum
res_high.r() = data_low.r() - data_mult.r();
res_high.i() = data_low.i() - data_mult.i();
res_low.r() = data_low.r() + data_mult.r();
res_low.i() = data_low.i() + data_mult.i();
}
// Multiplication
a_mult = data.r() * coef.r();
b_mult = data.i() * coef.i();
c_mult = data.r() * coef.i();
d_mult = data.i() * coef.r();
// Round
rnd<butterfly_lsb_delete>(a_mult, a_mult_rc);
rnd<butterfly_lsb_delete>(b_mult, b_mult_rc);
rnd<butterfly_lsb_delete>(c_mult, c_mult_rc);
rnd<butterfly_lsb_delete>(d_mult, d_mult_rc);
// Partial sum
t_data_mult res;
res.r() = (a_mult_rc - b_mult_rc);
res.i() = (c_mult_rc + d_mult_rc);
return res;
}
}; // ----- end of class c_fft -----
MASTER 2 - ESECA
ASIC
PROJECT REPORT
#endif
2.2.3.3. Block
clk in_rsc_lz
19 mem_out_r_rsc_data_in
rst_n
in_rsc_z 10 5 mem_out_r_rsc_addr
in_rsc_vz mem_out_r_rsc_we
DIGITAL mem_out_r_rsc_triosy_lz
SIGNAL mem_out_i_rsc_data_in
19
PROCESSING mem_out_i_rsc_addr
5
mem_out_i_rsc_we
mem_out_i_rsc_triosy_lz
diagram
Figure 10. DSP block diagram
2.2.3.4. Simulation
Catapult software give us a VHDL file with an implemented code for the FFT, in order to test
the correct work of this block, we introduce the code to Vivado environment and we make a
simulation, we can observe the behavior around this complex entity:
Figure 12. Waveform when the DSP finish saving the data in memory
We need to take care about the next signals and the process will be secure in order to
maintain the stability of the system. First, we need to activate the in_rsc_vz bit after we are
going to send the real and imaginary data to the in_rsc_z. Second, when the mem_out_r_rsc
and mem_out_i_rsc_we give us a zero, the data is available to store inside an external
memory. Finally, When the DSP analysis finish and all the data was stored inside a memory,
the DSP sends a rising pulse for the mem_out_r_rsc_triosy_lz and mem_out_i_rsc_triosy_lz.
2.2.4. FIFO
2.2.5. UART
configurable. The electric signaling levels and methods are handled by a driver circuit
external to the UART.
2.2.5.1. Block
clk rxd diagram
rst_n txd
Figure 13.
tx_data(7:0) 8
UART block diagram
tx_we 8 rx_data(7:0)
cfg_baud_rate(1:0) 2 rx_ready
UART
cfg_par_en par_error
Table cfg_par_pol tx_busy IV. UART
cfg_data_7_8
cfg_stop_1_2
Inputs/Outputs description
2.2.5.2. Simulation
In order to simulate the complete system, we created a testbench to control this block.
We can see how this block is working, for 9600 bauds one byte takes a little more than 1
millisecond to be send on the txd signal. When we have an 8-bit data to send through the
UART, we need to give a rising edge to the tx_we in order to activate the device, after that,
tx_busy changes the state to one . When the UART finish to send the 8-bit data, the signal
tx_busy changes the state to zero.
3. SIMULATION
4. SYNTHESIS PLACEMENT AND ROUTING
5. CARD TEST