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/] [dsm2/] [dac_dsm2.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: 2009-04-29
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_dsm2 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
    n_rst : in  std_logic);
36
 
37
end dac_dsm2;
38
 
39
architecture beh1 of dac_dsm2 is
40
 
41
  signal del1, del2, d_q : signed(nbits+2 downto 0) := (others => '0');
42
  constant c1            : signed(nbits+2 downto 0) := to_signed(1, nbits+3);
43
  constant c_1           : signed(nbits+2 downto 0) := to_signed(-1, nbits+3);
44
begin  -- beh1
45
 
46
  process (clk, n_rst)
47
  begin  -- process
48
    if n_rst = '0' then                 -- asynchronous reset (active low)
49
      del1 <= (others => '0');
50
      del2 <= (others => '0');
51
      dout <= '0';
52
    elsif clk'event and clk = '1' then  -- rising clock edge
53
      del1 <= din - d_q + del1;
54
      del2 <= din - d_q + del1 - d_q + del2;
55
      if din - d_q + del1 - d_q + del2 > 0 then
56
        d_q  <= shift_left(c1, nbits);
57
        dout <= '1';
58
      else
59
        d_q  <= shift_left(c_1, nbits);
60
        dout <= '0';
61
      end if;
62
    end if;
63
  end process;
64
 
65
 
66
end beh1;

powered by: WebSVN 2.1.0

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