m FPGA-based implementation of costas ring carrier synchronization verilog, including testbench, which can modify the frequency offset

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

The Vivado2019.2 simulation results are as follows:

Without the costas ring, the influence of frequency offset on baseband data

Add baseband data to the costas ring

2. Algorithms involve an overview of theoretical knowledge

        The Costas loop is a common method for carrier synchronization, especially in modulation and demodulation, where it is widely used to demodulate phase modulated signals such as binary phase modulated (BPSK) or quaternary phase modulated (QPSK) signals. Its purpose is to estimate and track the phase offset of the received signal in order to correctly demodulate the data.

Its basic structure is shown in the figure below:

Costas ring structure:

       As shown in the figure above, the Costas ring consists of two main parts: a local oscillator (Local Oscillator, LO) offset by 90 degrees and a phase-shift demodulator. These two parts work together to estimate the phase shift of the signal.

The Costas Ring consists of the following main components:

  1. Local Oscillator (Local Oscillator, LO): LO generates a local reference signal whose frequency is the same as the carrier frequency of the received signal. This local reference signal usually consists of two signals, sine and cosine, which are 90 degrees out of phase. These two signals will be compared with the received signal phase.

  2. Phase Detector: The phase detector is used to measure the phase difference between the received signal and the local oscillator. Its output is a signal with phase information.

  3. Loop Filter: The loop filter filters and processes the phase difference information to generate a control voltage. This voltage will be used to adjust the frequency and phase of the local oscillator to minimize the phase difference.

  4. Local Oscillator Control Unit: This unit receives the control voltage from the loop filter and adjusts the frequency and phase of the local oscillator accordingly.

  5. Output: The output of the Costas loop is the phase information of the local oscillator, which has been adjusted to be in sync with the phase of the received signal. This output can be used to demodulate the received signal.

Costas ring principle:

       The principle of the Costas loop is to use the phase difference between the received signal and the LO to estimate the phase offset of the signal. The magnitude of the product signal is greatest when the phase shift of the signal is close to 0 or 180 degrees, and the magnitude of the product signal is smallest when the phase shift is close to 90 or 270 degrees. Therefore, by measuring the magnitude of the product signal, the phase offset can be estimated.

        Assuming that the modulating signal is m ( t ) and there is no DC component in m ( t ), then the double sideband signal of suppressed carrier is:

After multiplying with the received signal, the obtained signal is 

After filtering we get:

Multiply the phase detector output to get 

 

When the frequency offset is small, the above formula is approximated as:

3. Verilog core program

`timescale 1ns / 1ps
 

module costas_tops(
input i_clk,
input i_rst,
input i_bits,
input i_start,
input signed[31:0]i_offset,
output signed[15:0]o_fir,
output signed[15:0]o_carrier,
output signed[31:0]o_signal,

output signed[31:0]o_cos_dw,
output signed[31:0]o_cos_demod,
output signed[31:0]o_nco
);
    
//调制端    
signal_gen signal_gen_u(
.i_clk    (i_clk),
.i_rst    (i_rst),
.i_bits   (i_bits),
.i_offset (i_offset),
.o_fir    (o_fir),
.o_carrier(o_carrier),
.o_mod    (o_signal)
);
    
    
/
    
//解调端 ,考虑载波costas同步
costas_loop costas_loopu(
.i_clk      (i_clk),
.i_rst      (i_rst),
.i_start    (i_start),
.o_signal   (o_signal),

.o_cos_dw    (o_cos_dw),
.o_cos_demod (o_cos_demod),
.o_nco       (o_nco)
);




 
endmodule
00_039m

4. Complete algorithm code file

V

Guess you like

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