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

Subversion Repositories pcie_ds_dma

[/] [pcie_ds_dma/] [trunk/] [core/] [adm/] [main/] [ctrl_thdac.vhd] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 dsmv
---------------------------------------------------------------------------------------------------
2
--
3
-- Title       : ctrl_thdac
4
-- Design      : ADM2
5
-- Author      : Ilya Ivanov
6
-- Company     : Instrumental System
7
--                                                                      
8
-- Version     : 1.0
9
---------------------------------------------------------------------------------------------------
10
--
11
-- Description :  Σοπΰβλενθε ΘΟΝ
12
--
13
---------------------------------------------------------------------------------------------------
14
 
15
 
16
library IEEE;
17
use IEEE.STD_LOGIC_1164.all;
18
use IEEE.std_logic_unsigned.all ;
19
 
20
 
21
entity ctrl_thdac is
22
         port(
23
                 reset : in STD_LOGIC;
24
                 clk : in STD_LOGIC;
25
                 start : in STD_LOGIC;
26
                 data_dac : in STD_LOGIC_VECTOR(11 downto 0);
27
                 clkDAC_out : out STD_LOGIC;
28
                 ld : out STD_LOGIC;
29
                 ready : out STD_LOGIC;
30
                 thrs  : out STD_LOGIC;
31
                 sdo_dac : out STD_LOGIC
32
             );
33
end ctrl_thdac;
34
 
35
 
36
 
37
architecture ctrl_thdac of ctrl_thdac is
38
 
39
signal counter : std_logic_vector(5 downto 0) ;          -- counter for reset
40
signal counter2 : std_logic_vector(7 downto 0) ;         -- counter for reset
41
signal counter_data : std_logic_vector(5 downto 0) ;             -- counter for reset
42
signal l_ready,l_ready2,l_clk:std_logic;
43
signal l_data_dac : STD_LOGIC_VECTOR(11 downto 0);
44
 
45
begin
46
thrs<=reset;
47
pr_start: process( clk,reset )
48
begin
49
        if(reset='0') then
50
                l_ready<='0';
51
        elsif( rising_edge( clk ) ) then
52
                if(start='1')then
53
                        l_ready<='1';
54
                        l_data_dac<=data_dac;
55
                elsif(counter_data = "11000")then
56
                        l_ready<='0';
57
                end if;
58
 
59
        end if;
60
end process;
61
 
62
pr_count: process( clk,reset )
63
begin
64
        if(reset='0') then
65
                counter <= (others => '0') ;
66
                counter_data <= (others => '0') ;
67
        elsif( rising_edge( clk ) ) then
68
                if(l_ready='1')then
69
                        counter <= counter + 1 ;
70
                        if (counter = "01010") then
71
                                counter <= (others => '0') ;
72
                                counter_data <= counter_data + 1 ;
73
                        end if;
74
                else
75
                        counter <= (others => '0') ;
76
                        counter_data <= (others => '0') ;
77
                end if;
78
        end if;
79
end process;
80
 
81
 
82
pr_clk_out: process( clk,reset )
83
begin
84
        if(reset='0') then
85
                l_clk<='0';
86
        clkDAC_out<='0';
87
        elsif( rising_edge( clk ) ) then
88
                if(counter = "101")then
89
                        l_clk<=not l_clk;
90
                end if;
91
                clkDAC_out<=l_clk;
92
        end if;
93
end process;
94
--clkDAC_out<=clk;
95
pr_data_out: process( clk,reset )
96
begin
97
        if(reset='0') then
98
                sdo_dac<='0';
99
        elsif( rising_edge( clk ) ) then
100
                if(counter = "00010" )then
101
                        if( counter_data="00000")then
102
                                sdo_dac<=l_data_dac(11);
103
                        elsif( counter_data="00010")then
104
                                sdo_dac<=l_data_dac(10);
105
                        elsif( counter_data="00100")then
106
                                sdo_dac<=l_data_dac(9);
107
                        elsif( counter_data="00110")then
108
                                sdo_dac<=l_data_dac(8);
109
                        elsif( counter_data="01000")then
110
                                sdo_dac<=l_data_dac(7);
111
                        elsif( counter_data="01010")then
112
                                sdo_dac<=l_data_dac(6);
113
                        elsif( counter_data="01100")then
114
                                sdo_dac<=l_data_dac(5);
115
                        elsif( counter_data="01110")then
116
                                sdo_dac<=l_data_dac(4);
117
                        elsif( counter_data="10000")then
118
                                sdo_dac<=l_data_dac(3);
119
                        elsif( counter_data="10010")then
120
                                sdo_dac<=l_data_dac(2);
121
                        elsif( counter_data="10100")then
122
                                sdo_dac<=l_data_dac(1);
123
                        elsif( counter_data="10110")then
124
                                sdo_dac<=l_data_dac(0);
125
                        end if;
126
                 end if;
127
 
128
 
129
        end if;
130
end process;
131
 
132
 
133
pr_count2: process( clk,reset )
134
begin
135
        if(reset='0') then
136
                counter2 <= (others => '0') ;
137
        elsif( rising_edge( clk ) ) then
138
                if(l_ready2='1')then
139
                        counter2 <= counter2 + 1 ;
140
                else
141
                        counter2 <= (others => '0') ;
142
                end if;
143
        end if;
144
end process;
145
 
146
pr_ready2: process( clk,reset )
147
begin
148
        if(reset='0') then
149
                l_ready2<='0';
150
                ld<='0';
151
        elsif( rising_edge( clk ) ) then
152
                if(counter_data = "10111")then
153
                        l_ready2<='1';
154
                elsif(counter2 = "1010")then
155
                        ld<='1';
156
                elsif(counter2 = "11111")then
157
                        ld<='0';
158
                elsif(counter2 = "110110")then
159
                        l_ready2<='0';
160
 
161
                end if;
162
        end if;
163
end process;
164
 
165
pr_redy: process( clk,reset )
166
begin
167
        if(reset='0') then
168
                ready<='1';
169
        elsif( rising_edge( clk ) ) then
170
                ready<=not (l_ready or l_ready2);
171
        end if;
172
end process;
173
 
174
 
175
end ctrl_thdac;

powered by: WebSVN 2.1.0

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