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

Subversion Repositories pcie_ds_dma

[/] [pcie_ds_dma/] [trunk/] [projects/] [ambpex5_sx50t_wishbone/] [src/] [testbench/] [stend_ambpex5_wishbone.vhd] - Blame information for rev 18

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

Line No. Rev Author Line
1 16 dsmv
-------------------------------------------------------------------------------
2
--
3
-- Title       : stend_ambpex5_wishbone 
4
-- Author      : Dmitry Smekhov
5
-- Company     : Instrumental Systems
6
-- E-mail      : dsmv@insys.ru
7
--
8
-- Version     : 1.0
9
--
10
-------------------------------------------------------------------------------
11
--
12
-- Description : Stend for test ambpex5_sx50t_wishbone
13
--
14
-------------------------------------------------------------------------------
15
--
16
--  Version 1.2  20.04.2013
17
--      Created from stend_sp605_wishbone
18
--
19
-------------------------------------------------------------------------------
20
 
21
 
22
library ieee;
23
use ieee.std_logic_1164.all;
24
use ieee.std_logic_textio.all;
25
 
26
library work;
27
 
28
use work.cmd_sim_pkg.all;
29
use work.block_pkg.all;
30
use work.ambpex5_sx50t_wishbone_pkg.all;
31
use work.xilinx_pcie_rport_m2_pkg.all;
32
 
33
use work.test_pkg.all;
34
 
35
use std.textio.all;
36
use std.textio;
37
 
38
entity stend_ambpex5_wishbone is
39
        generic(
40 18 dsmv
                test_id                 : in integer:=3;        -- идентификатор теста
41 16 dsmv
                test_log                : in string:="src\testbench\log\file_id_"       -- имя файла отчёта
42
        );
43
end stend_ambpex5_wishbone;
44
 
45
 
