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

Subversion Repositories gecko3

[/] [gecko3/] [trunk/] [GECKO3COM/] [gecko3com-ip/] [core/] [gpif_com_test_tb.vhd] - Blame information for rev 29

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 14 nussgipfel
--  GECKO3COM IP Core
2
--
3
--  Copyright (C) 2009 by
4
--   ___    ___   _   _
5
--  (  _ \ (  __)( ) ( )
6
--  | (_) )| (   | |_| |   Bern University of Applied Sciences
7
--  |  _ < |  _) |  _  |   School of Engineering and
8
--  | (_) )| |   | | | |   Information Technology
9
--  (____/ (_)   (_) (_)
10
--
11
--  This program is free software: you can redistribute it and/or modify
12
--  it under the terms of the GNU General Public License as published by
13
--  the Free Software Foundation, either version 3 of the License, or
14
--  (at your option) any later version.
15
--
16
--  This program is distributed in the hope that it will be useful,
17
--  but WITHOUT ANY WARRANTY; without even the implied warranty of
18
--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19
--  GNU General Public License for more details. 
20
--  You should have received a copy of the GNU General Public License
21
--  along with this program.  If not, see <http://www.gnu.org/licenses/>.
22
--
23
--  URL to the project description: 
24
--    http://labs.ti.bfh.ch/gecko/wiki/systems/gecko3com/start
25 18 nussgipfel
--------------------------------------------------------------------------------
26 14 nussgipfel
--
27
--  Author:  Andreas Habegger, Christoph Zimmermann
28 18 nussgipfel
--  Date of creation: 23. December 2009
29 14 nussgipfel
--  Description:
30
--      F
31
--
32
--  Tool versions:      11.1
33
--  Dependencies:
34
--
35 18 nussgipfel
--------------------------------------------------------------------------------
36 14 nussgipfel
 
37
 
38 11 nussgipfel
library ieee;
39
use ieee.std_logic_1164.all;
40
use ieee.std_logic_arith.all;
41
 
42
---- Uncomment the following library declaration if instantiating
43
---- any Xilinx primitives in this code.
44
library UNISIM;
45
use UNISIM.VComponents.all;
46
 
47
library XilinxCoreLib;
48
 
49
library work;
50 18 nussgipfel
use work.GECKO3COM_defines.all;
51 11 nussgipfel
 
52 18 nussgipfel
entity gpif_com_test_tb is
53
end  gpif_com_test_tb;
54 11 nussgipfel
 
55 18 nussgipfel
architecture simulation of gpif_com_test_tb is
56 11 nussgipfel
 
57
  -- components
58
 
59 18 nussgipfel
  component gpif_com_test
60
    port (
61
      i_nReset   : in    std_logic;
62
      i_IFCLK    : in    std_logic;
63
      i_SYSCLK   : in    std_logic;
64
      i_WRU      : in    std_logic;
65
      i_RDYU     : in    std_logic;
66
      o_WRX      : out   std_logic;
67
      o_RDYX     : out   std_logic;
68
      b_gpif_bus : inout std_logic_vector(SIZE_DBUS_GPIF-1 downto 0);
69
      o_LEDrx    : out   std_logic;
70
      o_LEDtx    : out   std_logic;
71
      o_LEDrun   : out   std_logic;
72
      o_dummy    : out   std_logic);
73
  end component;
74 11 nussgipfel
 
75
 
76
 
77
        -- simulation types
78
        type TsimSend is (finish, sending, waiting);
79
  -- simulation constants
80
 
81
 --constant TIME_BASE  : time := 1 ns;
82
 
83
  constant CLK_PERIOD : time := 20 ns;
84
 
85 18 nussgipfel
  constant DATA_BUS_SIZE  : integer := SIZE_DBUS_GPIF;
86 11 nussgipfel
  constant WORD_VALUE1    : std_logic_vector(DATA_BUS_SIZE-1 downto 0) := x"FF00";
87
  constant WORD_VALUE2    : std_logic_vector(DATA_BUS_SIZE-1 downto 0) := x"B030";
88
  constant WORD_VALUE3    : std_logic_vector(DATA_BUS_SIZE-1 downto 0) := x"50A0";
89
  -- signals
90
 
91
  signal sim_clk : std_logic;
92
  signal sim_rst : std_logic;
93
 
94 18 nussgipfel
  signal s_LEDrun, s_LEDtx, s_LEDrx, s_dummy : std_logic;
95 11 nussgipfel
 
96
 
97
  signal sim_1      : boolean := false;
98
 
99
  signal send_data  : TsimSend := finish;
100
 
101
 
102 18 nussgipfel
  signal s_WRU  : std_logic;
103
  signal s_RDYU : std_logic;
104 11 nussgipfel
 
105 18 nussgipfel
  signal s_WRX  : std_logic;
106
  signal s_RDYX : std_logic;
107 11 nussgipfel
 
108
 
109 18 nussgipfel
  signal s_data_bus : std_logic_vector(DATA_BUS_SIZE-1 downto 0);
110 11 nussgipfel
 
111
 
112
begin  -- simulation
113
 
114
-------------------------------------------------------------------------------
115
-- Design maps
116
-------------------------------------------------------------------------------
117
 
118 18 nussgipfel
  DUT : gpif_com_test
119
    port map (
120
        i_nReset   => sim_rst,
121
        i_IFCLK    => sim_clk,
122
        i_SYSCLK   => sim_clk,
123
        i_WRU      => s_WRU,
124
        i_RDYU     => s_RDYU,
125
        o_WRX      => s_WRX,
126
        o_RDYX     => s_RDYX,
127
        b_gpif_bus => s_data_bus,
128
        o_LEDrx    => s_LEDrx,
129
        o_LEDtx    => s_LEDtx,
130
        o_LEDrun   => s_LEDrun,
131
        o_dummy    => s_dummy);
132 11 nussgipfel
 
133
 
134
 
135
-------------------------------------------------------------------------------
136
-- CLK process
137
-------------------------------------------------------------------------------
138
   clk_process: process
139
        begin
140
                sim_clk<='0';
141
                wait for CLK_PERIOD/2;
142
                sim_clk<='1';
143
                wait for CLK_PERIOD/2;
144
                if sim_1 then
145
                        wait;
146
                end if;
147
        end process;
148
 
149
 
150
 
151
        rst_process: process
152
        begin
153
                sim_rst<='0';
154
                wait for CLK_PERIOD;
155
                sim_rst<='1';
156
                wait;
157
        end process;
158
 
159
 
160
end simulation;

powered by: WebSVN 2.1.0

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