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

Subversion Repositories powerseq

[/] [powerseq/] [trunk/] [testbench.vhd] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 buenos
 
2
-- VHDL Test Bench Created from source file powerseq_mod.vhd -- 12:53:48 10/07/2024
3
--
4
-- Notes: 
5
-- This testbench has been automatically generated using types std_logic and
6
-- std_logic_vector for the ports of the unit under test.  Xilinx recommends 
7
-- that these types always be used for the top-level I/O of a design in order 
8
-- to guarantee that the testbench will bind correctly to the post-implementation 
9
-- simulation model.
10
--
11
LIBRARY ieee;
12
USE ieee.std_logic_1164.ALL;
13
USE ieee.numeric_std.ALL;
14
 
15
ENTITY testbench IS
16
END testbench;
17
 
18
ARCHITECTURE behavior OF testbench IS
19
 
20
        COMPONENT powerseq_mod
21
        PORT(
22
                clk : IN std_logic;
23
                reset_n : IN std_logic;
24
                forcepoweron : IN std_logic;
25
                PSEQ_RAIL_PG : IN std_logic_vector(127 downto 0);
26
                thermal_n : IN std_logic;
27
                all_on : IN std_logic;
28
                PSEQ_RAIL_EN : OUT std_logic_vector(127 downto 0);
29
                failed_rails : OUT std_logic_vector(255 downto 0);
30
                pfailure : OUT std_logic;
31
                tick_out : OUT std_logic;
32
                pseqstate_out : OUT std_logic_vector(3 downto 0);
33
                all_pgood : OUT std_logic
34
                );
35
        END COMPONENT;
36
 
37
  constant clk_per         : time    :=  40 ns; -- 25 MHz clk
38
        signal clk : std_logic := '0';
39
        SIGNAL reset_n :  std_logic;
40
        SIGNAL forcepoweron :  std_logic;
41
        SIGNAL PSEQ_RAIL_EN :  std_logic_vector(127 downto 0);
42
        SIGNAL PSEQ_RAIL_PG :  std_logic_vector(127 downto 0);
43
        SIGNAL thermal_n :  std_logic;
44
        SIGNAL failed_rails :  std_logic_vector(255 downto 0);
45
        SIGNAL pfailure :  std_logic;
46
        SIGNAL tick_out :  std_logic;
47
        SIGNAL pseqstate_out :  std_logic_vector(3 downto 0);
48
        SIGNAL all_on :  std_logic;
49
        SIGNAL all_pgood :  std_logic;
50
 
51
BEGIN
52
 
53
        uut: powerseq_mod PORT MAP(
54
                clk => clk,
55
                reset_n => reset_n,
56
                forcepoweron => forcepoweron,
57
                PSEQ_RAIL_EN => PSEQ_RAIL_EN,
58
                PSEQ_RAIL_PG => PSEQ_RAIL_PG,
59
                thermal_n => thermal_n,
60
                failed_rails => failed_rails,
61
                pfailure => pfailure,
62
                tick_out => tick_out,
63
                pseqstate_out => pseqstate_out,
64
                all_on => all_on,
65
                all_pgood => all_pgood
66
        );
67
 
68
 
69
-- *** Test Bench - User Defined Section ***
70
 
71
  ckp: process begin
72
    clk <= not clk; wait for (clk_per/2);
73
  end process;
74
 
75
 
76
   tb : PROCESS
77
   BEGIN
78
 
79
    -- signal assertion sequence, manual edit
80
reset_n   <= '0';
81
forcepoweron <= '0';
82
thermal_n <= '1';
83
PSEQ_RAIL_PG(5 downto 0) <= (others => '0');
84
PSEQ_RAIL_PG(127 downto 6) <= (others => '1');
85
all_on <= '0';
86
wait for (50*clk_per);
87
reset_n    <= '1';
88
wait for (50*clk_per);
89
all_on <= '1';
90
wait for (50*clk_per);
91
PSEQ_RAIL_PG(0) <= '1';
92
wait for (50*clk_per);
93
PSEQ_RAIL_PG(1) <= '1';
94
wait for (50*clk_per);
95
PSEQ_RAIL_PG(2) <= '1';
96
wait for (50*clk_per);
97
PSEQ_RAIL_PG(3) <= '1';
98
wait for (50*clk_per);
99
PSEQ_RAIL_PG(4) <= '1';
100
wait for (50*clk_per);
101
PSEQ_RAIL_PG(5) <= '1';
102
wait for (50*clk_per);
103
 
104
--# ordered seq down:
105
wait for (100us);
106
all_on <= '0';
107
wait for (100 us);
108
all_on <= '1';
109
 
110
--# thermal fault and recovery:
111
--wait for (100us);
112
--thermal_n <= '0';
113
--wait for (50*clk_per);
114
--thermal_n <= '1';
115
--wait for (50*clk_per);
116
--all_on <= '0';
117
--wait for (50*clk_per);
118
--all_on <= '1';
119
 
120
--# rail fault in S0 and recovery:
121
--wait for (100us);
122
--PSEQ_RAIL_PG(5) <= '0';
123
--wait for (50*clk_per);
124
--PSEQ_RAIL_PG(5) <= '1';
125
--wait for (50*clk_per);
126
--all_on <= '0';
127
--wait for (50*clk_per);
128
--all_on <= '1';
129
 
130
 
131
      wait; -- will wait forever
132
   END PROCESS;
133
-- *** End Test Bench - User Defined Section ***
134
 
135
END;

powered by: WebSVN 2.1.0

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