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

Subversion Repositories core1990_interlaken

[/] [core1990_interlaken/] [trunk/] [gateware/] [simulation/] [interlaken_interface_tb.vhd] - Blame information for rev 7

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

Line No. Rev Author Line
1 6 N.Boukadid
library ieee;
2
use ieee.std_logic_1164.all;
3
 
4
entity testbench_interlaken_interface is
5
end entity testbench_interlaken_interface;
6
 
7
architecture tb_interlaken_interface of testbench_interlaken_interface is
8
 
9
    constant   TX_REFCLK_PERIOD        :   time :=  8.0 ns;
10
    constant   RX_REFCLK_PERIOD        :   time :=  8.0 ns;
11
    constant   SYSCLK_PERIOD           :   time :=  25.0 ns;
12
    constant   DCLK_PERIOD             :   time :=  5.0 ns;
13
--    constant BurstMax
14
--    constant BurstShort
15
--    constant PacketLength
16
    signal System_Clock_In_P : std_logic;
17
    signal System_Clock_In_N : std_logic;
18
 
19
    signal GTREFCLK_IN_P : std_logic;
20
    signal GTREFCLK_IN_N : std_logic;
21
 
22
    signal Reset                : std_logic;
23
 
24
    signal TX_Data      : std_logic_vector(63 downto 0);          -- Data transmitted
25
    signal RX_Data  : std_logic_vector (63 downto 0);        -- Data received
26
 
27
    signal TX_Out_P     : std_logic;
28
    signal TX_Out_N     : std_logic;
29
    signal RX_In_P      : std_logic;
30
    signal RX_In_N      : std_logic;
31
 
32
    signal TX_Link_Up      : std_logic;                         -- In case signal is high transmission may start
33
    signal TX_SOP          : std_logic;
34
    signal TX_EOP          : std_logic;
35
    signal TX_EOP_Valid    : std_logic_vector(2 downto 0);
36
    signal TX_FlowControl  : std_logic_vector(15 downto 0);
37
    signal TX_Channel      : std_logic_vector(7 downto 0);
38
 
39
    signal RX_SOP               : std_logic;                         -- Start of Packet
40
    signal RX_EOP               : std_logic;                         -- End of Packet
41
    signal RX_EOP_Valid         : std_logic_vector(2 downto 0);      -- Valid bytes packet contains
42
    signal RX_FlowControl       : std_logic_vector(15 downto 0);     -- Flow control data (yet unutilized)
43
    signal RX_Channel           : std_logic_vector(7 downto 0);      -- Select transmit channel (yet unutilized)
44
 
45
    signal RX_Link_Up       : std_logic;
46
 
47
    signal TX_Overflow      : std_logic;
48
    signal TX_Underflow     : std_logic;
49
 
50
    signal RX_FIFO_Full      : std_logic;
51
    signal RX_FIFO_Empty     : std_logic;
52
    signal Decoder_lock      : std_logic;
53
    signal Descrambler_lock  : std_logic;
54
    signal CRC24_Error       : std_logic;
55
    signal CRC32_Error       : std_logic;
56
 
57
begin
58
    RX_In_N <=  TX_Out_N;
59
    RX_In_P <=  TX_Out_P;
60
 
61
    uut : entity work.interlaken_interface
62
    port map (
63
        System_Clock_In_P => System_Clock_In_P,
64
        System_Clock_In_N => System_Clock_In_N,
65
        GTREFCLK_IN_P => GTREFCLK_IN_P,
66
        GTREFCLK_IN_N => GTREFCLK_IN_N,
67
 
68
        reset => reset,
69
 
70
        TX_Data => TX_Data,
71
        RX_Data => RX_Data,
72
 
73
        RX_In_N => RX_In_N,
74
        RX_In_P => RX_In_P,
75
        TX_Out_N => TX_Out_N,
76
        TX_Out_P => TX_Out_P,
77
 
78
        TX_Link_Up => TX_Link_Up,
79
        TX_SOP => TX_SOP,
80
        TX_EOP => TX_EOP,
81
        TX_EOP_Valid => TX_EOP_Valid,
82
        TX_FlowControl => TX_FlowControl,
83
        TX_Channel => TX_Channel,
84
 
85
        RX_SOP => RX_SOP,
86
        RX_EOP => RX_EOP,
87
        RX_EOP_Valid => RX_EOP_Valid,
88
        RX_FlowControl => RX_FlowControl,
89
        RX_Channel => RX_Channel,
90
 
91
        RX_Link_Up => RX_Link_Up,
92
 
93
        TX_Overflow => TX_Overflow,
94
        TX_Underflow => TX_Underflow,
95
 
96
        RX_FIFO_Full => RX_FIFO_Full,
97
        RX_FIFO_Empty => RX_FIFO_Empty,
98
        Decoder_lock => Decoder_lock,
99
        Descrambler_lock => Descrambler_lock,
100
        CRC24_Error => CRC24_Error,
101
        CRC32_Error => CRC32_Error
102
    );
103
 
104
    process
105
    begin
106
        GTREFCLK_IN_N  <=  '1';
107
        wait for TX_REFCLK_PERIOD/2;
108
        GTREFCLK_IN_N  <=  '0';
109
        wait for TX_REFCLK_PERIOD/2;
110
    end process;
111
 
112
    GTREFCLK_IN_P <= not GTREFCLK_IN_N;
113
 
114
    process
115
    begin
116
        rx_refclk_n_r  <=  '1';
117
        wait for RX_REFCLK_PERIOD/2;
118
        rx_refclk_n_r  <=  '0';
