File tree Expand file tree Collapse file tree
libraries/ZPUino_Wishbone_Peripherals Expand file tree Collapse file tree Load diff Large diffs are not rendered by default.
Load diff Large diffs are not rendered by default.
Original file line number Diff line number Diff line change 1+
2+ library ieee;
3+ use ieee.std_logic_1164.all ;
4+ use ieee.numeric_std.all ;
5+
6+ entity dac_simplesd is
7+ generic (
8+ nbits : integer := 9 );
9+ port (
10+ din : in signed ((nbits- 1 ) downto 0 );
11+ dout : out std_logic ;
12+ clk : in std_logic ;
13+ clk_ena : in std_logic ;
14+ rst : in std_logic );
15+ end entity dac_simplesd;
16+
17+ architecture behave of dac_simplesd is
18+
19+ signal sigma_latch: unsigned (nbits+ 1 downto 0 );
20+
21+ begin
22+
23+ process (clk)
24+ variable delta_b: unsigned (nbits+ 1 downto 0 );
25+ variable delta_adder: unsigned (nbits+ 1 downto 0 );
26+ variable sigma_adder: unsigned (nbits+ 1 downto 0 );
27+ variable data: unsigned (nbits+ 1 downto 0 );
28+ begin
29+
30+ if rising_edge (clk) then
31+ if rst= '1' then
32+ sigma_latch <= (others => '0' );
33+ sigma_latch(sigma_latch'high ) <= '1' ;
34+ dout <= '0' ;
35+ else
36+ if clk_ena= '1' then
37+ delta_b(nbits+ 1 ) := sigma_latch(nbits+ 1 );
38+ delta_b(nbits) := sigma_latch(nbits+ 1 );
39+ delta_b(nbits- 1 downto 0 ) := (others => '0' );
40+ data(nbits+ 1 downto nbits) := "00" ;
41+ data(nbits- 1 ) := not din(nbits- 1 );
42+ data(nbits- 2 downto 0 ) := unsigned (din(nbits- 2 downto 0 ));
43+ delta_adder := data + delta_b;
44+ sigma_adder := delta_adder + sigma_latch;
45+ sigma_latch <= sigma_adder;
46+ dout <= sigma_latch(sigma_latch'high );
47+ end if ;
48+ end if ;
49+ end if ;
50+ end process ;
51+ end behave;
Original file line number Diff line number Diff line change @@ -82,6 +82,17 @@ component dac_dsm3v is
8282 n_rst : in std_logic );
8383end component ;
8484
85+ component dac_simplesd is
86+ generic (
87+ nbits : integer := 16 );
88+ port (
89+ din : in signed ((nbits- 1 ) downto 0 );
90+ dout : out std_logic ;
91+ clk : in std_logic ;
92+ clk_ena : in std_logic ;
93+ rst : in std_logic );
94+ end component ;
95+
8596component dac_dsm2v is
8697 generic (
8798 nbits : integer := 16 );
@@ -198,22 +209,22 @@ begin
198209 end if ;
199210end process ;
200211
201- chan0: dac_dsm3v
212+ chan0: dac_simplesd
202213 port map (
203214 din => sync_dat_q1(15 downto 0 ),
204215 dout => sdout(0 ),
205216 clk => wb_clk_i,
206217 clk_ena => '1' ,
207- n_rst => nrst
218+ rst => wb_rst_i
208219 );
209220
210- chan1: dac_dsm3v
221+ chan1: dac_simplesd
211222 port map (
212223 din => sync_dat_q2(15 downto 0 ),
213224 dout => sdout(1 ),
214225 clk => wb_clk_i,
215226 clk_ena => '1' ,
216- n_rst => nrst
227+ rst => wb_rst_i
217228 );
218229
219230
You can’t perform that action at this time.
0 commit comments