m FPGA implementation of QPSK baseband signal frequency offset estimation and compensation algorithm based on FFT Fourier transform, including testbench and matlab constellation diagram display

Table of contents

1. Algorithm simulation effect

2. Algorithms involve an overview of theoretical knowledge

3. Verilog core program

4. Complete algorithm code file


1. Algorithm simulation effect

This system has developed the Vivado2019.2 platform, and uses matlab2022a to display the constellation diagram of the results:

Use matlab to display the constellation diagram of the frequency offset baseband QPSK signal of the FPGA and the QPSK baseband signal after frequency offset compensation, and the results are as follows:

2. Algorithms involve an overview of theoretical knowledge

       QPSK (Quadrature Phase Shift Keying) is a commonly used modulation method, which can carry two bits of information in phase and amplitude respectively. In wireless communication, due to the influence of frequency offset (Frequency Offset) during signal transmission, the frequency of the signal at the receiving end is not completely consistent with the frequency of the signal at the sending end. Frequency offset will cause the phase shift of the received signal, resulting in demodulation errors and increased bit error rate. In order to reduce the impact of frequency offset on communication system performance, frequency offset estimation and compensation are required. This article will introduce the QPSK baseband signal frequency offset estimation and compensation algorithm based on FFT Fourier transform in detail, including mathematical principles, implementation process and application fields.

       QPSK modulation is a baseband modulation method, which divides the input bit stream into two groups, each group has two bits, representing the real part and the imaginary part respectively. The mathematical principle of QPSK modulation is as follows:

      FFT Fourier transform is an efficient spectrum analysis method, which can convert time-domain signals into frequency-domain signals for frequency offset estimation. The mathematical principle of FFT Fourier transform is as follows: 

       Assuming that the input time domain signal is x(n), it is converted into a frequency domain signal X(k) by FFT Fourier transform:

       The goal of frequency offset estimation and compensation is to estimate the frequency offset through the received signal, and perform frequency offset compensation on the received signal at the receiving end to make it completely consistent with the frequency of the transmitted signal. The mathematical principle of frequency offset estimation and compensation algorithm based on FFT Fourier transform is as follows:

    To sum up, the implementation process of QPSK baseband signal frequency offset estimation and compensation algorithm based on FFT Fourier transform mainly includes steps such as QPSK modulation, signal transmission, reception, FFT Fourier transform, frequency offset estimation and frequency offset compensation. 

3. Verilog core program

`timescale 1ns / 1ps
//
// Company: 
// Engineer: 
// 
// Create Date: 2023/05/03 06:21:37
// Design Name: 
// Module Name: TEST
// Project Name: 
// Target Devices: 
// Tool Versions: 
// Description: 
// 
// Dependencies: 
// 
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
// 
//
 

module TEST();

reg i_clk;
reg i_rst;
reg i_clkSYM;
reg i_dat;
 
wire o_Idiff;
wire o_Qdiff;
wire signed[15:0]o_Ifir_T;
wire signed[15:0]o_Qfir_T;
wire signed[9:0]mcos0;
wire signed[9:0]msin0;



//QPSK调制
TQPSK TQPSKU(
.i_clk  (i_clk),
.i_rst  (i_rst),
.i_clkSYM(i_clkSYM),
.i_dat  (i_dat),
.o_Idiff(o_Idiff),
.o_Qdiff(o_Qdiff),

.o_Ifir (o_Ifir_T),
.o_Qfir (o_Qfir_T),
.mcos0  (mcos0),
.msin0  (msin0)
);

 

wire [31:0]o_freq;
wire signed[15:0]o_cos;
wire signed[15:0]o_sin;
wire signed[15:0]o_Ifir;
wire signed[15:0]o_Qfir;
wire o_ends;
wire o_start;
wire o_enable;
wire signed[31:0]absy;
//QPSK相位估计和补偿
RQPSK_phase_est RQPSKU(
.i_clk  (i_clk),
.i_rst  (i_rst),
.i_clkSYM(i_clkSYM),
.i_I(o_Ifir_T),
.i_Q(o_Qfir_T), 
.o_ends(o_ends),
.o_start(o_start),
.o_enable(o_enable),
.absy  (absy),
.o_freq(o_freq),
.o_cos  (o_cos),
.o_sin (o_sin),
.o_Ifir (o_Ifir),
.o_Qfir (o_Qfir)
);




 




reg writeen;
initial
begin
    writeen = 1'b0;
    i_clk = 1'b1;
    i_clkSYM=1'b1;
    i_rst = 1'b1;
    #1600
    i_rst = 1'b0;
    
    #100
    writeen = 1'b1;
end

always #5 i_clk=~i_clk;
always #80 i_clkSYM=~i_clkSYM;


initial
begin
    i_dat = 1'b0;
    #1440
    repeat(250)
    begin
    #160 i_dat = 1'b1;
    #160 i_dat = 1'b1;
    #160 i_dat = 1'b0;
    #160 i_dat = 1'b0;
    #160 i_dat = 1'b0;
    #160 i_dat = 1'b1;
    #160 i_dat = 1'b0;
    #160 i_dat = 1'b1;
    #160 i_dat = 1'b1;
    #160 i_dat = 1'b0;
    #160 i_dat = 1'b0;
    #160 i_dat = 1'b0;
    #160 i_dat = 1'b0;
    #160 i_dat = 1'b0;
    #160 i_dat = 1'b0;
    #160 i_dat = 1'b0;
    #160 i_dat = 1'b0;
    #160 i_dat = 1'b0;
    #160 i_dat = 1'b1;
    #160 i_dat = 1'b1;
    #160 i_dat = 1'b1;
    #160 i_dat = 1'b0;
    #160 i_dat = 1'b0;
    #160 i_dat = 1'b1;
    #160 i_dat = 1'b0;
    #160 i_dat = 1'b0;
    #160 i_dat = 1'b1;
    #160 i_dat = 1'b1;
    #160 i_dat = 1'b0;
    
    
    end
    $stop();
end


//显示发射端带相位旋转的星座图
integer fout1;
integer fout2;
initial begin
 fout1 = $fopen("It.txt","w");
 fout2 = $fopen("Qt.txt","w"); 
end

always @ (posedge i_clk)
 begin
     if(writeen==1)
     begin
   	 $fwrite(fout1,"%d\n",o_Ifir_T);
	 $fwrite(fout2,"%d\n",o_Qfir_T);
	 end
end

//显示接收端相位估计和补偿之后的星座图

integer fout3;
integer fout4;
initial begin
 fout3 = $fopen("Ir.txt","w");
 fout4 = $fopen("Qr.txt","w"); 
end

always @ (posedge i_clk)
 begin
     if(writeen==1)
     begin
   	 $fwrite(fout3,"%d\n",o_Ifir);
	 $fwrite(fout4,"%d\n",o_Qfir);
	 end
end
 
 
 
 



endmodule
00_033m

4. Complete algorithm code file

V

Guess you like

Origin blog.csdn.net/hlayumi1234567/article/details/132095264