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

Subversion Repositories powersupplysequencer

[/] [powersupplysequencer/] [vhdl/] [msi/] [PowerSequencer/] [PowerSequencer_tb.vhd] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 dk4xp
-- Test bed for power sequencer slice
2
 
3
-- (c) 2009.. Gerhard Hoffmann  opencores@hoffmann-hochfrequenz.de
4
-- Published under BSD license
5
-- V1.0   first published version
6
--
7
-- 3 sequencer slices and 3 simulated power supplies are connected together.
8
--
9
-- A power-up --> normal operation --> power-down is performed.
10
--
11
-- Then there is another power-up --> normal operation cycle that is
12
-- aborted when the middle power supply decides to run too hot at t = 70 msec.
13
 
14
 
15
library IEEE;
16
use IEEE.STD_LOGIC_1164.ALL;
17
use IEEE.numeric_std.all;
18
 
19
 
20
 
21
entity PowerSequencer_tb is end entity PowerSequencer_tb;
22
 
23
 
24
architecture tb of PowerSequencer_tb is
25
 
26
        constant ticks:             integer := 30; -- Power supplies must be up within 30 10KHz clock cycles
27
 
28
        signal clk, rst:            std_logic;
29
 
30
        signal ps1_defective:       boolean;
31
        signal ps2_defective:       boolean;
32
        signal ps3_defective:       boolean;
33
 
34
        signal power_up:            std_logic;                        -- the mains switch
35
        signal all_power_good:      std_logic;                        -- the green power lamp
36
 
37
        signal ena_stage2, ena_stage3:                    std_logic;  -- mains switch for the slaves
38
        signal fail_chain123, fail_chain23, fail_chain3:  std_logic;  -- fail outputs of the groups
39
        signal pu_chain123, pu_chain23, pu_chain3:        std_logic;  -- power up status of the groups
40
        signal vout1, vout2, vout3:                       real;       -- output voltages of the supplies
41
 
42
        signal ena_supply1:                    std_logic;
43
        signal supply1good:                          std_logic;
44
 
45
        signal ena_supply2:                    std_logic;
46
        signal supply2good:                          std_logic;
47
 
48
        signal ena_supply3:                    std_logic;
49
        signal supply3good:                          std_logic;
50
 
51
begin
52
 
53
 
54
uck: entity work.clk_rst    -- standard clock and reset source
55
 
56
  generic map(
57
    clock_frequency   => 10.0e3,   -- 10 KHz
58
    min_resetwidth    => 5 ms,
59
    verbose           => false
60
  )
61
 
62
  port map(
63
    clk               => clk,
64
    rst               => rst
65
  );
66
 
67
 
68
power_up            <= '0',
69
                       '1' after 10 ms,
70
                       '0' after 40 ms,
71
                       '1' after 70 ms,
72
                       '0' after 100 ms;
73
 
74
ps1_defective       <= false;
75
ps2_defective       <= false, true after 90 ms;
76
ps3_defective       <= false;
77
 
78
all_power_good      <= power_up and pu_chain123 and (not fail_chain123);
79
 
80
uPS1: entity work.PowerSequencer
81
generic map (
82
        ticks             => ticks,
83
        last_in_chain     => false
84
)
85
port map (
86
  clk               => clk,
87
  rst               => rst,
88
 
89
  ena_chain_async   => power_up,
90
  fail_chain_out    => fail_chain123,
91
  pu_chain_out      => pu_chain123,
92
 
93
  ena_next          => ena_stage2,
94
  fail_chain_in     => fail_chain23,
95
  pu_chain_ini      => pu_chain23,
96
 
97
  supply_enai       => ena_supply1,
98
  supply_good_async => supply1good
99
);
100
 
101
 
102
uPS2: entity work.PowerSequencer
103
generic map (
104
  ticks             => ticks,
105
  last_in_chain     => false
106
 
107
port map (
108
  clk               => clk,
109
  rst               => rst,
110
 
111
  ena_chain_async   => ena_stage2,
112
  fail_chain_out    => fail_chain23,
113
  pu_chain_out      => pu_chain23,
114
 
115
  ena_next          => ena_stage3,
116
  fail_chain_in     => fail_chain3,
117
  pu_chain_in       => pu_chain3,
118
 
119
  supply_ena        => ena_supply2,
120
  supply_good_async => supply2good
121
);
122
 
123
 
124
uPS3: entity work.PowerSequencer
125
generic map (
126
  ticks             => ticks,
127
  last_in_chain     => true
128
)
129
port map (
130
  clk               => clk,
131
  rst               => rst,
132
 
133
  ena_chain_async   => ena_stage3,
134
  fail_chain_out    => fail_chain3,
135
  pu_chain_out      => pu_chain3,
136
 
137
  ena_next          => open,
138
  fail_chain_in     => '0',
139
  pu_chain_in       => '0',
140
 
141
  supply_ena        => ena_supply3,
142
  supply_good_async => supply3good
143
);
144
 
145
-------------------------------------------------------------------------
146
 
147
 
148
usup1: entity work.powersupply
149
generic map (
150
  voltage           => 1.8,    -- volts
151
  risetime          => 2.0e-3  -- seconds
152
)
153
port map (
154
  defective         => ps1_defective,
155
  ena               => ena_supply1,
156
  pgood             => supply1good,
157
  vout              => vout1
158
);
159
 
160
 
161
usup2: entity work.powersupply
162
generic map (
163
  voltage           => 3.3,
164
  risetime          => 2.0e-3
165
)
166
port map(
167
  defective         => ps2_defective,
168
  ena               => ena_supply2,
169
  pgood             => supply2good,
170
  vout              => vout2
171
);
172
 
173
 
174
usup3:entity work.powersupply
175
generic map(
176
  voltage           => 1.1,
177
  risetime          => 2.0e-3
178
)
179
port map(
180
  defective         => ps3_defective,
181
  ena               => ena_supply3,
182
  pgood             => supply3good,
183
  vout              => vout3
184
);
185
 
186
end architecture tb;
187
 

powered by: WebSVN 2.1.0

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