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

Subversion Repositories core1990_interlaken

[/] [core1990_interlaken/] [trunk/] [gateware/] [simulation/] [scrambler_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_scrambler is
5
end entity testbench_scrambler;
6
 
7
architecture tb_interlaken_scrambler of testbench_scrambler is
8 9 N.Boukadid
 
9
    signal Clk                          : std_logic := '1';      -- System clock
10
    signal Scram_Rst        : std_logic := '1';  -- Scrambler reset, use for initialization
11
 
12
    signal Data_In          : std_logic_vector (63 downto 0);-- Data input
13
    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 Scrambler_En     : std_logic;                     -- Input valid
17
    signal Data_Control_In  : std_logic;                     -- Indicates a control word
18
    signal Data_Control_Out : std_logic;                     -- Output control word indication
19
 
20
    signal Data_Valid_In    : std_logic;                     -- Input valid
21
    signal Data_Valid_Out   : std_logic;                     -- Output valid
22
    signal Gearboxready     : std_logic;
23
 
24
    constant CLK_PERIOD : time := 10 ns;
25 6 N.Boukadid
 
26
begin
27 9 N.Boukadid
    uut : entity work.Scrambler
28
    port map (
29
        clk => clk,
30
        Scram_Rst => Scram_Rst,
31
        lane_number => lane_number,
32
        Data_Control_In => Data_Control_In,
33
        Data_Control_Out => Data_Control_Out,
34
        data_in => data_in,
35
        scram_en => scram_en,
36
        data_out => data_out,
37
        Data_Valid_Out => Data_Valid_Out
38
    );
39 6 N.Boukadid
 
40 9 N.Boukadid
    Clk_process :process
41
    begin
42 6 N.Boukadid
        clk <= '1';
43
        wait for CLK_PERIOD/2;  --for half of clock period clk stays at '0'.
44
        clk <= '0';
45
        wait for CLK_PERIOD/2;  --for next half of clock period clk stays at '1'.
46 9 N.Boukadid
    end process;
47 6 N.Boukadid
 
48 9 N.Boukadid
    simulation : process
49
    begin
50
        wait for 1 ps;
51
        Data_Valid_Out <= '0';
52
        Lane_number <= "0001";
53
        data_in <= (others=>'0');
54
        wait for CLK_PERIOD*2;
55
 
56
        Scram_Rst <= '0';
57
        scram_en <= '1';
58
        data_in <= X"5f5e5d5c5b5a5958";
59
        wait for CLK_PERIOD;
60
 
61
        Data_Control_In <= '1';
62
        Data_In <= X"78f678f678f678f6";
63
        wait for CLK_PERIOD;
64 6 N.Boukadid
 
65 9 N.Boukadid
        Data_Control_In <= '0';
66
        data_in <= X"2f5e5d5c5b5a5958";
67
        wait for CLK_PERIOD;
68
 
69
        data_in <= X"9f5e5d5c5b5a5958";
70
        wait for CLK_PERIOD*2;
71
 
72
        data_in <= X"bf21a2a3a4a5a6a7";
73
        Scram_Rst <= '1';
74
        wait for CLK_PERIOD;
75
 
76
        Scram_Rst <='0';
77
        wait for CLK_PERIOD;
78
 
79
        data_in <= X"2f5e5a5c5b60f2a0";
80
        wait for CLK_PERIOD;
81
 
82
        data_in  <= X"635e22a3a4a5a7a7";
83
        wait for CLK_PERIOD;
84
 
85
        data_in <= X"60b35d5dc4a582a7";
86
        wait for CLK_PERIOD;
87
 
88
        data_in <= X"2f5e5d5c5b5a5958";
89
        wait for CLK_PERIOD;
90
 
91
        Data_Control_In <= '1';
92
        Data_In <= X"78f678f678f678f6";
93
        wait for CLK_PERIOD;
94
 
95
        Data_Control_In <= '0';
96
        wait for CLK_PERIOD;
97
 
98
        wait for CLK_PERIOD;
99
 
100
        wait;
101
    end process;
102 6 N.Boukadid
 
103
end architecture tb_interlaken_scrambler;
104
 

powered by: WebSVN 2.1.0

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