名称:DDS不同频率波形发生器设计Verilog代码Quartus仿真
软件:Quartus
语言:Verilog
代码功能:
DDS不同频率波形发生器
使用晶振50MHz时钟,合成以下频率的信号
1、500KHz 正弦波信号。
2、1MHz 正弦波信号。
3、500KHz方波波信号
4、1MHz 方波波信号。
5、1MHz 三角波信号
输出频率=clk*N/2^8,N为频率控制字,clk=128M
FPGA代码Verilog/VHDL代码资源下载:www.hdlcode.com
演示视频:
设计文档:
1. 工程文件
2. 程序文件
定制ROM IP核设置
Sin波形ROM初始化配置
方波ROM初始化配置
三角波ROM配置
3. 程序编译
4. 仿真图
4.1 Testbench
4.2 modelsim仿真图
图中为50M时钟产生的5种不同波形
测得图中两条竖直黄线之间周期为1000000ps=1us,即频率为1MHz
测得图中两条竖直黄线之间周期为2000000ps=2us,即频率为500KHz
部分代码展示:
// megafunction wizard: %ALTPLL% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: altpll // ============================================================ // File Name: clk_pll.v // Megafunction Name(s): // altpll // // Simulation Library Files(s): // altera_mf // ============================================================ // ************************************************************ // THIS IS A WIZARD-GENERATED FILE. DO NOT EDIT THIS FILE! // // 13.0.1 Build 232 06/12/2013 SP 1 SJ Full Version // ************************************************************ //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. // synopsys translate_off `timescale 1 ps / 1 ps // synopsys translate_on module clk_pll ( inclk0, c0); input inclk0; output c0; wire [4:0] sub_wire0; wire [0:0] sub_wire4 = 1'h0; wire [0:0] sub_wire1 = sub_wire0[0:0]; wire c0 = sub_wire1; wire sub_wire2 = inclk0; wire [1:0] sub_wire3 = {sub_wire4, sub_wire2};
点击链接获取代码文件:http://www.hdlcode.com/index.php?m=home&c=View&a=index&aid=1259
518