1 | -- Created:
|
2 | -- by - Desmond.UNKNOWN (DESMOND-PC)
|
3 | -- at - 00:52:37 07.03.2016
|
4 | --
|
5 |
|
6 | LIBRARY ieee;
|
7 | USE ieee.std_logic_1164.all;
|
8 |
|
9 |
|
10 | ENTITY testbench IS
|
11 | END testbench;
|
12 |
|
13 | ARCHITECTURE rtl OF testbench IS
|
14 |
|
15 | -- Architecture declarations
|
16 |
|
17 | -- Internal signal declarations
|
18 |
|
19 |
|
20 | -- Component declarations
|
21 | COMPONENT top_test
|
22 | PORT (
|
23 | arst : IN std_logic;
|
24 | bithigh : IN std_logic_vector(31 DOWNTO 0);
|
25 | bitlow : IN std_logic_vector(31 DOWNTO 0);
|
26 | ca_bh10 : OUT std_logic;
|
27 | ch_ca_data : IN std_logic_vector(31 DOWNTO 0);
|
28 | ch_s : IN std_logic_vector(31 DOWNTO 0);
|
29 | clk120MHz : IN std_logic;
|
30 | clk240Mhz : IN std_logic;
|
31 | clock_value_high : IN std_logic_vector(31 DOWNTO 0);
|
32 | clock_value_low : IN std_logic_vector(31 DOWNTO 0);
|
33 | dac_1 : OUT std_logic_vector(15 downto 0);
|
34 | dac_2 : OUT std_logic_vector(15 downto 0);
|
35 | freq_setup : IN std_logic_vector(31 DOWNTO 0);
|
36 | led : OUT std_logic;
|
37 | level : IN std_logic_vector(31 DOWNTO 0);
|
38 | out_symb : OUT std_logic;
|
39 | pps : IN std_logic
|
40 | );
|
41 | END COMPONENT;
|
42 |
|
43 | --------------------------------------
|
44 | signal LED,CA_OUT,MOD_OUT : std_logic;
|
45 | signal ARST_STIM,CLK_120MHZ,CLK_240MHZ,PPS_STIM : std_logic := '0';
|
46 | signal BIT_HIGH_STIM,BIT_LOW_STIM,LEVEL_STIM,CA_DATA_STIM,FREQ_STIM,CLK_LOW_STIM,CLK_HIGH_STIM,CH_SELECT_STIM : std_logic_vector (31 downto 0);
|
47 | signal DAC_1, DAC_2 : std_logic_vector (15 downto 0);
|
48 | --------------------------------------
|
49 | constant CLK_120MHZ_PERIOD : TIME := 8.33 ns;
|
50 | constant CLK_240MHZ_PERIOD : TIME := 4.15 ns;
|
51 | -------------------------------------
|
52 |
|
53 |
|
54 | BEGIN
|
55 |
|
56 | U_0 : top_test
|
57 | PORT MAP (
|
58 | ARST_STIM => arst,
|
59 | CLK_120MHZ => clk120MHz ,
|
60 | CLK_240MHZ => clk240Mhz,
|
61 | PPS_STIM => pps,
|
62 | BIT_HIGH_STIM => bithigh ,
|
63 | BIT_LOW_STIM => bitlow,
|
64 | LEVEL_STIM => level,
|
65 | CA_DATA_STIM => ch_ca_data,
|
66 | FREQ_STIM => freq_setup,
|
67 | CLK_LOW_STIM => clock_value_low,
|
68 | CLK_HIGH_STIM => clock_value_high,
|
69 | CH_SELECT_STIM => ch_s,
|
70 | DAC_1 => dac_1,
|
71 | DAC_2 => dac_2,
|
72 | CA_OUT => ca_bh10,
|
73 | LED => led,
|
74 | MOD_OUT => out_symb
|
75 | );
|
76 |
|
77 | --------------------------
|
78 | CLK_GENERATION : process
|
79 | begin
|
80 | CLK_120MHZ <= not CLK_120MHZ after (CLK_120MHZ_PERIOD/2);
|
81 | CLK_240MHZ <= not CLK_240MHZ after (CLK_240MHZ_PERIOD/2);
|
82 | end process CLK_GENERATION;
|
83 | ----------------------------
|
84 |
|
85 | STIM_PROC : process
|
86 | begin
|
87 | ARST_STIM <= '1';
|
88 | PPS_STIM <= '0';
|
89 | wait for 100 ns;
|
90 | CH_SELECT_STIM <= (others=>'0');
|
91 | CLK_LOW_STIM <= "00010111010110001110001000011001";
|
92 | CLK_HIGH_STIM <= "00000000000000000000000000000001";
|
93 | FREQ_STIM <= "00000010001000100010001000100010";
|
94 | LEVEL_STIM <= "00000000000000000000000000110010";
|
95 | CA_DATA_STIM <= "00000000000000000000000000000110";
|
96 | BIT_LOW_STIM <= "00100110100101111011000000000000";
|
97 | BIT_HIGH_STIM <= "10101010010010111110100001010101";
|
98 | wait for 1800 ns;
|
99 | PPS_STIM <= '1';
|
100 | wait for 100 ns;
|
101 | PPS_STIM <= '0';
|
102 | wait for 1000 ns;
|
103 | CH_SELECT_STIM <= "00000000000000000000000000000001";
|
104 | wait for 999999000 ns;
|
105 | PPS_STIM <= '1';
|
106 | wait for 100 ns;
|
107 | PPS_STIM <= '0';
|
108 | wait for 10000000 ns;
|
109 | end process STIM_PROC;
|
110 |
|
111 |
|
112 | END rtl;
|