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

Subversion Repositories sdram_controller

[/] [sdram_controller/] [trunk/] [scratch_isim_tb.vhd] - Blame information for rev 4

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 4 lynn0p
--------------------------------------------------------------------------------
2
-- Company: OPL Aerospatiale AG
3
-- Engineer: Owen Lynn <lynn0p@hotmail.com>
4
--
5
-- Create Date:   01:02:17 08/25/2009
6
-- Design Name:   
7
-- Module Name:  scratch_isim_tb.vhd
8
-- Project Name:  SDRAM_TB
9
-- Target Device:  
10
-- Tool versions:  
11
-- Description:   
12
-- 
13
-- VHDL Test Bench Created by ISE for module: scratch
14
-- 
15
-- Dependencies:
16
-- 
17
-- Revision:
18
-- Revision 0.01 - File Created
19
-- Additional Comments:
20
--  Copyright (c) 2009 Owen Lynn <lynn0p@hotmail.com>
21
--  Released under the GNU Lesser General Public License, Version 3
22
--
23
-- Notes: 
24
-- This testbench has been automatically generated using types std_logic and
25
-- std_logic_vector for the ports of the unit under test.  Xilinx recommends
26
-- that these types always be used for the top-level I/O of a design in order
27
-- to guarantee that the testbench will bind correctly to the post-implementation 
28
-- simulation model.
29
--------------------------------------------------------------------------------
30
LIBRARY ieee;
31
USE ieee.std_logic_1164.ALL;
32
USE ieee.std_logic_unsigned.all;
33
USE ieee.numeric_std.ALL;
34
 
35
library UNISIM;
36
use UNISIM.VComponents.all;
37
 
38
ENTITY scratch_isim_tb IS
39
        port(
40
                debug_reg : out std_logic_vector(7 downto 0)
41
        );
42
END scratch_isim_tb;
43
 
44
ARCHITECTURE behavior OF scratch_isim_tb IS
45
 
46
    -- Component Declaration for the Unit Under Test (UUT)
47
 
48
    COMPONENT scratch
49
    PORT(
50
         clk : IN  std_logic;
51
                        clke : in std_logic;
52
         rst : IN  std_logic;
53
         led : OUT  std_logic_vector(7 downto 0);
54
         dram_clkp : OUT  std_logic;
55
         dram_clkn : OUT  std_logic;
56
         dram_clke : OUT  std_logic;
57
                        dram_cs : out std_logic;
58
         dram_cmd : OUT  std_logic_vector(2 downto 0);
59
         dram_bank : OUT  std_logic_vector(1 downto 0);
60
         dram_addr : OUT  std_logic_vector(12 downto 0);
61
         dram_dm : OUT  std_logic_vector(1 downto 0);
62
         dram_dqs : INOUT  std_logic_vector(1 downto 0);
63
         dram_dq : INOUT  std_logic_vector(15 downto 0);
64
 
65
                        debug_reg : out std_logic_vector(7 downto 0)
66
        );
67
    END COMPONENT;
68
 
69
         component ddr
70
         port(
71
                Clk   : in std_logic;
72
                Clk_n : in std_logic;
73
                Cke   : in std_logic;
74
                Cs_n  : in std_logic;
75
                Ras_n : in std_logic;
76
                Cas_n : in std_logic;
77
                We_n  : in std_logic;
78
                Ba    : in std_logic_vector(1 downto 0);
79
                Addr  : in std_logic_vector(12 downto 0);
80
                Dm    : in std_logic_vector(1 downto 0);
81
                Dq    : inout std_logic_vector(15 downto 0);
82
                Dqs   : inout std_logic_vector(1 downto 0)
83
         );
84
         end component;
85
 
86
 
87
   --Inputs
88
   signal clk : std_logic := '0';
89
   signal rst : std_logic := '0';
90
 
91
        --BiDirs
92
   signal dram_dqs : std_logic_vector(1 downto 0);
93
   signal dram_dq : std_logic_vector(15 downto 0);
94
 
95
        --Outputs
96
   signal led : std_logic_vector(7 downto 0);
97
   signal dram_clkp : std_logic;
98
   signal dram_clkn : std_logic;
99
   signal dram_clke : std_logic;
100
        signal dram_cs : std_logic;
101
   signal dram_cmd : std_logic_vector(2 downto 0);
102
   signal dram_bank : std_logic_vector(1 downto 0);
103
   signal dram_addr : std_logic_vector(12 downto 0);
104
   signal dram_dm : std_logic_vector(1 downto 0);
105
        --signal debug_reg : std_logic_vector(7 downto 0);
106
        signal debug_wait : std_logic_vector(15 downto 0);
107
 
108
   -- Clock period definitions
109
   constant clk_period : time := 20.0 ns;
110
 
111
BEGIN
112
 
113
        -- Instantiate the Unit Under Test (UUT)
114
   uut: scratch PORT MAP (
115
          clk => clk,
116
                         clke => '1',
117
          rst => rst,
118
          led => led,
119
          dram_clkp => dram_clkp,
120
          dram_clkn => dram_clkn,
121
          dram_clke => dram_clke,
122
                         dram_cs => dram_cs,
123
          dram_cmd => dram_cmd,
124
          dram_bank => dram_bank,
125
          dram_addr => dram_addr,
126
          dram_dm => dram_dm,
127
          dram_dqs => dram_dqs,
128
          dram_dq => dram_dq,
129
                         debug_reg => debug_reg
130
        );
131
 
132
        DRAM_CHIP: ddr
133
        port map(
134
                Clk   => dram_clkp,
135
                Clk_n => dram_clkn,
136
                Cke   => dram_clke,
137
                Cs_n  => dram_cs,
138
                Ras_n => dram_cmd(0),
139
                Cas_n => dram_cmd(1),
140
                We_n  => dram_cmd(2),
141
                Ba    => dram_bank,
142
                Addr  => dram_addr,
143
                Dm    => dram_dm,
144
                Dq    => dram_dq,
145
                Dqs   => dram_dqs
146
        );
147
 
148
 
149
   -- Clock process definitions
150
   clk_process :process
151
   begin
152
                clk <= '0';
153
                wait for clk_period/2;
154
                clk <= '1';
155
                wait for clk_period/2;
156
   end process;
157
 
158
 
159
   -- Stimulus process
160
   stim_proc: process
161
   begin
162
      -- hold reset state for 100ms.
163
      wait for 100ms;
164
 
165
      wait for clk_period*10;
166
 
167
      -- insert stimulus here 
168
 
169
      wait;
170
   end process;
171
 
172
END;

powered by: WebSVN 2.1.0

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