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

Subversion Repositories ddr2_sdram

[/] [ddr2_sdram/] [trunk/] [Top_Modul_VHDL.vhd] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 john_fpga
---------------------------------------------------------------------
2
-- File :                       Top_Modul_VHDL.vhd
3
-- Projekt :            Prj_12_DDR2
4
-- Zweck :                      DDR2-SDRAM am Spartan-3A Board
5
-- DDR2-RAM :           MT47H32M16 (64 MByte)
6
-- Datum :                      19.08.2011
7
-- Version :            7.0
8
-- Plattform :          XILINX Spartan-3A
9
-- FPGA :                       XC3S700A-FGG484
10
-- Sprache :            VHDL
11
-- ISE :                                ISE-Design-Suite V:13.1
12
-- IP-Core :            MIG V:3.6.1
13
-- Autor :                      UB
14
-- Mail :                       Becker_U(at)gmx.de
15
---------------------------------------------------------------------
16
--
17
-- Bitte auch die Hinweise in der "DDR2_liesmich.txt" beachten
18
--
19
-- please have a look at the "DDR2_readme.txt"
20
-- and sorry for my bad english :-)
21
--
22
---------------------------------------------------------------------
23
 
24
library IEEE;
25
use IEEE.STD_LOGIC_1164.ALL;
26
 
27
entity Top_Modul_VHDL is
28
        --------------------------------------------
29
        -- Port Deklerationen
30
        --------------------------------------------
31
        port(
32
                CLK_AUX_IN : in std_logic;
33
                LED_OUT : out std_logic_vector(7 downto 0);
34
                LED_YELLOW_OUT : out std_logic;
35
                SW_IN : in std_logic_vector(3 downto 0);
36
                BTN_IN : in std_logic_vector(3 downto 0);
37
                ----------------------------------------------------
38
                -- DDR2 SDRAM-Port-Pins
39
                ----------------------------------------------------
40
                cntrl0_ddr2_a : out std_logic_vector(12 downto 0) := (others => '0');
41
                cntrl0_ddr2_ba : out std_logic_vector(1 downto 0) := (others => '0');
42
                cntrl0_ddr2_ck : out std_logic_vector(0 downto 0) := (others => '0');
43
                cntrl0_ddr2_ck_n : out std_logic_vector(0 downto 0) := (others => '0');
44
                cntrl0_ddr2_cke : out std_logic := '0';
45
                cntrl0_ddr2_cs_n : out std_logic := '0';
46
                cntrl0_ddr2_ras_n : out std_logic := '0';
47
                cntrl0_ddr2_cas_n : out std_logic := '0';
48
                cntrl0_ddr2_we_n : out std_logic := '0';
49
                cntrl0_ddr2_odt : out std_logic := '0';
50
                cntrl0_ddr2_dm : out std_logic_vector(1 downto 0) := (others => '0');
51
                cntrl0_ddr2_dqs_n : inout std_logic_vector(1 downto 0) := (others => '0');
52
                cntrl0_ddr2_dqs : inout std_logic_vector(1 downto 0) := (others => '0');
53
                cntrl0_ddr2_dq : inout std_logic_vector(15 downto 0) := (others => '0');
54
                cntrl0_rst_dqs_div_in : in std_logic;
55
                cntrl0_rst_dqs_div_out : out std_logic
56
                ----------------------------------------------------            
57
        );
58
 
59
end Top_Modul_VHDL;
60
 
61
architecture Verhalten of Top_Modul_VHDL is
62
 
63
        --------------------------------------------
64
        -- Interne Signale
65
        --------------------------------------------    
66
        signal v_reset_n : std_logic;
67
        signal v_reset_p : std_logic;
68
        signal v_debounce : std_logic_vector(7 downto 0) := (others => '0');
69
        signal v_risingedge : std_logic_vector(3 downto 0) := (others => '0');
70
 
71
        -- DDR2 SDRAM-Leitungen -----------------------------------------
72
        signal clk_tb : std_logic;
73
        signal clk90_tb : std_logic;
74
        signal burst_done : std_logic;
75
        signal user_command_register : std_logic_vector(2 downto 0) := (others => '0');
76
        signal user_data_mask : std_logic_vector(3 downto 0):= (others => '0');
77
        signal user_input_data : std_logic_vector(31 downto 0);
78
        signal user_input_address : std_logic_vector(24 downto 0);
79
        signal v_init_done : std_logic;
80
        signal ar_done : std_logic;
81
        signal auto_ref_req : std_logic;
82
        signal user_cmd_ack : std_logic;
83
        signal user_data_valid : std_logic;
84
        signal user_output_data : std_logic_vector(31 downto 0);
85
        ---------------------------------------------------------------------
86
 
87
        --------------------------------------------
88
        -- Einbinden einer Componente
