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

Subversion Repositories core1990_interlaken

[/] [core1990_interlaken/] [trunk/] [gateware/] [simulation/] [encoder_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_encoder is
5
end entity testbench_encoder;
6
 
7
architecture tb_encoder of testbench_encoder is
8
 
9 9 N.Boukadid
    signal clk          : std_logic;                     -- Clock input
10
    signal Data_In      : std_logic_vector(63 downto 0); -- Data input
11
    signal Data_Out     : std_logic_vector(66 downto 0); -- Encoded 67-bit output
12
 
13
    signal Data_Control  : std_logic:= '0';              -- Determines whether the word is data or control
14
    signal Data_valid_in : std_logic;
15
    signal Data_valid_out: std_logic;
16
 
17
    signal Encoder_En   : std_logic := '0';              -- Enables the encoder
18
    signal Encoder_Rst  : std_logic;                     -- Resets the encoder
19
 
20
    --signal Offset       : std_logic_vector(7 downto 0); -- Debug to see the average values of ones and zeros
21
    signal Gearboxready : std_logic;
22 6 N.Boukadid
 
23 9 N.Boukadid
    constant CLK_PERIOD : time := 10 ns;
24 6 N.Boukadid
 
25
begin
26 9 N.Boukadid
    uut : work.Encoder
27
    port map (
28
        clk => clk,
29
        data_in => data_in,
30
        data_out => data_out,
31
 
32
        Data_Control => Data_Control,
33
        data_valid_in => data_valid_in,
34
        data_valid_out => data_valid_out,
35
 
36
        encoder_en => encoder_en,
37
        encoder_rst => encoder_rst,
38
 
39
        --offset => offset,
40
        gearboxready => gearboxready
41
    );
42 6 N.Boukadid
 
43 9 N.Boukadid
    Clk_process :process
44
    begin
45 6 N.Boukadid
        clk <= '1';
46
        wait for CLK_PERIOD/2;  --for half of clock period clk stays at '0'.
47
        clk <= '0';
48
        wait for CLK_PERIOD/2;  --for next half of clock period clk stays at '1'.
49 9 N.Boukadid
    end process;
50 6 N.Boukadid
 
51 9 N.Boukadid
    simulation : process
52
    begin
53
        wait for 1 ps;
54
        encoder_rst <= '1';
55
        data_in <= (others=>'0');
56
 
57
        wait for CLK_PERIOD;
58
 
59
        wait for CLK_PERIOD;
60
 
61
        encoder_rst <= '0';
62
        encoder_en <= '1';
63
        data_in <= X"5f5e5d5c5b5a5958";
64
        wait for CLK_PERIOD;
65
 
66
        data_in <= X"2f5e5d5c5b5a5958";
67
        wait for CLK_PERIOD;
68
 
69
        data_in <= X"9f5e5d5c5b5a5958";
70
        wait for CLK_PERIOD;
71
 
72
 
73
        data_in <= X"bf21a2a3a4a5a6a7";
74
        encoder_rst <= '1';
75
        wait for CLK_PERIOD;
76
 
77
        encoder_rst <= '0';
78
        wait for CLK_PERIOD;
79
 
80
        data_in <= X"2f5e5a5c5b60f2a0";
81
        wait for CLK_PERIOD;
82
 
83
        data_in  <= X"635e22a3a4a5a7a7";
84
        wait for CLK_PERIOD;
85
 
86
        data_in  <= X"00000FFF000000F0";
87
        wait for CLK_PERIOD*3;
88
 
89
 
90
        data_in  <= X"5050505050050505";
91
        wait for CLK_PERIOD;
92
 
93
        data_in  <= X"5486576758050505";
94
        wait for CLK_PERIOD;
95 6 N.Boukadid
 
96 9 N.Boukadid
        Data_Control <= '1';
97
        data_in <= X"60b35d5dc4a582a7";
98
        wait for CLK_PERIOD;
99
 
100
        data_in <= X"2f5e5d5c5b5a5958";
101
        wait for CLK_PERIOD;
102
 
103
        wait;
104
    end process;
105 6 N.Boukadid
end architecture tb_line_encoder;
106
 

powered by: WebSVN 2.1.0

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