matlab wireless communication with the FPGA, FPGA series digital signal processor (4) - Vivado DDS and the IP core design FIR Filter FIR system

This stresses the use of two DDS generated signal to be filtered and the filtered signal with a matlab generated, to build a combined signal generated FIR filter and filter system, and the preparation of testbench simulation analysis, the fifth or sixth lecture stresses expected to start writing verilog code FIR filter design, no longer calls the IP core.

On a talk with Matlab co-simulation FIR filter Vivado

1. Add the DDS IP core
(1) Create a new schematic file, add the DDS IP.
Here Insert Picture Description
(2) the DDS Configuration 1
Here Insert Picture Description
at two: the system clock, is set to 32 MHz;

4: by (Spurious Free Dynamic Range, SFDR) spurious free dynamic range of the numerical controller can be adjusted sine and cosine output data of the data bit, here set to 90, the cosine output 15.
Below, at the selected Noise Shaping 6 is None, sine wave data output bit width is 90/6 rounded up, i.e. the bit width of 15-bit, m_axis_data_tdata herein meet AXIS bus protocol, must be 8 bits wide multiples, so a 16-bit ([15: 0]).

5处:频率分辨率,可以调整相位数据的位宽,设置为1000,32MHz/(1*1000)=32000,以2为底取对数得到大约为14.8,向上取整为15-bit。
Here Insert Picture Description
(3)DDS配置-2
1/2两处选择 Fixed 固定值,表示输出频率和初始相位都不变,3处输出正弦波,总体配置为频率和初相都不变的正弦波;
Here Insert Picture Description
(4)DDS配置-3
配置输出信号的频率为 0.5 MHz,结合前面的配置输出 0.5 MHz 的固定的正弦波,其他保持默认;
Here Insert Picture Description
总结如下,可以看到位宽符合前文的计算。
Here Insert Picture Description
2.使用IP核搭建滤波系统
(1)按照前文的方式生成两个 DDS,一个频率为 0.5 MHz,一个为 5 MHz;
(2)按照第二讲的方式生成1个FIR低通滤波器;
Here Insert Picture Description
(3)添加加法器Adder/Subtracter;
1处点开可以更改输入位宽,此处因为要将前面DDS输出的AXIS总线上的数据作为输入,是16位位宽(其中只有低15位是有效的DDS数据),所以此处设置加法器输入16位(与AXIS的数据一致,不然位宽不匹配);
2处可以选择是加法还是减法;
3处配置输出位宽16位,输入的两个数据都是16位的,但是都只有低15位是有效数据,两个15位的数据相加,输出用16位表示可以保证不溢出;
4处配置延时,也是插入的流水线,当为1时表示插入1级流水线,输出的和会有1个时钟的延迟,此处不需要流水线,配置为0,此时输入就不会再有时钟;
此外,在第二页的Control页将Clock Enable勾掉,不需要做使能;
Here Insert Picture Description
(4)调用常数ip核 Constant,配置输出位宽为1,输出数据为1,整体连接图如下图,三个IP时钟一样,0.5 MHz 正弦波与 5 MHz 正弦波相加,得到的待滤波信号输入到 FIR 滤波器的输入数据端,常数 1 输给 s_axis_data_tvalid,表示输入数据恒有效;
Here Insert Picture Description
3.例化系统
(1)对原理图文件按照第二讲的方法 Generate Output Products 和 Create HDL Wrapper,并将 design_2_wrapper 设置为顶层文件(Set as Top);
Here Insert Picture Description
(2)打开 design_2_wrapper.v,可以看到如下引脚:

output [39:0]M_AXIS_DATA_0_tdata;		//滤波器输出的滤波后的信号
output M_AXIS_DATA_0_tvalid;			//滤波器输出信号有效指示信号,为1时表示输出的数据有效
output [15:0]M_AXIS_PHASE_0_tdata;		//0.5 MHz的DDS的相位数据
output M_AXIS_PHASE_0_tvalid;			//0.5 MHz的DDS的相位数据有效指示信号
output [15:0]M_AXIS_PHASE_1_tdata;		//5 MHz  的DDS的相位数据
output M_AXIS_PHASE_1_tvalid;			//5 MHz  的DDS的相位数据有效指示信号
input aclk_0;							//输入时钟,32MHz		
output m_axis_data_tvalid_0;			//0.5 MHz的DDS正弦波数据有效指示信号
output m_axis_data_tvalid_1;			//5 MHz  的DDS正弦波数据有效指示信号

Here Insert Picture Description
(3)新建仿真文件testbench
具体步骤参考上一讲
Here Insert Picture Description
(4)编写testbench,例化 design_2_wrapper 模块;
具体参考上一讲;
Here Insert Picture Description
(5)给定时钟信号;
使用 initial 块和 always 块设定时钟为 32 MHz(大约),具体见上一讲;
此处只有一个输入是时钟,不需要再配置其他输入信号;
此外,需要将新的仿真文件 fir_dds_tb 设为顶层文件(Set as Top),这样仿真时才能对新建的文件进行仿真;
Here Insert Picture Description
4.仿真分析
(1)点击仿真,可以看到滤波器输出一个 0.5 MHz 的正弦波,滤波效果很好;
Here Insert Picture Description
(2)观察内部其他信号的波形
首先,复位整个仿真,输入tcl 命令 restart

Here Insert Picture Description
输入 tcl命令 log_wave -r /*,注意空格,-r前后都有一个空格;
Here Insert Picture Description
找到下图中对应的模块,比如DDS模块的正弦波输出数据目前看不到,没有相应的引脚引出,找到DDS模块,对2箭头所指的信号 m_axis_data_tdata 右键,把信号添加到波形窗口 Add to Wave Window,

添加两个 DDS 的信号和加法器的输出信号,如下图,1处是滤波器的输出信号,2处是 0.5 MHz 的正弦波输出信号,3处是 5 MHz 的正弦波信号,4处事加法器输出的两个正弦波的叠加信号;
Here Insert Picture Description
下一讲使用verilog 编写 FIR 滤波器,并编写testbench进行仿真分析。

matlab与FPGA无线通信、FPGA数字信号处理系列(1)——通过matlab的fdatool工具箱设计FIR滤波器

matlab wireless communication with the FPGA, FPGA series digital signal processing (2) - Vivado FIR filter design calls IP core

matlab wireless communication with the FPGA, FPGA series digital signal processing (3) - Matlab simulation of the FIR filter combined with Vivado

Published 27 original articles · won praise 54 · views 60000 +

Guess you like

Origin blog.csdn.net/DengFengLai123/article/details/104034174