89
        -- Clock_VHDL : für die Clockerzeugung
90
        --------------------------------------------    
91
        COMPONENT Clock_VHDL is
92
        PORT (
93
                clk_in_133MHz : in std_logic;
94
                clk_out_1Hz : out std_logic
95
        );
96
        END COMPONENT Clock_VHDL;
97
 
98
        --------------------------------------------
99
        -- Einbinden einer Componente
100
        -- Buttons_VHDL : für die Buttons und Schalter
101
        --------------------------------------------    
102
        COMPONENT Buttons_VHDL is
103
        PORT (
104
                clk_in : in std_logic;
105
                button_in : in std_logic_vector(3 downto 0);
106
                switch_in : in std_logic_vector(3 downto 0);
107
                debounce_out : out std_logic_vector(7 downto 0);
108
                risingedge_out : out std_logic_vector(3 downto 0)
109
        );
110
        END COMPONENT Buttons_VHDL;
111
 
112
        --------------------------------------------
113
        -- Einbinden einer Componente
114
        -- VHDL um das DDR2 zu steuern
115
        --------------------------------------------
116
        COMPONENT DDR2_Control_VHDL is
117
        PORT (
118
                reset_in : in std_logic;
119
                clk_in : in std_logic;
120
                clk90_in : in std_logic;
121
                init_done : in std_logic;
122
                command_register : out std_logic_vector(2 downto 0);
123
                input_adress : out std_logic_vector(24 downto 0);
124
                input_data : out std_logic_vector(31 downto 0);
125
                output_data : in std_logic_vector(31 downto 0);
126
                cmd_ack : in std_logic;
127
                data_valid : in std_logic;
128
                burst_done : out std_logic;
129
                auto_ref_req : in std_logic;
130
                debounce_in : in std_logic_vector(7 downto 0);
131
                risingedge_in : in std_logic_vector(3 downto 0);
132
                data_out : out std_logic_vector(7 downto 0)
133
        );
134
        END COMPONENT DDR2_Control_VHDL;
135
 
136
        --------------------------------------------
137
        -- Einbinden einer Componente
138
        -- DDR2_RAM_Modul (vom MIG generiert)
139
        --------------------------------------------    
140
        COMPONENT DDR2_Ram_Core is
141
        PORT (
142
                cntrl0_ddr2_dq : inout std_logic_vector(15 downto 0);
143
                cntrl0_ddr2_a : out std_logic_vector(12 downto 0);
144
                cntrl0_ddr2_ba : out std_logic_vector(1 downto 0);
145
                cntrl0_ddr2_cke : out std_logic;
146
                cntrl0_ddr2_cs_n : out std_logic;
147
                cntrl0_ddr2_ras_n : out std_logic;
148
                cntrl0_ddr2_cas_n : out std_logic;
149
                cntrl0_ddr2_we_n : out std_logic;
150
                cntrl0_ddr2_odt : out std_logic;
151
                cntrl0_ddr2_dm : out std_logic_vector(1 downto 0);
152
                cntrl0_rst_dqs_div_in : in std_logic;
153
                cntrl0_rst_dqs_div_out : out std_logic;
154
                sys_clk_in : in std_logic;
155
                reset_in_n : in std_logic;
156
                cntrl0_burst_done : in std_logic;
157
                cntrl0_init_done : out std_logic;
158
                cntrl0_ar_done : out std_logic;
159
                cntrl0_user_data_valid : out std_logic;
160
                cntrl0_auto_ref_req : out std_logic;
161
                cntrl0_user_cmd_ack : out std_logic;
162
                cntrl0_user_command_register : in std_logic_vector(2 downto 0);
163
                cntrl0_clk_tb : out std_logic;
164
                cntrl0_clk90_tb : out std_logic;
165
                cntrl0_sys_rst_tb : out std_logic;
166
                cntrl0_sys_rst90_tb : out std_logic;
167
                cntrl0_sys_rst180_tb : out std_logic;
168
                cntrl0_user_output_data : out std_logic_vector(31 downto 0);
169
                cntrl0_user_input_data : in std_logic_vector(31 downto 0);
170
                cntrl0_user_data_mask : in std_logic_vector(3 downto 0);
171
                cntrl0_user_input_address : in std_logic_vector(24 downto 0);
172
                cntrl0_ddr2_dqs : inout std_logic_vector(1 downto 0);
173
                cntrl0_ddr2_dqs_n : inout std_logic_vector(1 downto 0);
174
                cntrl0_ddr2_ck : out std_logic_vector(0 downto 0);
175
                cntrl0_ddr2_ck_n : out std_logic_vector(0 downto 0)
176
        );
177
        END COMPONENT DDR2_Ram_Core;
178
 
179
 
180
begin
181
 
182
        --------------------------------------------------
183
        -- Instantz einer Componente erzeugen und verbinden