46
architecture stend_ambpex5_wishbone of stend_ambpex5_wishbone is
47
--
48
--function set_file_name( test_log : in string; test_id: in integer ) return string is
49
--variable      str             : line;
50
--variable      ret             : string( 255 downto 1 );
51
--begin
52
--
53
--      write( str, test_log );
54
--      write( str, string'("_id_") );
55
--      write( str, test_id );
56
--      
57
--      ret:=conv_string( str );
58
--      return ret;
59
--      
60
--      
61
--end set_file_name;
62
 
63
constant        fname_test_log  : string:= test_log & integer'image(test_id) & ".log";
64
 
65
 
66
signal  clk250                  : std_logic:='0';
67
signal  clk250p                 : std_logic;
68
signal  clk250n                 : std_logic;
69
 
70
signal  clk100                  : std_logic:='0';
71
signal  clk100p                 : std_logic;
72
signal  clk100n                 : std_logic;
73
 
74
signal  reset                   : std_logic;
75
 
76
signal  txp                             : std_logic_vector( 7 downto 0 ):=(others=>'0');
77
signal  txn                             : std_logic_vector( 7 downto 0 ):=(others=>'1');
78
signal  rxp                             : std_logic_vector( 7 downto 0 ):=(others=>'0');
79
signal  rxn                             : std_logic_vector( 7 downto 0 ):=(others=>'1');
80
 
81
signal  rp_txp                  : std_logic_vector( 0 downto 0 ):=(others=>'0');
82
signal  rp_txn                  : std_logic_vector( 0 downto 0 ):=(others=>'1');
83
signal  rp_rxp                  : std_logic_vector( 0 downto 0 ):=(others=>'0');
84
signal  rp_rxn                  : std_logic_vector( 0 downto 0 ):=(others=>'1');
85
 
86
signal  tp                              : std_logic_vector( 3 downto 1 );
87
signal  led1                    : std_logic;
88
signal  led2                    : std_logic;
89
signal  led3                    : std_logic;
90
signal  led4                    : std_logic;
91
 
92
signal  cmd                             : bh_cmd;       -- команда
93
signal  ret                             : bh_ret;       -- ответ
94
 
95
 
96
 
97
begin
98
 
99
 dut: ambpex5_sx50t_wishbone
100
        generic map(
101
                is_simulation   => 2    -- 0 - синтез, 1 - моделирование ADM, 2 - моделирование pcie_core  
102
        )
103
        port map(
104
                ---- PCI-Express ----
105
                txp                     => txp,
106
                txn                     => txn,
107
 
108
                rxp                     => rxp,
109
                rxn                     => rxn,
110
 
111
                mgt251_p        => clk250p,
112
                mgt251_n        => clk250n,
113
 
114
                bperst          => reset
115
 
116
        );
117
 
118
 
119
rp : xilinx_pcie_rport_m2
120
generic map (
121
      REF_CLK_FREQ => 0,
122
      ALLOW_X8_GEN2 => FALSE,
123
      PL_FAST_TRAIN => TRUE,
124
      LINK_CAP_MAX_LINK_SPEED => X"1",
125
      DEVICE_ID => X"6011",
126
      LINK_CAP_MAX_LINK_WIDTH => X"01",
127
      LINK_CAP_MAX_LINK_WIDTH_int => 1,
128
      LINK_CTRL2_TARGET_LINK_SPEED => X"1",
129
      LTSSM_MAX_LINK_WIDTH => X"01",
130
      DEV_CAP_MAX_PAYLOAD_SUPPORTED => 2,
131
      VC0_TX_LASTPACKET => 29,
132
      VC0_RX_RAM_LIMIT => X"7FF",
133
      VC0_TOTAL_CREDITS_PD => (308),
134
      VC0_TOTAL_CREDITS_CD => (308),
135
      USER_CLK_FREQ => 1
136
)
137
port map (
138
 
139
                sys_clk => clk100,
140
                sys_reset_n => reset,
141
 
142
                pci_exp_txn => rp_txn,
143
                pci_exp_txp => rp_txp,
144
                pci_exp_rxn => rp_rxn,
145
                pci_exp_rxp => rp_rxp,
146
 
147
                cmd                     => cmd, -- команда
148
                ret                     => ret  -- ответ
149
 
150
);
151
 
152
 
153
clk250 <= not clk250 after 2 ns;
154
 
155
clk250p <= clk250;
156
clk250n <= not clk250;
157
 
158
clk100 <= not clk100 after 5 ns;
159
 
160
clk100p <= clk100;
161
clk100n <= not clk100;
162
 
163
rxp(0) <= rp_txp(0);
164
rxn(0) <= rp_txn(0);
165
 
166
rp_rxp(0) <= txp(0);
167
rp_rxn(0) <= txn(0);
168
 
169
reset <= '0', '1' after 5002 ns;
170
 
171
pr_main: process
172
 
173
variable        data    : std_logic_vector( 31 downto 0 );
174
variable        str     : LINE;         -- pointer to string
175
 
176
begin
177
 
178
        --   test_init( "test.log" );
179
 
180
    test_init( fname_test_log );
181
 
182
    wait for 180 us;
183
 
184
 
185
        case( test_id ) is
186
                when 0 => test_dsc_incorrect( cmd, ret );
187
        when 1 => test_read_4kb( cmd, ret );      -- was original
188 18 dsmv
        when 2 => test_adm_read_8kb( cmd, ret );
189
                when 3 => test_read_reg( cmd, ret );
190 16 dsmv
        --when 3 => test_adm_read_16kb( cmd, ret );
191
        --when 4 => test_adm_write_16kb( cmd, ret );
192
        --when 5 => test_block_main( cmd, ret );           
193
 
194
                when others => null;
195
        end case;
196
 
197
    --test_num_1(cmd, ret);
198
    --test_num_2(cmd, ret);
199
 
200
    --test_wb_1(cmd, ret);
201
    --test_wb_2(cmd, ret);
202
 
203
    test_close;
204
    --
205
    -- Print Final Banner
206
--    report "Init END OF TEST" severity WARNING;
207
--    assert false
208
--    report "End of TEST; Ending simulation (not a Failure)"
209
--    severity FAILURE;
210
    wait;
211
 
212
end process pr_main;
213
 
214
end stend_ambpex5_wishbone;

powered by: WebSVN 2.1.0

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