-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathsigma_delta_dac.v
More file actions
33 lines (27 loc) · 781 Bytes
/
sigma_delta_dac.v
File metadata and controls
33 lines (27 loc) · 781 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
module sigma_delta_dac
#(
parameter MSBI = 15
)
(
input CLK,
input CEN,
input RESET,
input [MSBI:0] DACin, //DAC input (excess 2**MSBI)
output reg DACout //Average Output feeding analog lowpass
);
reg [MSBI+2:0] DeltaAdder; //Output of Delta Adder
reg [MSBI+2:0] SigmaAdder; //Output of Sigma Adder
reg [MSBI+2:0] SigmaLatch; //Latches output of Sigma Adder
reg [MSBI+2:0] DeltaB; //B input of Delta Adder
always @ (*)
DeltaB = {SigmaLatch[MSBI+2], SigmaLatch[MSBI+2]} << (MSBI+1);
always @(*)
DeltaAdder = DACin + DeltaB;
always @(*)
SigmaAdder = DeltaAdder + SigmaLatch;
always @(posedge CLK)
begin
SigmaLatch <= SigmaAdder;
DACout <= SigmaLatch[MSBI+2];
end
endmodule