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

Subversion Repositories adat_optical_feed_forward_receiver

[/] [adat_optical_feed_forward_receiver/] [web_uploads/] [Adat_testbench.vhd] - Blame information for rev 6

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 6 root
LIBRARY ieee;
2
USE ieee.std_logic_1164.ALL;
3
 
4
ENTITY Adat_Test IS
5
END Adat_Test;
6
 
7
ARCHITECTURE behavior OF Adat_Test IS
8
 
9
 COMPONENT adat_receiver
10
 PORT(
11
  m_clk : in std_logic;
12
  adat_in : IN std_logic;
13
 
14
  bus_address : IN std_logic_vector(2 downto 0);
15
  bus_enable : IN std_logic;
16
 
17
  bus_data : OUT std_logic_vector(23 downto 0);
18
  adat_wordclock : OUT std_logic;
19
  adat_user : OUT std_logic_vector(3 downto 0)
20
 );
21
 END COMPONENT;
22
 
23
 -- **Inputs**
24
 SIGNAL m_clk : std_logic := '0';
25
 SIGNAL adat_in : std_logic := '0';
26
 SIGNAL bus_address : std_logic_vector(2 downto 0) := (others=>'0');
27
 SIGNAL bus_enable : std_logic := '0';
28
 
29
 -- **Outputs**
30
 SIGNAL bus_data : Std_logic_vector(23 downto 0);
31
 SIGNAL adat_user : std_logic_vector(3 downto 0);
32
 SIGNAL adat_wordclock: std_logic := '0';
33
 
34
 constant m_clk_half_period : time := 5 ns;
35
 constant adat_period : time := 81.380208333333333333333333333333 ns;
36
 constant adat_half_period : time := 40.690104166666666666666666666667 ns;
37
 
38
BEGIN
39
 
40
 uut: adat_receiver PORT MAP(
41
  m_clk => m_clk,
42
  adat_in => adat_in,
43
  bus_address => bus_address,
44
  bus_enable => bus_enable,
45
  bus_data => bus_data,
46
  adat_user => adat_user,
47
  adat_wordclock => adat_wordclock
48
 );
49
 
50
 m_clk_clock_gen : process is
51
 begin
52
  m_clk <= '0' after m_clk_half_period, '1' after 2 * m_clk_half_period;
53
  wait for 2 * m_clk_half_period;
54
 end process m_clk_clock_gen;
55
 
56
 tb : PROCESS
57
 BEGIN
58
  -- wait for reset
59
  for frame_counter in 0 to 50 loop
60
   -- send adat training sequence
61
   adat_in <= '0';
62
   wait for 10 * adat_period;
63
   -- send adat sync symbol (1)
64
   adat_in <= not(adat_in);
65
   wait for adat_period;
66
   -- Send user characters
67
   wait for adat_period;
68
   wait for adat_period;
69
   wait for adat_period;
70
   wait for adat_period;
71
   -- send adat sync symbol (1)
72
   adat_in <= not(adat_in);
73
   wait for adat_period;
74
    for channel_counter in 0 to 7 loop
75
     for nibble_counter in 0 to 5 loop
76
      -- Send channel data
77
      adat_in <= not(adat_in);
78
      wait for adat_period;
79
      adat_in <= not(adat_in);
80
      wait for adat_period;
81
      adat_in <= not(adat_in);
82
      wait for adat_period;
83
      adat_in <= not(adat_in);
84
      wait for adat_period;
85
      -- send adat sync symbol (1)
86
      adat_in <= not(adat_in);
87
      wait for adat_period;
88
     end loop;
89
    end loop;
90
 
91
   -- send adat training sequence
92
   adat_in <= '0';
93
   wait for 10 * adat_period;
94
   -- send adat sync symbol (1)
95
   adat_in <= not(adat_in);
96
   wait for adat_period;
97
   -- Send user characters
98
      adat_in <= not(adat_in);
99
   wait for adat_period;
100
      adat_in <= not(adat_in);
101
   wait for adat_period;
102
      adat_in <= not(adat_in);
103
   wait for adat_period;
104
      adat_in <= not(adat_in);
105
   wait for adat_period;
106
   -- send adat sync symbol (1)
107
   adat_in <= not(adat_in);
108
   wait for adat_period;
109
    for channel_counter in 0 to 7 loop
110
     for nibble_counter in 0 to 5 loop
111
      -- Send channel data
112
      wait for adat_period;
113
      wait for adat_period;
114
      wait for adat_period;
115
      wait for adat_period;
116
      -- send adat sync symbol (1)
117
      adat_in <= not(adat_in);
118
      wait for adat_period;
119
 
120
 
121
     end loop;
122
    end loop;
123
   end loop;
124
  wait; -- wait forever
125
 END PROCESS;
126
END;

powered by: WebSVN 2.1.0

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