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 6

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_encoder is
5
end entity testbench_encoder;
6
 
7
architecture tb_encoder of testbench_encoder is
8
  component Encoder is
9
    port (
10
      data_in : in std_logic_vector(63 downto 0);
11
      encoder_en : in std_logic;
12
      Data_Control : in std_logic;
13
      clk : in std_logic;
14
      rst : in std_logic;
15
      encoder_rst : in std_logic;
16
      offset : out std_logic_vector(7 downto 0);
17
      data_out : out std_logic_vector(66 downto 0)
18
    );
19
  end component Encoder;
20
 
21
  for uut : line_encoder use entity work.line_encoder(encoder);
22
 
23
  signal data_in : std_logic_vector(63 downto 0);
24
  signal encoder_en : std_logic := '0';
25
  signal Data_Control : std_logic := '0';
26
  signal clk : std_logic;
27
  signal rst : std_logic := '0';
28
  signal encoder_rst : std_logic;
29
  signal offset : std_logic_vector(7 downto 0);
30
  signal data_out : std_logic_vector(66 downto 0);
31
 
32
  constant CLK_PERIOD : time := 10 ns;
33
 
34
begin
35
  uut : Encoder
36
  port map (
37
    data_in => data_in,
38
    encoder_en => encoder_en,
39
    Data_Control => Data_Control,
40
    clk => clk,
41
    rst => rst,
42
    encoder_rst => encoder_rst,
43
    offset => offset,
44
    data_out => data_out
45
  );
46
 
47
   Clk_process :process
48
   begin
49
        clk <= '1';
50
        wait for CLK_PERIOD/2;  --for half of clock period clk stays at '0'.
51
        clk <= '0';
52
        wait for CLK_PERIOD/2;  --for next half of clock period clk stays at '1'.
53
   end process;
54
 
55
  simulation : process
56
  begin
57
     wait for 1 ps;
58
     encoder_rst <= '1';
59
     data_in <= (others=>'0');
60
 
61
     wait for CLK_PERIOD;
62
 
63
     wait for CLK_PERIOD;
64
 
65
     encoder_rst <= '0';
66
     encoder_en <= '1';
67
     data_in <= X"5f5e5d5c5b5a5958";
68
     wait for CLK_PERIOD;
69
 
70
     data_in <= X"2f5e5d5c5b5a5958";
71
     wait for CLK_PERIOD;
72
 
73
     data_in <= X"9f5e5d5c5b5a5958";
74
     wait for CLK_PERIOD;
75
 
76
 
77
     data_in <= X"bf21a2a3a4a5a6a7";
78
     encoder_rst <= '1';
79
     wait for CLK_PERIOD;
80
 
81
     encoder_rst <= '0';
82
     wait for CLK_PERIOD;
83
 
84
     data_in <= X"2f5e5a5c5b60f2a0";
85
     wait for CLK_PERIOD;
86
 
87
     data_in  <= X"635e22a3a4a5a7a7";
88
     wait for CLK_PERIOD;
89
 
90
     data_in  <= X"00000FFF000000F0";
91
     wait for CLK_PERIOD*3;
92
 
93
 
94
     data_in  <= X"5050505050050505";
95
     wait for CLK_PERIOD;
96
 
97
     data_in  <= X"5486576758050505";
98
     wait for CLK_PERIOD;
99
 
100
     Data_Control <= '1';
101
     data_in <= X"60b35d5dc4a582a7";
102
     wait for CLK_PERIOD;
103
 
104
     data_in <= X"2f5e5d5c5b5a5958";
105
     wait for CLK_PERIOD;
106
 
107
     wait;
108
  end process;
109
end architecture tb_line_encoder;
110
 

powered by: WebSVN 2.1.0

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