日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

基础篇-verilog-FPGA实现频率相位调制DDS信号

發布時間:2025/4/5 编程问答 42 豆豆
生活随笔 收集整理的這篇文章主要介紹了 基础篇-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里面仿真

module DDS_module #( parameter Fword_width=32, parameter pword_width=12, parameter DA_data_width=12 ) ( input clk, input rst_n, input [Fword_width-1:0] Fword,//頻率控制字 input [pword_width-1:0] pword,//相位控制字 output DA_clk, output [DA_data_width:0] DA_data );reg [Fword_width-1:0] r_Fword;//頻率控制 always@ (posedge clk or negedge rst_n) beginif(!rst_n)r_Fword<=0;elser_Fword<=Fword; end//--------------------------- reg [Fword_width-1:0] address_reg;always @(posedge clk or negedge rst_n) beginif(!rst_n)address_reg<=0;elseaddress_reg<=address_reg+r_Fword;endreg [pword_width-1:0] r_pword;//偏移量 always @ (posedge clk or negedge rst_n) beginif(!rst_n)r_pword<=0;else r_pword<=pword; endwire [pword_width-1:0] rom_address;//相位控制 assign rom_address =address_reg[Fword_width-1:Fword_width-pword_width] + r_pword;//ROM ROM ROM_inst (.clock(clk),.address(rom_address), //mif文件,地址12位,4096個數,位寬12.q(DA_data)); endmodule

//下面是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信号的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。