2 use ieee.std_logic_1164.all;
7 architecture behave of soc_reset_tb is
8 signal ext_clk : std_ulogic;
9 signal pll_clk : std_ulogic;
11 signal pll_locked_in : std_ulogic;
12 signal ext_rst_in : std_ulogic;
14 signal pll_rst_out : std_ulogic;
15 signal rst_out : std_ulogic;
17 constant clk_period : time := 10 ns;
19 type test_vector is record
20 pll_locked_in : std_ulogic;
21 ext_rst_in : std_ulogic;
22 pll_rst_out : std_ulogic;
26 type test_vector_array is array (natural range <>) of test_vector;
27 constant test_vectors : test_vector_array := (
28 -- PLL not locked, reset button not pressed
35 -- Reset is removed from the PLL
39 -- At some point PLL comes out of reset
46 -- Finally SOC comes out of reset
50 -- PLL locked, reset button pressed
55 -- PLL locked, reset button released
68 -- Finally SOC comes out of reset
72 soc_reset_0: entity work.soc_reset
81 pll_locked_in => pll_locked_in,
82 ext_rst_in => ext_rst_in,
83 pll_rst_out => pll_rst_out,
91 wait for clk_period/2;
94 wait for clk_period/2;
98 variable tv : test_vector;
101 wait for clk_period/4;
103 for i in test_vectors'range loop
104 tv := test_vectors(i);
106 pll_locked_in <= tv.pll_locked_in;
107 ext_rst_in <= tv.ext_rst_in;
109 report " ** STEP " & integer'image(i);
110 report "pll_locked_in " & std_ulogic'image(pll_locked_in);
111 report "ext_rst_in " & std_ulogic'image(ext_rst_in);
112 report "pll_rst_out " & std_ulogic'image(pll_rst_out);
113 report "rst_out" & std_ulogic'image(rst_out);
115 assert tv.pll_rst_out = pll_rst_out report
116 "pll_rst_out bad exp=" & std_ulogic'image(tv.pll_rst_out) &
117 " got=" & std_ulogic'image(pll_rst_out);
118 assert tv.rst_out = rst_out report
119 "rst_out bad exp=" & std_ulogic'image(tv.rst_out) &
120 " got=" & std_ulogic'image(rst_out);