184
        -- Clock_VHDL : für die Clockerzeugung
185
        --------------------------------------------------
186
        INST_Clock_VHDL : Clock_VHDL
187
        PORT MAP (
188
                clk_in_133MHz => clk_tb,
189
                clk_out_1Hz => LED_YELLOW_OUT
190
        );
191
 
192
        --------------------------------------------------
193
        -- Instantz einer Componente erzeugen und verbinden
194
        -- VHDL um die Buttons/Schalter zu bearbeiten
195
        --------------------------------------------------
196
        INST_Buttons_VHDL : Buttons_VHDL
197
        PORT MAP (
198
                clk_in => clk_tb,
199
                button_in => BTN_IN,
200
                switch_in => SW_IN,
201
                debounce_out => v_debounce,
202
                risingedge_out => v_risingedge
203
        );
204
 
205
        --------------------------------------------------
206
        -- Instantz einer Componente erzeugen und verbinden
207
        -- VHDL um das DDR2 zu steuern
208
        --------------------------------------------------
209
        INST_DDR2_Control_VHDL : DDR2_Control_VHDL
210
        PORT MAP (
211
                reset_in => v_reset_p,
212
                clk_in => clk_tb,
213
                clk90_in => clk90_tb,
214
                init_done => v_init_done,
215
                command_register => user_command_register,
216
                input_adress => user_input_address,
217
                input_data => user_input_data,
218
                output_data => user_output_data,
219
                cmd_ack => user_cmd_ack,
220
                data_valid => user_data_valid,
221
                burst_done => burst_done,
222
                auto_ref_req => auto_ref_req,
223
                debounce_in => v_debounce,
224
                risingedge_in => v_risingedge,
225
                data_out => LED_OUT
226
        );
227
 
228
        --------------------------------------------------
229
        -- Instantz einer Componente erzeugen und verbinden
230
        -- DDR2_RAM_Modul (vom MIG generiert)
231
        --------------------------------------------------
232
        INST_DDR2_RAM_CORE : DDR2_Ram_Core
233
        PORT MAP (
234
                sys_clk_in => CLK_AUX_IN,
235
                reset_in_n => v_reset_n,
236
                cntrl0_burst_done => burst_done,
237
                cntrl0_user_command_register => user_command_register,
238
                cntrl0_user_data_mask => user_data_mask,
239
                cntrl0_user_input_data => user_input_data,
240
                cntrl0_user_input_address => user_input_address,
241
                cntrl0_init_done => v_init_done,
242
                cntrl0_ar_done => ar_done,
243
                cntrl0_auto_ref_req => auto_ref_req,
244
                cntrl0_user_cmd_ack => user_cmd_ack,
245
                cntrl0_clk_tb => clk_tb,
246
                cntrl0_clk90_tb => clk90_tb,
247
                cntrl0_sys_rst_tb => open,
248
                cntrl0_sys_rst90_tb => open,
249
                cntrl0_sys_rst180_tb => open,
250
                cntrl0_user_data_valid => user_data_valid,
251
                cntrl0_user_output_data => user_output_data,
252
                cntrl0_ddr2_ras_n => cntrl0_ddr2_ras_n,
253
                cntrl0_ddr2_cas_n => cntrl0_ddr2_cas_n,
254
                cntrl0_ddr2_we_n => cntrl0_ddr2_we_n,
255
                cntrl0_ddr2_cs_n => cntrl0_ddr2_cs_n,
256
                cntrl0_ddr2_cke => cntrl0_ddr2_cke,
257
                cntrl0_ddr2_dm => cntrl0_ddr2_dm,
258
                cntrl0_ddr2_ba => cntrl0_ddr2_ba,
259
                cntrl0_ddr2_a => cntrl0_ddr2_a,
260
                cntrl0_ddr2_ck => cntrl0_ddr2_ck,
261
                cntrl0_ddr2_ck_n => cntrl0_ddr2_ck_n,
262
                cntrl0_ddr2_dqs => cntrl0_ddr2_dqs,
263
                cntrl0_ddr2_dqs_n => cntrl0_ddr2_dqs_n,
264
                cntrl0_ddr2_dq => cntrl0_ddr2_dq,
265
                cntrl0_ddr2_odt => cntrl0_ddr2_odt,
266
                cntrl0_rst_dqs_div_in => cntrl0_rst_dqs_div_in,
267
                cntrl0_rst_dqs_div_out => cntrl0_rst_dqs_div_out
268
        );
269
 
270
 
271
        -----------------------------------------
272
        -- Reset-Signal aus einem Schalter generieren
273
        -----------------------------------------       
274
        v_reset_p <= SW_IN(0);
275
        v_reset_n <= not v_reset_p;
276
 
277
 
278
 
279
end Verhalten;
280
 

powered by: WebSVN 2.1.0

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