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

Subversion Repositories core1990_interlaken

[/] [core1990_interlaken/] [trunk/] [gateware/] [simulation/] [descrambler_tb.vhd] - Blame information for rev 9

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_descrambler is
5
end entity testbench_descrambler;
6
 
7
architecture tb_descrambler of testbench_descrambler is
8
 
9 9 N.Boukadid
    signal Clk          : std_logic;                     -- Interface clock
10
        signal Reset            : std_logic;                                     -- Descrambler reset, use for initialization
11
 
12 6 N.Boukadid
        signal Data_In      : std_logic_vector(63 downto 0); -- Data input
13 9 N.Boukadid
        signal Data_Out     : std_logic_vector(63 downto 0); -- Data output
14
 
15
        signal Lane_Number      : std_logic_vector (3 downto 0); -- Each lane number starts with different scrambler word
16
        signal Data_Control_In  : std_logic;                    --      Indicates a control word
17
        signal Data_Control_Out : std_logic;                    -- Output control word indication
18
    signal Data_Valid_In    : std_logic;                    -- Only valid data will be processed
19
    signal Data_Valid_Out   : std_logic;
20
    signal Lock             : std_logic;
21
 
22 6 N.Boukadid
        signal Error_BadSync            : std_logic;
23
        signal Error_StateMismatch      : std_logic;
24
        signal Error_NoSync                     : std_logic;
25
 
26 9 N.Boukadid
    constant CLK_PERIOD : time := 10 ns;
27 6 N.Boukadid
 
28
begin
29 9 N.Boukadid
    uut : entity work.Descrambler
30
    port map (
31
        clk => clk,
32
        reset => reset,
33
 
34
        Data_in => Data_in,
35
        Data_out => Data_out,
36
 
37
        Lane_Number => Lane_Number,
38
        Data_control_In  => Data_control_In,
39
        Data_control_Out => Data_control_Out,
40
        Data_valid_in  => Data_valid_in,
41
        Data_valid_out => Data_valid_out,
42
        Lock           => Lock,
43
 
44
        Error_BadSync => Error_BadSync,
45
        Error_StateMismatch => Error_StateMismatch,
46
        Error_NoSync => Error_NoSync
47
    );
48 6 N.Boukadid
 
49
        Clk_process :process
50
        begin
51
                clk <= '1';
52
                wait for CLK_PERIOD/2;  --for half of clock period clk stays at '0'.
53
                clk <= '0';
54
                wait for CLK_PERIOD/2;  --for next half of clock period clk stays at '1'.
55
        end process;
56
 
57
    simulation : process
58
    begin
59
        wait for 1 ps;
60
        Data_Control_In <= '0';
61
        reset <= '1';
62
        Lane_Number <= "0001";
63
        data_in <= (others=>'0');
64
 
65
        wait for CLK_PERIOD;
66
 
67
        wait for CLK_PERIOD;
68
 
69
        reset <= '0';
70
        Data_in <= X"1f5e5d5c5b5a5958";
71
        wait for CLK_PERIOD;
72
 
73
        Data_Control_In <= '1';
74
        Data_in <= X"78f6_78f6_78f6_78f6"; --1
75
        wait for CLK_PERIOD;
76
 
77
        Data_Control_In <= '0';
78
        data_in <= X"3f5e5d5c5b5a5958";
79
        wait for CLK_PERIOD*23;
80
 
81
        Data_Control_In <= '1';
82
        Data_in <= X"78f6_78f6_78f6_78f6";--2
83
        wait for CLK_PERIOD;
84
 
85
        Data_Control_In <= '0';
86
        data_in <= X"5f5e5a5c5b60f2a0";
87
        wait for CLK_PERIOD*23;
88
 
89
        Data_Control_In <= '1';
90
        data_in  <= X"78f6_78f6_78f6_78f6";--3
91
        wait for CLK_PERIOD;
92
 
93
        Data_Control_In <= '0';
94
        data_in  <= X"70000FFF000000F0";
95
        wait for CLK_PERIOD*23;
96
 
97
        Data_Control_In <= '1';
98
        data_in  <= X"78f6_78f6_78f6_78f6";--4 -> lock
99
        wait for CLK_PERIOD;
100
 
101
        data_in  <= X"5f5e5a5c5b60f2a0";
102
        wait for CLK_PERIOD;
103
 
