put all files in project directory
[x300-pci] / vhdl / dac.vhd
1 library IEEE;
2 use IEEE.STD_LOGIC_1164.ALL;
3 use IEEE.std_logic_unsigned.all;
4
5 entity dac is
6     Port ( clk : in STD_LOGIC;
7                 dac_a : out  STD_LOGIC_VECTOR (4 downto 0);
8            dac_b : out  STD_LOGIC_VECTOR (4 downto 0);
9
10           test_port : out  STD_LOGIC_VECTOR (14 downto 0));
11 end dac;
12
13
14 architecture RTL of dac is
15 signal counter : STD_LOGIC_VECTOR (20 downto 0);
16 begin
17   test: process (clk) is
18   begin
19     if (rising_edge(clk)) then
20       counter <= counter + '1';
21
22                 -- 5 bit R2R DAC 0-3.3V
23       dac_a <= counter (4 downto 0);
24       dac_b <= counter (4 downto 0);
25
26                 -- other pins without assigment
27 --      test_port <= counter (14 downto 0); -- four ports so that
28
29 --      test_port_d <= counter (20 downto 13); -- all pins are tested
30 --         test_pin <= counter (0);              -- test single bit left over
31     end if;
32   end process test;
33 end RTL;
34