Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Xilinx FPGA DDS Verilog Code

Status
Not open for further replies.

maheshkuruganti

Advanced Member level 4
Joined
May 18, 2007
Messages
106
Helped
7
Reputation
14
Reaction score
3
Trophy points
1,298
Location
India
Activity points
1,909
fpga dds

Hi guys,I am new to Verilog and am writing a code for DDS .I want to know if there are code in Xilinx FPGA Verilog for DDS.I wrote a very very simple code based on the Xilinx Coregen Sine LookUpTable.I want to know if there is any other code using Advanced Interpolation Techniques.Here is the simple code I wrote
Code:
module dds(CLK,WCLK,OUT,DIN,EN,SQR,TRI);
    input CLK;
    input WCLK;
	 output SQR;
	 input TRI;
    output [9:0] OUT;
    input DIN;
	 input EN;
	 reg [9:0] OUT;
	 reg [31:0] PhaseAccum;
	 reg [31:0] Freq=32'h10000000;
	 reg [4:0] addr;	
	 wire c;
	 wire w;
	 and a(c,CLK,EN);
	 and a1(c2,c,EN);
	 nand b(w,WCLK,!EN);
	 wire [9:0] PhasetoAmp;		
	 reg SQR;
	 sin amp(.THETA(PhaseAccum[31:22]),.SINE(PhasetoAmp),.CLK(c2));
	always@(negedge c)
	begin
	PhaseAccum<=PhaseAccum+Freq;
	end
	always@(posedge c)
	if(TRI==1'b1)
	begin
	OUT<=PhasetoAmp;
	addr<=0;
	end
	else
	begin
	OUT<=PhaseAccum[9:0];
	SQR<=PhaseAccum[31];
	end
	always@(negedge w)
	begin
	addr<=addr+1;
	Freq[addr]<=DIN;
	end
	endmodule
P.S:This is for a Function Generator so the Additional Square and Triangle inputs and outputs
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top