OpenCores
URL https://opencores.org/ocsvn/sigma_delta_dac_dual_loop/sigma_delta_dac_dual_loop/trunk

Subversion Repositories sigma_delta_dac_dual_loop

[/] [sigma_delta_dac_dual_loop/] [trunk/] [dsm3/] [dac_dsm3.vhd] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 wzab
-------------------------------------------------------------------------------
2
-- Title      : DAC_DSM2 - sigma-delta DAC converter with double loop
3
-- Project    : 
4
-------------------------------------------------------------------------------
5
-- File       : dac_dsm2.vhd
6
-- Author     : Wojciech M. Zabolotny ( wzab[at]ise.pw.edu.pl )
7
-- Company    : 
8
-- Created    : 2009-04-28
9
-- Last update: 2012-10-16
10
-- Platform   : 
11
-- Standard   : VHDL'93c
12
-------------------------------------------------------------------------------
13
-- Description: Implementation without variables
14
-------------------------------------------------------------------------------
15
-- Copyright (c) 2009 - THIS IS PUBLIC DOMAIN CODE!!!
16
-------------------------------------------------------------------------------
17
-- Revisions  :
18
-- Date        Version  Author  Description
19
-- 2009-04-28  1.0      wzab    Created
20
-------------------------------------------------------------------------------
21
 
22
library ieee;
23
use ieee.std_logic_1164.all;
24
use ieee.numeric_std.all;
25
 
26
entity dac_dsm3 is
27
 
28
  generic (
29
    nbits : integer := 16);
30
 
31
  port (
32
    din     : in  signed((nbits-1) downto 0);
33
    dout    : out std_logic;
34
    clk     : in  std_logic;
35
    clk_ena : in  std_logic;
36
    n_rst   : in  std_logic);
37
 
38
end dac_dsm3;
39
 
40
architecture beh1 of dac_dsm3 is
41
 
42
  signal del1, del2, d_q : signed(nbits+2 downto 0) := (others => '0');
43
  constant c1            : signed(nbits+2 downto 0) := to_signed(1, nbits+3);
44
  constant c_1           : signed(nbits+2 downto 0) := to_signed(-1, nbits+3);
45
begin  -- beh1
46
 
47
  process (clk, n_rst)
48
  begin  -- process
49
    if n_rst = '0' then                 -- asynchronous reset (active low)
50
      del1 <= (others => '0');
51
      del2 <= (others => '0');
52
      dout <= '0';
53
    elsif clk'event and clk = '1' then  -- rising clock edge
54
      if clk_ena = '1' then
55
        del1 <= din - d_q + del1;
56
        del2 <= din - d_q + del1 - d_q + del2;
57
        if din - d_q + del1 - d_q + del2 > 0 then
58
          d_q  <= shift_left(c1, nbits);
59
          dout <= '1';
60
        else
61
          d_q  <= shift_left(c_1, nbits);
62
          dout <= '0';
63
        end if;
64
      end if;
65
    end if;
66
  end process;
67
 
68
 
69
end beh1;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.