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

Subversion Repositories core1990_interlaken

[/] [core1990_interlaken/] [trunk/] [gateware/] [simulation/] [framing_burst_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_burst is
5
end entity testbench_burst;
6
 
7
architecture tb_burst of testbench_burst is
8
 
9
    constant BurstMax   : positive := 64; --256
10
    constant BurstShort : positive := 32;  --512 - 256 - 128 - 64 - 32
11
 
12 9 N.Boukadid
        signal clk       : std_logic;          -- System clock
13
        signal reset : std_logic;          -- Reset, use for initialization.
14 6 N.Boukadid
 
15
        signal TX_Enable : std_logic := '0';                           -- Enable the TX
16
        signal TX_SOP : std_logic := '0';                              -- Start of Packet
17
        signal TX_ValidBytes : std_logic_vector(2 downto 0) := "000";    -- Valid bytes packet contains
18
        signal TX_EOP : std_logic := '0';                              -- End of Packet
19
        signal TX_FlowControl : std_logic_vector(15 downto 0) := (others => '0');  -- Flow control data (yet unutilized)
20
        signal TX_Channel    : std_logic_vector(7 downto 0);
21
 
22
        signal Data_in : std_logic_vector(63 downto 0);         -- Input data
23
        signal Data_out : std_logic_vector(63 downto 0);       -- To scrambling/framing
24
        signal Data_valid_out : std_logic;                                              -- Indicate data transmitted is valid
25
        signal Data_control_out : std_logic;                   -- Control word indication
26
 
27
    signal FIFO_meta : std_logic;
28
        signal FIFO_read : std_logic;                                           -- Request data from the FIFO
29
        signal FIFO_data : std_logic_vector(9 downto 0);         -- Determines how many bytes have to be transmitted
30
 
31
 
32
 
33 9 N.Boukadid
    constant CLK_PERIOD : time := 10 ns;
34 6 N.Boukadid
 
35
begin
36 9 N.Boukadid
    uut : entity work.Burst_Framer
37
    generic map(
38
        BurstShort => BurstShort,
39
        BurstMax => BurstMax
40
    )
41
    port map (
42
        clk => clk,
43
        reset => reset,
44
        TX_Enable => TX_Enable,
45
        TX_SOP => TX_SOP,
46
        TX_ValidBytes => TX_ValidBytes,
47
        TX_EOP => TX_EOP,
48
        TX_FlowControl => TX_FlowControl,
49
        TX_Channel => TX_Channel,
50
        Data_in => Data_in,
51
        Data_out => Data_out,
52
        Data_valid_out => Data_valid_out,
53
        Data_control_out => Data_control_out,
54
 
55
        FIFO_read => FIFO_read,
56
        FIFO_meta => FIFO_meta,
57
        FIFO_data => FIFO_data
58
    );
59 6 N.Boukadid
 
60 9 N.Boukadid
    Clk_process :process
61
    begin
62
        clk <= '1';
63
        wait for CLK_PERIOD/2;  --for half of clock period clk stays at '0'.
64
        clk <= '0';
65
        wait for CLK_PERIOD/2;  --for next half of clock period clk stays at '1'.
66
    end process;
67 6 N.Boukadid
 
68
    simulation : process
69
    begin
70
       wait for 1 ps;
71
       TX_SOP <= '0';
72
       reset <= '1';
73
       data_in <= (others=>'0');
74
 
75
       wait for CLK_PERIOD;
76
 
77
       wait for CLK_PERIOD;
78
       FIFO_meta <= '1';
79
       reset <= '0';
80
       TX_Enable <= '1';
81
       TX_ValidBytes <= "111";
82
       Data_in <= X"1f5e5d5c5b5a5958";
83
       wait for CLK_PERIOD;
84
 
85
       TX_SOP <= '1';
86
       TX_EOP <= '1';
87
       Data_in <= X"2f5e5d5c5b5a5958";
88
       wait for CLK_PERIOD;
89
 
90
       TX_SOP <= '1';
91
       TX_EOP <= '0';
92
       data_in <= X"3f5e5d5c5b5a5958";
93
       wait for CLK_PERIOD;
94
 
95
       TX_EOP <= '0';
96
       --reset <= '1';
97
       Data_in <= X"4f21a2a3a4a5a6a7";
98
       wait for CLK_PERIOD;
99
 
100
       --reset <= '0';
101
       data_in <= X"5f5e5a5c5b60f2a0";
102
       wait for CLK_PERIOD;
103
       --TX_EOP <= '1';
104
       data_in  <= X"635e22a3a4a5a7a7";
105
       wait for CLK_PERIOD;
106
       --TX_EOP <= '0';
107
       --TX_SOP <= '1';
108
       data_in  <= X"70000FFF000000F0";
109
       wait for CLK_PERIOD*2;
110
 
111
       TX_SOP <= '1';
112
       Data_in <= X"2f5e5d5c5b5a5958";
113
       wait for CLK_PERIOD;
114
 
115
       TX_SOP <= '0';
116
       TX_EOP <= '1';
117
       wait for CLK_PERIOD;
118
 
119
       TX_EOP <= '0';
120
       --TX_SOP <= '0';
121
       data_in  <= X"8050505050050505";
122
       wait for CLK_PERIOD*3;
123
 
124
       data_in  <= X"9486576758050505";
125
       wait for CLK_PERIOD;
126
 
127
       TX_EOP <= '1';
128
       data_in <= X"60b35d5dc4a582a7";
129
       wait for CLK_PERIOD;
130
 
131
       TX_EOP <= '0';
132
       TX_SOP <= '1';
133
       data_in <= X"2f5e5d5c5b5a5958";
134
       wait for CLK_PERIOD*6;
135
 
136
       FIFO_meta<= '0';
137
       wait for CLK_PERIOD;
138
       FIFO_meta<= '1';
139
       wait for CLK_PERIOD*6;
140
       TX_SOP <= '0';
141
       TX_EOP <= '1';
142
       wait for CLK_PERIOD;
143
 
144
       FIFO_meta <= '0';
145
       wait for CLK_PERIOD*4;
146
       FIFO_meta <= '1';
147
       wait;
148
    end process;
149
 
150
end architecture tb_burst;
151
 

powered by: WebSVN 2.1.0

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