104
        data_in  <= X"2f5e5d5c5b5a5958";
105
        wait for CLK_PERIOD;
106
 
107
        Data_Control_In <= '0';
108
        data_in  <= X"70000FFF000000F0";
109
        wait for CLK_PERIOD*21;
110
 
111
        Data_Control_In <= '1';
112
        data_in  <= X"78f6_78f6_78f6_78f6"; --Sync & 
113
        wait for CLK_PERIOD;
114
 
115
        Data_In  <= X"2Bfe_d100_19e0_1dbd";
116
        wait for CLK_PERIOD;
117
 
118
        Data_Control_In <= '0';
119
        data_in  <= X"70000FFF000000F0";
120
        wait for CLK_PERIOD*2;
121
 
122
        Data_Control_In <= '1';
123
        Data_in <= X"2f5e5d5c5b5a5958";
124
        wait for CLK_PERIOD;
125
 
126
        Data_Control_In <= '0';
127
        data_in  <= X"9486576758050505";
128
        wait for CLK_PERIOD*19;
129
 
130
        wait for CLK_PERIOD;
131
 
132
 
133
        data_in  <= X"8050505050050505";
134
        wait for CLK_PERIOD*3;
135
 
136
        data_in  <= X"9486576758050505";
137
        wait for CLK_PERIOD;
138
 
139
 
140
        data_in <= X"60b35d5dc4a582a7";
141
        wait for CLK_PERIOD;
142
 
143
 
144
        data_in <= X"2f5e5d5c5b5a5958";
145
        wait for CLK_PERIOD*12;
146
 
147
        data_in <= X"2f5e5d5c5b5a5958";
148
        wait for CLK_PERIOD;
149
 
150
        Data_in <= X"1f5e5d5c5b5a5958";
151
        wait for CLK_PERIOD;
152
 
153
 
154
        Data_in <= X"2f5e5d5c5b5a5958";
155
        wait for CLK_PERIOD;
156
 
157
 
158
        data_in <= X"3f5e5d5c5b5a5958";
159
        wait for CLK_PERIOD;
160
 
161
 
162
        Data_in <= X"4f21a2a3a4a5a6a7";
163
        wait for CLK_PERIOD;
164
 
165
 
166
        data_in <= X"5f5e5a5c5b60f2a0";
167
        wait for CLK_PERIOD;
168
 
169
        data_in <= X"635e22a3a4a5a7a7";
170
        wait for CLK_PERIOD;
171
 
172
        data_in <= X"5f5e5a5c5b60f2a0";
173
        wait for CLK_PERIOD;
174
 
175
        data_in <= X"635e22a3a4a5a7a7";
176
        wait for CLK_PERIOD;
177
 
178
        data_in <= X"70000FFF000000F0";
179
        wait for CLK_PERIOD*2;
180
 
181
 
182
        Data_in <= X"2f5e5d5c5b5a5958";
183
        wait for CLK_PERIOD;
184
 
185
        data_in  <= X"8050505050050505";
186
        wait for CLK_PERIOD*3;
187
 
188
        data_in  <= X"9486576758050505";
189
        wait for CLK_PERIOD;
190
 
191
        data_in <= X"60b35d5dc4a582a7";
192
        wait for CLK_PERIOD*60;
193
 
194
        data_in  <= X"8050505050050505";
195
        wait for CLK_PERIOD*3;
196
 
197
        data_in  <= X"9486576758050505";
198
        wait for CLK_PERIOD;
199
 
200
 
201
        data_in <= X"60b35d5dc4a582a7";
202
        wait for CLK_PERIOD;
203
 
204
 
205
        data_in <= X"2f5e5d5c5b5a5958";
206
        wait for CLK_PERIOD*12;
207
 
208
        data_in <= X"2c8e5d5c5b5a5958";
209
        wait for CLK_PERIOD;
210
 
211
        Data_in <= X"1f5e5d5c5b5a5958";
212
        wait for CLK_PERIOD*26;
213
 
214
        data_in <= X"2c8e5d5c5b5a5958";
215
        wait for CLK_PERIOD*18;
216
 
217
        data_in <= X"1f5e5d5c5b5a5958";
218
        wait for CLK_PERIOD;
219
        wait;
220
    end process;
221
 
222
end architecture tb_descrambler;
223
 

powered by: WebSVN 2.1.0

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