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

powered by: WebSVN 2.1.0

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