2 // XAPP154 based SigmaDeltaPCM Module
6 // This program is freeware for non-commercial use.
7 // An author does no guarantee about this program.
8 // You can use this under your own risk.
10 // See the xapp154.pdf on Xilinx application note.
14 `timescale 100 ps / 10 ps
15 `define MSBI 7 // Most significant Bit of DAC input
16 //This is a Delta-Sigma Digital to Analog Converter
18 module dac(DACout, DACin, Clk, Reset);
19 output DACout; // This is the average output that feeds low pass filter
20 reg DACout; // for optimum performance, ensure that this ff is in IOB
21 input [`MSBI:0] DACin; // DAC input (excess 2**MSBI)
24 reg [`MSBI+2:0] DeltaAdder; // Output of Delta adder
25 reg [`MSBI+2:0] SigmaAdder; // Output of Sigma adder
26 reg [`MSBI+2:0] SigmaLatch; // Latches output of Sigma adder
27 reg [`MSBI+2:0] DeltaB; // B input of Delta adder
29 always @(SigmaLatch) DeltaB = {SigmaLatch[`MSBI+2], SigmaLatch[`MSBI+2]} << (`MSBI+1);
31 always @(DACin or DeltaB) DeltaAdder = DACin + DeltaB;
33 always @(DeltaAdder or SigmaLatch) SigmaAdder = DeltaAdder + SigmaLatch;
35 always @(posedge Clk or posedge Reset)
39 SigmaLatch <= #1 1'b1 << (`MSBI+1);
44 // SigmaLatch <== #1 SigmaAdder;
45 SigmaLatch <= #1 SigmaAdder;
46 DACout <= #1 SigmaLatch[`MSBI+2];