119
        wait for RX_REFCLK_PERIOD/2;
120
    end process;
121
 
122
    rx_refclk_p_r <= not rx_refclk_n_r;
123
 
124
    process
125
    begin
126
        System_Clock_In_N  <=  '1';
127
        wait for DCLK_PERIOD/2;
128
        System_Clock_In_N  <=  '0';
129
        wait for DCLK_PERIOD/2;
130
    end process;
131
 
132
    System_Clock_In_P <= not System_Clock_In_N;
133
 
134
 
135
 
136
    simulation : process
137
    begin
138
        wait for 1 ps;
139
            --TX_Enable <= '0';
140
        TX_EOP <= '0';
141
        TX_SOP <= '0';
142
        TX_Channel <= X"01";
143
        TX_EOP_Valid <= "111";
144
        TX_Data <= (others=>'0');
145
        reset <= '1';
146
        TX_FlowControl <= (others => '0');
147
 
148
        wait for 20*SYSCLK_PERIOD;
149
 
150
        wait for SYSCLK_PERIOD;
151
        reset <= '0';
152
        --TX_SOP <= '1';
153
        --TX_Enable <= '1';
154
        TX_Data <= X"1f5e5d5c5b5a5958";
155
        wait for SYSCLK_PERIOD;
156
        --TX_EOP <= '1';
157
 
158
        wait until (TX_Link_Up = '1');
159
 
160
        wait for SYSCLK_PERIOD*10;
161
        TX_FlowControl(0) <= '1';
162
        TX_SOP <= '1';
163
        TX_EOP <= '1';
164
        TX_Data <= X"2f5e5d5c5b5a5958";
165
        wait for SYSCLK_PERIOD;
166
 
167
        TX_EOP <= '0';
168
        TX_Data <= X"3f5e5d5c5b5a5958";
169
        wait for SYSCLK_PERIOD;
170
 
171
 
172
        TX_SOP <= '0';
173
        TX_EOP <= '0';
174
        TX_EOP <= '0';
175
        --reset <= '1';
176
        TX_Data <= X"4f21a2a3a4a5a6a7";
177
        wait for SYSCLK_PERIOD;
178
--        TX_FlowControl(0) <= '1';
179
        TX_SOP <= '1';
180
        TX_Data <= X"5f5e5a5c5b60f2a0";
181
        wait for SYSCLK_PERIOD;
182
 
183
        TX_SOP <= '0';
184
        TX_EOP <= '1';
185
        TX_Data  <= X"635e22a3a4a5a7a7";
186
        wait for SYSCLK_PERIOD;
187
 
188
        TX_EOP <= '0';
189
        --TX_SOP <= '1';
190
        TX_Data  <= X"70000FFF000000F0";
191
        wait for SYSCLK_PERIOD*2;
192
 
193
        TX_SOP <= '1';
194
        TX_Data <= X"2f5e5d5c5b5a5958";
195
        wait for SYSCLK_PERIOD;
196
 
197
        TX_SOP <= '0';
198
        TX_EOP <= '1';
199
        wait for SYSCLK_PERIOD;
200
 
201
        TX_EOP <= '0';
202
        --TX_SOP <= '0';
203
        TX_Data  <= X"8050505050050505";
204
        --wait for SYSCLK_PERIOD*3;                          
205
        wait for SYSCLK_PERIOD;
206
        TX_Data  <= X"9486576758050505";
207
        wait for SYSCLK_PERIOD;
208
 
209
        TX_EOP <= '1';
210
        TX_Data <= X"60b35d5dc4a582a7";
211
        wait for SYSCLK_PERIOD; --Test influencing pause state position
212
 
213
        TX_EOP <= '0';
214
        wait for SYSCLK_PERIOD*16;
215
 
216
        TX_SOP <= '1';
217
        TX_Data <= X"4f21a2a3a4a5a6a7";
218
        wait for SYSCLK_PERIOD;
219
 
220
        TX_Data <= X"995e5a5c5b60f2a0";
221
        wait for SYSCLK_PERIOD;
222
 
223
        TX_Data  <= X"635e22a3a4a5a7a7";
224
        wait for SYSCLK_PERIOD;
225
 
226
        TX_Data  <= X"70000FFF000000F0";
227
        wait for SYSCLK_PERIOD*2;
228
 
229
        TX_Data <= X"2f5e5d5c5b5a5958";
230
        wait for SYSCLK_PERIOD;
231
 
232
        TX_Data <= X"4f21a2a3a4a5a6a7";
233
        wait for SYSCLK_PERIOD;
234
 
235
        TX_Data <= X"5f5e5a5c5b60f2a0";
236
        wait for SYSCLK_PERIOD;
237
 
238
        TX_Data  <= X"635e22a3a4a5a7a7";
239
        wait for SYSCLK_PERIOD;
240
 
241
        TX_Data  <= X"70000FFF000000F0";
242
        wait for SYSCLK_PERIOD*2;
243
 
244
 
245
        TX_Data <= X"2f5e5d5c5b5a5958";
246
        wait for SYSCLK_PERIOD*12;
247
 
248
        TX_Data <= X"4f5e5d5c5b5a5958";
249
        wait for SYSCLK_PERIOD;
250
 
251
        TX_SOP <= '0';
252
        TX_EOP <= '1';
253
        wait for SYSCLK_PERIOD;
254
 
255
        wait for SYSCLK_PERIOD*4;
256
        wait;
257
    end process;
258
 
259
end architecture tb_interlaken_interface;
260
 
261
 

powered by: WebSVN 2.1.0

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