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

Subversion Repositories ddr2_sdram

[/] [ddr2_sdram/] [trunk/] [Testbench_DDR2/] [Read/] [Testbench_Read.vhd] - Blame information for rev 4

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 4 john_fpga
--------------------------------------------------------------------------------
2
-- Company: 
3
-- Engineer:
4
--
5
-- Create Date:   13:44:10 06/03/2012
6
-- Design Name:   
7
-- Module Name:   F:/Data_Temp_Ordner/Xilinx/Projekte/Test_Prj22/test_prj22/Testbench_Read.vhd
8
-- Project Name:  test_prj22
9
-- Target Device:  
10
-- Tool versions:  
11
-- Description:   
12
-- 
13
-- VHDL Test Bench Created by ISE for module: DDR2_Read_VHDL
14
-- 
15
-- Dependencies:
16
-- 
17
-- Revision:
18
-- Revision 0.01 - File Created
19
-- Additional Comments:
20
--
21
-- Notes: 
22
-- This testbench has been automatically generated using types std_logic and
23
-- std_logic_vector for the ports of the unit under test.  Xilinx recommends
24
-- that these types always be used for the top-level I/O of a design in order
25
-- to guarantee that the testbench will bind correctly to the post-implementation 
26
-- simulation model.
27
--------------------------------------------------------------------------------
28
LIBRARY ieee;
29
USE ieee.std_logic_1164.ALL;
30
 
31
-- Uncomment the following library declaration if using
32
-- arithmetic functions with Signed or Unsigned values
33
--USE ieee.numeric_std.ALL;
34
 
35
ENTITY Testbench_Read IS
36
END Testbench_Read;
37
 
38
ARCHITECTURE behavior OF Testbench_Read IS
39
 
40
    -- Component Declaration for the Unit Under Test (UUT)
41
 
42
    COMPONENT DDR2_Read_VHDL
43
    PORT(
44
         reset_in : IN  std_logic;
45
         clk_in : IN  std_logic;
46
         clk90_in : IN  std_logic;
47
         r_command_register : OUT  std_logic_vector(2 downto 0);
48
         r_cmd_ack : IN  std_logic;
49
         r_burst_done : OUT  std_logic;
50
         r_data_valid : IN  std_logic;
51
         read_en : IN  std_logic;
52
         read_busy : OUT  std_logic;
53
         output_data : IN  std_logic_vector(31 downto 0);
54
         read_data : OUT  std_logic_vector(63 downto 0)
55
        );
56
    END COMPONENT;
57
 
58
 
59
   --Inputs
60
   signal reset_in : std_logic := '0';
61
   signal clk_in : std_logic := '0';
62
   signal clk90_in : std_logic := '0';
63
   signal r_cmd_ack : std_logic := '0';
64
   signal r_data_valid : std_logic := '0';
65
   signal read_en : std_logic := '0';
66
   signal output_data : std_logic_vector(31 downto 0) := (others => '0');
67
 
68
        --Outputs
69
   signal r_command_register : std_logic_vector(2 downto 0);
70
   signal r_burst_done : std_logic;
71
   signal read_busy : std_logic;
72
   signal read_data : std_logic_vector(63 downto 0);
73
 
74
   -- Clock period definitions
75
   constant clk_in_period : time := 7.5 ns;    -- 133.33 MHz
76
   constant clk90_in_period : time := 7.5 ns;  -- 133.33 MHz
77
 
78
BEGIN
79
 
80
        -- Instantiate the Unit Under Test (UUT)
81
   uut: DDR2_Read_VHDL PORT MAP (
82
          reset_in => reset_in,
83
          clk_in => clk_in,
84
          clk90_in => clk90_in,
85
          r_command_register => r_command_register,
86
          r_cmd_ack => r_cmd_ack,
87
          r_burst_done => r_burst_done,
88
          r_data_valid => r_data_valid,
89
          read_en => read_en,
90
          read_busy => read_busy,
91
          output_data => output_data,
92
          read_data => read_data
93
        );
94
 
95
   -- Clock process definitions
96
   clk_in_process :process
97
   begin
98
                clk_in <= '0';
99
                wait for clk_in_period/2;
100
                clk_in <= '1';
101
                wait for clk_in_period/2;
102
   end process;
103
 
104
   -- Clk 90Phase shift
105
   clk90_in_process :process
106
   begin
107
                clk90_in <= '1';
108
                wait for clk90_in_period/4;
109
                clk90_in <= '0';
110
                wait for clk90_in_period/2;
111
                clk90_in <= '1';
112
                wait for clk90_in_period/4;
113
   end process;
114
 
115
 
116
   -- Stimulus process
117
   stim_proc: process
118
   begin
119
      -- hold reset state for 50 ns.
120
      wait for 50 ns;
121
 
122
      -- insert stimulus here 
123
                reset_in <= '1' , '0' after 10 ns; -- kurzer Reset Impuls
124
 
125
                --read enable (from Control-Unit)
126
                read_en <= '0' , '1' after 50 ns, '0' after 60 ns;
127
 
128
      wait;
129
   end process;
130
 
131
        ack_proc : process
132
        begin
133
 
134
                --wait until READ-Command
135
                wait until r_command_register="110";
136
 
137
                --falling edge (clk)
138
                wait for clk90_in_period;
139
 
140
                --user_cmd_ack (from RAM)
141
                r_cmd_ack <= '1';
142
 
143
                --read latency = 17-1 = 16              
144
                wait for clk90_in_period*16;
145
 
146
                --rising edge (ckl90)
147
                wait for clk90_in_period/4;
148
                wait for clk90_in_period/4;
149
                wait for clk90_in_period/4;
150
 
151
                --data (LSB)
152
                output_data <= x"639CC639";
153
 
154
                -- user_data_valid (from RAM)
155
                r_data_valid <= '1';
156
 
157
                --1clk pause
158
                wait for clk90_in_period;
159
 
160
                --data (MSB)
161
                output_data <= x"8C7318E7";
162
 
163
                --1clk pause
164
                wait for clk90_in_period;
165
 
166
                -- user_data_valid (from RAM)
167
                r_data_valid <= '0';
168
 
169
                --data (default)
170
                output_data <= x"00000000";
171
 
172
                --1clk pause
173
                wait for clk90_in_period;
174
 
175
                --user_cmd_ack (from RAM)
176
                r_cmd_ack <= '0';
177
 
178
                wait;
179
        end process;
180
 
181
END;

powered by: WebSVN 2.1.0

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