基础篇-verilog-FPGA实现频率相位调制DDS信号
生活随笔
收集整理的這篇文章主要介紹了
基础篇-verilog-FPGA实现频率相位调制DDS信号
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
//此模塊實現頻率、相位可調的DDS信號輸出
//Fword越大,越快的的讓高位的address+1,Fword取0,那么則需要很長很長的時間address才會+1
//所以Fword相當于步進,步進越大,頻率越快,步進越小,頻率越小。
//---------------------------------------------------------------------------------
//pword 用于控制相位,取address的哪一個點作為初始值
//值得注意的是:pword必須設置為 2^N ,因為address是靠位溢出回到0地址的,否則,會導致每一個周期后就會有偏差,逐漸偏差擴大
//理論部分:
/如果DDS的時鐘頻率為Fclk,
頻率控制字為1,則輸出頻率為Fout=BFclk/2^N,這個Fout頻率
就是多久才讓address+1的頻率,可知,如果N越大,
N就是指Fword_width,那么越慢讓address+1.
B就是fword,步進越大,越快地讓address+1.*/
//下面實現quartus里面仿真
//下面是tb文件
// Copyright (C) 1991-2013 Altera Corporation // Your use of Altera Corporation's design tools, logic functions // and other software and tools, and its AMPP partner logic // functions, and any output files from any of the foregoing // (including device programming or simulation files), and any // associated documentation or information are expressly subject // to the terms and conditions of the Altera Program License // Subscription Agreement, Altera MegaCore Function License // Agreement, or other applicable license agreement, including, // without limitation, that your use is for the sole purpose of // programming logic devices manufactured by Altera and sold by // Altera or its authorized distributors. Please refer to the // applicable agreement for further details.// ***************************************************************************** // This file contains a Verilog test bench template that is freely editable to // suit user's needs .Comments are provided in each section to help the user // fill out necessary details. // ***************************************************************************** // Generated on "11/03/2018 20:52:00"// Verilog Test Bench template for design : DDS_module // // Simulation tool : ModelSim (Verilog) // `timescale 1 ns/ 1 ps module DDS_module_vlg_tst(); reg [31:0] Fword; reg clk; reg [11:0] pword; reg rst_n; // wires wire DA_clk; wire [11:0]DA_data;initial begin #0 clk=0;#0 rst_n=0;#0 Fword=32'd262143;#0 pword=12'd511;#20 rst_n=1; end always #20 beginclk<=~clk; endDDS_module i1 ( // port map - connection between master ports and signals/registers .DA_clk(DA_clk),.DA_data(DA_data),.Fword(Fword),.clk(clk),.pword(pword),.rst_n(rst_n) ); endmodule
工程代碼如下:https://download.csdn.net/download/ciscomonkey/10763436
總結
以上是生活随笔為你收集整理的基础篇-verilog-FPGA实现频率相位调制DDS信号的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 基础篇verilog-‘timescal
- 下一篇: FPGA_进阶篇开篇