1 |
2 |
buenos |
----------------------------------------------------------------------------------
|
2 |
|
|
-- Engineer: Istvan Nagy
|
3 |
|
|
-- Create Date: 10/06/2024 10:10:13 AM
|
4 |
|
|
-- License: 0BSD, no restrictions for use, no need to publish modified versions.
|
5 |
|
|
-- The BSD 0-clause license: Copyright (C) 2024 by Istvan Nagy buenoshun@gmail.com
|
6 |
|
|
-- Permission to use, copy, modify, and/or distribute this software for any purpose
|
7 |
|
|
-- with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND
|
8 |
|
|
-- THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE.
|
9 |
|
|
-- Module Name: example - Behavioral
|
10 |
|
|
-- Target devices: Michorchip Igloo preferred
|
11 |
|
|
-- This code shows how a sequencer is typically used on a complex server motherboard.
|
12 |
|
|
-- This code would be instantiated into a FPGA top level VHDL file, that has other
|
13 |
|
|
-- logic too, that are not power management related. Signals coming from the X86 and
|
14 |
|
|
-- the BMC should be double-flopped on the top-level FPGA code file.
|
15 |
|
|
-- Each power domain needs a separate powerseq block instantiated here.
|
16 |
|
|
-- On your board the rail assignments will be totally different! Do not reuse as is!
|
17 |
|
|
-- For every project this file is to be heavily modified or completely rewritten. This
|
18 |
|
|
-- is not the main reusable open source powerseq code, just an example use case.
|
19 |
|
|
-- Synthesis statistics: 2992 LUTs, and 1167 register bits
|
20 |
|
|
----------------------------------------------------------------------------------
|
21 |
|
|
library IEEE;
|
22 |
|
|
use IEEE.STD_LOGIC_1164.ALL;
|
23 |
|
|
use IEEE.NUMERIC_STD.ALL;
|
24 |
|
|
library IEEE;
|
25 |
|
|
use IEEE.STD_LOGIC_1164.ALL;
|
26 |
|
|
use IEEE.STD_LOGIC_ARITH.ALL;
|
27 |
|
|
use IEEE.STD_LOGIC_UNSIGNED.ALL;
|
28 |
|
|
--entity header ----------------------------------------------------------------
|
29 |
|
|
entity example is
|
30 |
|
|
Port (
|
31 |
|
|
--System signals for FPGA glue logic
|
32 |
|
|
clk : in std_logic; --25MHz clock
|
33 |
|
|
reset_n : in std_logic; --FPGA reset, needs 1ms from standby 3.3V on
|
34 |
|
|
forcepoweron : in std_logic; --from dip switch, avoid failure response
|
35 |
|
|
pfailure : out std_logic; --assers during failure --1 if one or more railes failed.
|
36 |
|
|
pseqstate_out : out std_logic_vector(7 downto 0); --we can monitor status through a pin with TopJtag
|
37 |
|
|
ALL_PWR_ON_LED_N : out std_logic;
|
38 |
|
|
PWRFAIL_LED_N : out std_logic;
|
39 |
|
|
--rails:
|
40 |
|
|
--BMC POWER RAILS
|
41 |
|
|
VCC_BMC_1V0_ON : out std_logic;
|
42 |
|
|
VCC_BMC_1V0_PG : in std_logic;
|
43 |
|
|
VCC_BMC_1V5_ON : out std_logic;
|
44 |
|
|
VCC_BMC_1V5_PG : in std_logic;
|
45 |
|
|
--PCH POWER RAILS CONTROL
|
46 |
|
|
VCC_5V0_ENA : out std_logic;
|
47 |
|
|
VCC_5V0_PG : in std_logic;
|
48 |
|
|
P1V0_PCH_SBY_EN : out std_logic;
|
49 |
|
|
P1V0_PCH_SBY_PG : in std_logic;
|
50 |
|
|
P1V8_PCH_SBY_EN : out std_logic;
|
51 |
|
|
P1V8_PCH_SBY_PG : in std_logic;
|
52 |
|
|
P3V3_S0_EN : out std_logic;
|
53 |
|
|
P3V3_S0_PG : in std_logic;
|
54 |
|
|
P1V5_PCH_S0_EN : out std_logic;
|
55 |
|
|
P1V5_PCH_S0_PG : in std_logic;
|
56 |
|
|
P1V0_PCH_S0_EN : out std_logic;
|
57 |
|
|
P1V0_PCH_S0_PG : in std_logic;
|
58 |
|
|
--CPU POWER RAILS CONTROL
|
59 |
|
|
VCORECPU1_EN : out std_logic;
|
60 |
|
|
VCORECPU1_PG : in std_logic;
|
61 |
|
|
VCCSA_CPU1_EN : out std_logic;
|
62 |
|
|
VCCSA_CPU1_PG : in std_logic;
|
63 |
|
|
P1V5_CPU1_EN : out std_logic;
|
64 |
|
|
P1V5_CPU1_PG : in std_logic;
|
65 |
|
|
P1V05_CPU1_EN : out std_logic;
|
66 |
|
|
P1V05_CPU1_PG : in std_logic;
|
67 |
|
|
VCORECPU2_EN : out std_logic;
|
68 |
|
|
VCORECPU2_PG : in std_logic;
|
69 |
|
|
VCCSA_CPU2_EN : out std_logic;
|
70 |
|
|
VCCSA_CPU2_PG : in std_logic;
|
71 |
|
|
P1V5_CPU2_EN : out std_logic;
|
72 |
|
|
P1V5_CPU2_PG : in std_logic;
|
73 |
|
|
P1V05_CPU2_EN : out std_logic;
|
74 |
|
|
P1V05_CPU2_PG : in std_logic;
|
75 |
|
|
--Other device POWER RAILS CONTROL
|
76 |
|
|
PSU_ON : out std_logic;
|
77 |
|
|
PSU12V_PG : in std_logic;
|
78 |
|
|
P1V8_SSD_EN : out std_logic;
|
79 |
|
|
P1V8_SSD_PG : in std_logic;
|
80 |
|
|
P1V2_SSD_EN : out std_logic;
|
81 |
|
|
P1V2_SSD_PG : in std_logic;
|
82 |
|
|
--PCH POWER MANAGEMENT GLUE LOGIC
|
83 |
|
|
PCH_RSMRST_N : out std_logic;
|
84 |
|
|
CPU1_PROCHOT_N : in std_logic;
|
85 |
|
|
CPU1_THERMTRIP_N : in std_logic;
|
86 |
|
|
CPU1_CATERR_N : in std_logic;
|
87 |
|
|
CPU2_PROCHOT_N : in std_logic;
|
88 |
|
|
CPU2_THERMTRIP_N : in std_logic;
|
89 |
|
|
CPU2_CATERR_N : in std_logic;
|
90 |
|
|
CKG_PLL_LOCK : in std_logic;
|
91 |
|
|
CKG_CLKEN : out std_logic;
|
92 |
|
|
PCH_PWRBTN_N : out std_logic;
|
93 |
|
|
PCH_CPUPWRGD : out std_logic;
|
94 |
|
|
PCH_DRAMPWRGD : out std_logic;
|
95 |
|
|
PCH_PWROK : out std_logic;
|
96 |
|
|
PCH_RSTBTN_N : out std_logic;
|
97 |
|
|
PCH_SLPS3_N : in std_logic;
|
98 |
|
|
PCH_SLPS5_N : in std_logic;
|
99 |
|
|
PCH_SLPS4_N : in std_logic;
|
100 |
|
|
PCH_SYSPWROK : out std_logic;
|
101 |
|
|
PLTRST_N : in std_logic;
|
102 |
|
|
--POWER MASTER BMC LOGIC
|
103 |
|
|
PENA_ALL_BMC : in std_logic; --power master ordered the sequence to commence on
|
104 |
|
|
PGD_ALL_BMC : out std_logic; --tell the power master that all is on
|
105 |
|
|
BMC_TO_CPU_RST_N : in std_logic;
|
106 |
|
|
BMC_RST_N : out std_logic; --reset
|
107 |
|
|
--other
|
108 |
|
|
RST_SSD_N : out std_logic;
|
109 |
|
|
RST_PCIESLT1_N : out std_logic;
|
110 |
|
|
RST_PCIESLT2_N : out std_logic;
|
111 |
|
|
RST_PCIESLT3_N : out std_logic;
|
112 |
|
|
RST_PCIESLT4_N : out std_logic;
|
113 |
|
|
MEMA_THERM_N : in std_logic;
|
114 |
|
|
MEMB_THERM_N : in std_logic;
|
115 |
|
|
MEMC_THERM_N : in std_logic;
|
116 |
|
|
MEMD_THERM_N : in std_logic
|
117 |
|
|
);
|
118 |
|
|
end example;
|
119 |
|
|
|
120 |
|
|
--architecture start ------------------------------------------------------------
|
121 |
|
|
architecture Behavioral of example is
|
122 |
|
|
|
123 |
|
|
-- INTERNAL SIGNALS -------------------------------------------------------------
|
124 |
|
|
|
125 |
|
|
SIGNAL PSEQ_RAIL_PGa : std_logic_vector(127 downto 0); --map to rails
|
126 |
|
|
SIGNAL PSEQ_RAIL_ENa : std_logic_vector(127 downto 0); --map to rails
|
127 |
|
|
SIGNAL failed_railsa : std_logic_vector(255 downto 0); --bits=1 for failed rails
|
128 |
|
|
SIGNAL tick_outa : std_logic; --available if needed outside, 1pulse in every several thousand clk
|
129 |
|
|
SIGNAL PSEQ_RAIL_PGb : std_logic_vector(127 downto 0); --map to rails
|
130 |
|
|
SIGNAL PSEQ_RAIL_ENb : std_logic_vector(127 downto 0); --map to rails
|
131 |
|
|
SIGNAL failed_railsb : std_logic_vector(255 downto 0); --bits=1 for failed rails
|
132 |
|
|
SIGNAL pfailurea : std_logic;
|
133 |
|
|
SIGNAL pfailureb : std_logic;
|
134 |
|
|
SIGNAL tick_outb : std_logic; --available if needed outside, 1pulse in every several thousand clk
|
135 |
|
|
SIGNAL thermal_na : std_logic;
|
136 |
|
|
SIGNAL pseqstate_outa : std_logic_vector(3 downto 0);
|
137 |
|
|
SIGNAL all_pgooda : std_logic;
|
138 |
|
|
SIGNAL all_ona : std_logic;
|
139 |
|
|
SIGNAL thermal_nb : std_logic;
|
140 |
|
|
SIGNAL pseqstate_outb : std_logic_vector(3 downto 0);
|
141 |
|
|
SIGNAL all_pgoodb : std_logic;
|
142 |
|
|
SIGNAL all_onb : std_logic;
|
143 |
|
|
SIGNAL dummy1 : std_logic;
|
144 |
|
|
SIGNAL PCH_RSTBTN_N1 : std_logic;
|
145 |
|
|
SIGNAL x86_state : std_logic_vector(2 downto 0);
|
146 |
|
|
SIGNAL delaysig_out1 : std_logic;
|
147 |
|
|
SIGNAL delaysig_in1 : std_logic;
|
148 |
|
|
SIGNAL delaycounter1 : std_logic_vector(19 downto 0);
|
149 |
|
|
SIGNAL delaysig_out2 : std_logic;
|
150 |
|
|
SIGNAL delaysig_in2 : std_logic;
|
151 |
|
|
SIGNAL delaycounter2 : std_logic_vector(19 downto 0);
|
152 |
|
|
SIGNAL delaysig_out3 : std_logic;
|
153 |
|
|
SIGNAL delaysig_in3 : std_logic;
|
154 |
|
|
SIGNAL delaycounter3 : std_logic_vector(23 downto 0);
|
155 |
|
|
SIGNAL delaysig_out4 : std_logic;
|
156 |
|
|
SIGNAL delaysig_in4 : std_logic;
|
157 |
|
|
SIGNAL delaycounter4 : std_logic_vector(19 downto 0);
|
158 |
|
|
SIGNAL delaysig_out5 : std_logic;
|
159 |
|
|
SIGNAL delaysig_in5 : std_logic;
|
160 |
|
|
SIGNAL delaycounter5 : std_logic_vector(19 downto 0);
|
161 |
|
|
|
162 |
|
|
|
163 |
|
|
--------- COMPONENT DECLARATIONS (introducing the IPs) --------------------------
|
164 |
|
|
COMPONENT pseq_3redundant
|
165 |
|
|
PORT(
|
166 |
|
|
clk : IN std_logic;
|
167 |
|
|
reset_n : IN std_logic;
|
168 |
|
|
forcepoweron : IN std_logic;
|
169 |
|
|
PSEQ_RAIL_PG : IN std_logic_vector(127 downto 0);
|
170 |
|
|
thermal_n : IN std_logic;
|
171 |
|
|
all_on : IN std_logic;
|
172 |
|
|
PSEQ_RAIL_EN : OUT std_logic_vector(127 downto 0);
|
173 |
|
|
failed_rails : OUT std_logic_vector(255 downto 0);
|
174 |
|
|
pfailure : OUT std_logic;
|
175 |
|
|
tick_out : OUT std_logic;
|
176 |
|
|
pseqstate_out : OUT std_logic_vector(3 downto 0);
|
177 |
|
|
all_pgood : OUT std_logic
|
178 |
|
|
);
|
179 |
|
|
END COMPONENT;
|
180 |
|
|
|
181 |
|
|
|
182 |
|
|
|
183 |
|
|
--architecture body start -------------------------------------------------------
|
184 |
|
|
begin
|
185 |
|
|
|
186 |
|
|
|
187 |
|
|
--First sequencer for S5 standby power domain rails: #############################
|
188 |
|
|
--This just turns on as soon as possible, not controlled
|
189 |
|
|
--Trying to follow this sequence:
|
190 |
|
|
--1v5_bmc -> 1v0_bmc -> 1v8_pch_sby -> 1v0_pch_sby -> rsmrst
|
191 |
|
|
|
192 |
|
|
Inst_pseq_3redundanta: pseq_3redundant PORT MAP(
|
193 |
|
|
clk => clk,
|
194 |
|
|
reset_n => reset_n,
|
195 |
|
|
forcepoweron => forcepoweron,
|
196 |
|
|
PSEQ_RAIL_EN => PSEQ_RAIL_ENa,
|
197 |
|
|
PSEQ_RAIL_PG => PSEQ_RAIL_PGa,
|
198 |
|
|
thermal_n => thermal_na,
|
199 |
|
|
failed_rails => failed_railsa,
|
200 |
|
|
pfailure => pfailurea,
|
201 |
|
|
tick_out => tick_outa,
|
202 |
|
|
pseqstate_out => pseqstate_outa,
|
203 |
|
|
all_on => '1', --always on
|
204 |
|
|
all_pgood => dummy1
|
205 |
|
|
);
|
206 |
|
|
|
207 |
|
|
-- Rail assignments:
|
208 |
|
|
--enables
|
209 |
|
|
VCC_BMC_1V5_ON <= PSEQ_RAIL_ENa(0);
|
210 |
|
|
VCC_BMC_1V0_ON <= PSEQ_RAIL_ENa(1);
|
211 |
|
|
P1V8_PCH_SBY_EN <= PSEQ_RAIL_ENa(2);
|
212 |
|
|
P1V0_PCH_SBY_EN <= PSEQ_RAIL_ENa(3);
|
213 |
|
|
delaysig_in1 <= PSEQ_RAIL_ENa(4);
|
214 |
|
|
-- <= PSEQ_RAIL_ENa(127 downto 5); unused
|
215 |
|
|
--powergood
|
216 |
|
|
PSEQ_RAIL_PGa(0) <= VCC_BMC_1V5_PG;
|
217 |
|
|
PSEQ_RAIL_PGa(1) <= VCC_BMC_1V0_PG;
|
218 |
|
|
PSEQ_RAIL_PGa(2) <= P1V8_PCH_SBY_PG;
|
219 |
|
|
PSEQ_RAIL_PGa(3) <= P1V0_PCH_SBY_PG;
|
220 |
|
|
PSEQ_RAIL_PGa(4) <= delaysig_out1;
|
221 |
|
|
PSEQ_RAIL_PGa(127 downto 5) <= (others => '1'); --unused
|
222 |
|
|
|
223 |
|
|
--system signals for seq 1:
|
224 |
|
|
thermal_na <= '1'; --not used in this power domain
|
225 |
|
|
|
226 |
|
|
--simple DELAY1:
|
227 |
|
|
process ( reset_n, clk, delaysig_in1 )
|
228 |
|
|
begin
|
229 |
|
|
if ( reset_n='0' or delaysig_in1='0') then
|
230 |
|
|
delaysig_out1 <= '0';
|
231 |
|
|
delaycounter1 <= (others => '0');
|
232 |
|
|
elsif (clk'event and clk='1') then
|
233 |
|
|
if ( delaycounter1 = "01111010000100100000" ) then --after 20msec (40ns clk period)
|
234 |
|
|
delaysig_out1 <= '1';
|
235 |
|
|
delaycounter1 <= delaycounter1; --stop counting
|
236 |
|
|
else
|
237 |
|
|
delaycounter1 <= delaycounter1 +1;
|
238 |
|
|
delaysig_out1 <= '0';
|
239 |
|
|
end if;
|
240 |
|
|
end if;
|
241 |
|
|
end process;
|
242 |
|
|
|
243 |
|
|
BMC_RST_N <= delaysig_out1; --we can let them know 20ms after all power is good to come out of reset
|
244 |
|
|
PCH_RSMRST_N <= delaysig_out1;
|
245 |
|
|
|
246 |
|
|
|
247 |
|
|
|
248 |
|
|
--Second sequencer for S0 fully-on power domain rails: #############################
|
249 |
|
|
--this one turns on or off as the BMC commands it.
|
250 |
|
|
--Trying to follow this sequence:
|
251 |
|
|
--12v -> 5v -> 3.3v -> PCH1v5 -> PCH1v0 -> 1v5mem -> drampwrgd -> 1v0cpu -> vcorecpu -> vccsacpu -> 100ms -> pchpwrok -> plllock -> 20ms -> cpupwrgd -> 20ms -> syspwrok
|
252 |
|
|
|
253 |
|
|
Inst_pseq_3redundantb: pseq_3redundant PORT MAP(
|
254 |
|
|
clk => clk,
|
255 |
|
|
reset_n => reset_n,
|
256 |
|
|
forcepoweron => forcepoweron,
|
257 |
|
|
PSEQ_RAIL_EN => PSEQ_RAIL_ENb,
|
258 |
|
|
PSEQ_RAIL_PG => PSEQ_RAIL_PGb,
|
259 |
|
|
thermal_n => thermal_nb,
|
260 |
|
|
failed_rails => failed_railsb,
|
261 |
|
|
pfailure => pfailureb,
|
262 |
|
|
tick_out => tick_outb,
|
263 |
|
|
pseqstate_out => pseqstate_outb,
|
264 |
|
|
all_on => all_onb,
|
265 |
|
|
all_pgood => all_pgoodb
|
266 |
|
|
);
|
267 |
|
|
|
268 |
|
|
-- Rail assignments:
|
269 |
|
|
--enables
|
270 |
|
|
PSU_ON <= PSEQ_RAIL_ENb(0);
|
271 |
|
|
VCC_5V0_ENA <= PSEQ_RAIL_ENb(1);
|
272 |
|
|
P3V3_S0_EN <= PSEQ_RAIL_ENb(2);
|
273 |
|
|
P1V5_PCH_S0_EN <= PSEQ_RAIL_ENb(3);
|
274 |
|
|
P1V0_PCH_S0_EN <= PSEQ_RAIL_ENb(4);
|
275 |
|
|
P1V5_CPU1_EN <= PSEQ_RAIL_ENb(5);
|
276 |
|
|
P1V5_CPU2_EN <= PSEQ_RAIL_ENb(6);
|
277 |
|
|
PCH_DRAMPWRGD <= PSEQ_RAIL_ENb(7);
|
278 |
|
|
VCORECPU1_EN <= PSEQ_RAIL_ENb(8);
|
279 |
|
|
VCORECPU2_EN <= PSEQ_RAIL_ENb(9);
|
280 |
|
|
VCCSA_CPU1_EN <= PSEQ_RAIL_ENb(10);
|
281 |
|
|
VCCSA_CPU2_EN <= PSEQ_RAIL_ENb(11);
|
282 |
|
|
delaysig_in3 <= PSEQ_RAIL_ENb(12);
|
283 |
|
|
PCH_PWROK <= PSEQ_RAIL_ENb(13);
|
284 |
|
|
CKG_CLKEN <= PSEQ_RAIL_ENb(14);
|
285 |
|
|
delaysig_in4 <= PSEQ_RAIL_ENb(15);
|
286 |
|
|
PCH_CPUPWRGD <= PSEQ_RAIL_ENb(16);
|
287 |
|
|
delaysig_in5 <= PSEQ_RAIL_ENb(17);
|
288 |
|
|
PCH_SYSPWROK <= PSEQ_RAIL_ENb(18);
|
289 |
|
|
-- <= PSEQ_RAIL_ENb(127 downto 19); unused
|
290 |
|
|
--powergood
|
291 |
|
|
PSEQ_RAIL_PGb(0) <= PSU12V_PG;
|
292 |
|
|
PSEQ_RAIL_PGb(1) <= VCC_5V0_PG;
|
293 |
|
|
PSEQ_RAIL_PGb(2) <= P3V3_S0_PG;
|
294 |
|
|
PSEQ_RAIL_PGb(3) <= P1V5_PCH_S0_PG;
|
295 |
|
|
PSEQ_RAIL_PGb(4) <= P1V0_PCH_S0_PG;
|
296 |
|
|
PSEQ_RAIL_PGb(5) <= P1V5_CPU1_PG;
|
297 |
|
|
PSEQ_RAIL_PGb(6) <= P1V5_CPU2_PG;
|
298 |
|
|
PSEQ_RAIL_PGb(7) <= '1';
|
299 |
|
|
PSEQ_RAIL_PGb(8) <= VCORECPU1_PG;
|
300 |
|
|
PSEQ_RAIL_PGb(9) <= VCORECPU2_PG;
|
301 |
|
|
PSEQ_RAIL_PGb(10) <= VCCSA_CPU1_PG;
|
302 |
|
|
PSEQ_RAIL_PGb(11) <= VCCSA_CPU2_PG;
|
303 |
|
|
PSEQ_RAIL_PGb(12) <= delaysig_out3;
|
304 |
|
|
PSEQ_RAIL_PGb(13) <= '1';
|
305 |
|
|
PSEQ_RAIL_PGb(14) <= CKG_PLL_LOCK;
|
306 |
|
|
PSEQ_RAIL_PGb(15) <= delaysig_out4;
|
307 |
|
|
PSEQ_RAIL_PGb(16) <= '1';
|
308 |
|
|
PSEQ_RAIL_PGb(17) <= delaysig_out5;
|
309 |
|
|
PSEQ_RAIL_PGb(18) <= '1';
|
310 |
|
|
PSEQ_RAIL_PGb(127 downto 19) <= (others => '1'); --unused
|
311 |
|
|
|
312 |
|
|
--system signals for seq 2:
|
313 |
|
|
thermal_nb <= CPU1_PROCHOT_N AND CPU1_THERMTRIP_N AND CPU1_CATERR_N
|
314 |
|
|
AND CPU2_PROCHOT_N AND CPU2_THERMTRIP_N AND CPU2_CATERR_N
|
315 |
|
|
AND MEMA_THERM_N AND MEMB_THERM_N AND MEMC_THERM_N AND MEMD_THERM_N; --if any of these pulses low, we do a thermal shutdown in S0
|
316 |
|
|
|
317 |
|
|
--simple DELAY3:
|
318 |
|
|
process ( reset_n, clk, delaysig_in3 )
|
319 |
|
|
begin
|
320 |
|
|
if ( reset_n='0' or delaysig_in3='0') then
|
321 |
|
|
delaysig_out3 <= '0';
|
322 |
|
|
delaycounter3 <= (others => '0');
|
323 |
|
|
elsif (clk'event and clk='1') then
|
324 |
|
|
if ( delaycounter3 = "001001100010010110100000" ) then --after 100msec (40ns clk period)
|
325 |
|
|
delaysig_out3 <= '1';
|
326 |
|
|
delaycounter3 <= delaycounter3; --stop counting
|
327 |
|
|
else
|
328 |
|
|
delaycounter3 <= delaycounter3 +1;
|
329 |
|
|
delaysig_out3 <= '0';
|
330 |
|
|
end if;
|
331 |
|
|
end if;
|
332 |
|
|
end process;
|
333 |
|
|
|
334 |
|
|
--simple DELAY4:
|
335 |
|
|
process ( reset_n, clk, delaysig_in4 )
|
336 |
|
|
begin
|
337 |
|
|
if ( reset_n='0' or delaysig_in4='0') then
|
338 |
|
|
delaysig_out4 <= '0';
|
339 |
|
|
delaycounter4 <= (others => '0');
|
340 |
|
|
elsif (clk'event and clk='1') then
|
341 |
|
|
if ( delaycounter4 = "01111010000100100000" ) then --after 20msec (40ns clk period)
|
342 |
|
|
delaysig_out4 <= '1';
|
343 |
|
|
delaycounter4 <= delaycounter4; --stop counting
|
344 |
|
|
else
|
345 |
|
|
delaycounter4 <= delaycounter4 +1;
|
346 |
|
|
delaysig_out4 <= '0';
|
347 |
|
|
end if;
|
348 |
|
|
end if;
|
349 |
|
|
end process;
|
350 |
|
|
|
351 |
|
|
--simple DELAY5:
|
352 |
|
|
process ( reset_n, clk, delaysig_in5 )
|
353 |
|
|
begin
|
354 |
|
|
if ( reset_n='0' or delaysig_in5='0') then
|
355 |
|
|
delaysig_out5 <= '0';
|
356 |
|
|
delaycounter5 <= (others => '0');
|
357 |
|
|
elsif (clk'event and clk='1') then
|
358 |
|
|
if ( delaycounter5 = "01111010000100100000" ) then --after 20msec (40ns clk period)
|
359 |
|
|
delaysig_out5 <= '1';
|
360 |
|
|
delaycounter5 <= delaycounter5; --stop counting
|
361 |
|
|
else
|
362 |
|
|
delaycounter5 <= delaycounter5 +1;
|
363 |
|
|
delaysig_out5 <= '0';
|
364 |
|
|
end if;
|
365 |
|
|
end if;
|
366 |
|
|
end process;
|
367 |
|
|
|
368 |
|
|
|
369 |
|
|
|
370 |
|
|
--X86 Chipset power managment Interface #############################
|
371 |
|
|
--This handles the powerbutton, as well as talks to the BMC and sequencer2
|
372 |
|
|
--Chain: BMC-->thisprocess-->chipset-->seq2-->VRMs
|
373 |
|
|
--It does not support sleep states
|
374 |
|
|
--BMC Software requires discipline: wait 1sec between turn off and turn on.
|
375 |
|
|
process (reset_n, clk)
|
376 |
|
|
begin
|
377 |
|
|
if (reset_n='1') then
|
378 |
|
|
delaysig_in2 <= '0';
|
379 |
|
|
all_onb <= '0';
|
380 |
|
|
x86_state <= (others => '0');
|
381 |
|
|
PCH_PWRBTN_N <= 'Z';
|
382 |
|
|
PGD_ALL_BMC <= '0';
|
383 |
|
|
else
|
384 |
|
|
if (clk'event and clk = '1') then
|
385 |
|
|
case ( x86_state ) is
|
386 |
|
|
|
387 |
|
|
when "000" => --chipset standby s5
|
388 |
|
|
all_onb <= '0';
|
389 |
|
|
PGD_ALL_BMC <= '0';
|
390 |
|
|
if (PENA_ALL_BMC='1') then --BMC ordered power up
|
391 |
|
|
x86_state <= "001";
|
392 |
|
|
delaysig_in2 <= '1'; --start 20ms delay
|
393 |
|
|
PCH_PWRBTN_N <= '0'; --assert power button
|
394 |
|
|
else
|
395 |
|
|
delaysig_in2 <= '0';
|
396 |
|
|
PCH_PWRBTN_N <= 'Z';
|
397 |
|
|
end if;
|
398 |
|
|
|
399 |
|
|
when "001" => --powerup powerbutton pressing
|
400 |
|
|
if (delaysig_out2='1') then --button was pressed for 20ms
|
401 |
|
|
x86_state <= "010";
|
402 |
|
|
delaysig_in2 <= '0';
|
403 |
|
|
PCH_PWRBTN_N <= 'Z'; --release it
|
404 |
|
|
end if;
|
405 |
|
|
|
406 |
|
|
when "010" => --powerup sequence
|
407 |
|
|
if (PCH_SLPS3_N='1') then --chipset asserted SLP_S3 high
|
408 |
|
|
all_onb <= '1'; --start the sequncer2
|
409 |
|
|
end if;
|
410 |
|
|
if (all_pgoodb='1') then --sequncer2 completed up
|
411 |
|
|
x86_state <= "011";
|
412 |
|
|
end if;
|
413 |
|
|
|
414 |
|
|
when "011" => --chipset fully on
|
415 |
|
|
PGD_ALL_BMC <= '1';
|
416 |
|
|
if (PENA_ALL_BMC='0') then --BMC turned off the power
|
417 |
|
|
x86_state <= "100";
|
418 |
|
|
delaysig_in2 <= '1';
|
419 |
|
|
PCH_PWRBTN_N <= '0'; --assert power button
|
420 |
|
|
end if;
|
421 |
|
|
|
422 |
|
|
when "100" => --powerdown powerbutton pressing
|
423 |
|
|
PGD_ALL_BMC <= '0';
|
424 |
|
|
if (delaysig_out2='1') then --button was pressed for 20ms
|
425 |
|
|
x86_state <= "101";
|
426 |
|
|
delaysig_in2 <= '0';
|
427 |
|
|
PCH_PWRBTN_N <= 'Z'; --release it
|
428 |
|
|
end if;
|
429 |
|
|
|
430 |
|
|
when "101" => --powerdown sequence
|
431 |
|
|
if (PCH_SLPS3_N='0') then --chipset asserted SLP_S3 low/off
|
432 |
|
|
all_onb <= '0'; --start the sequncer2 down
|
433 |
|
|
end if;
|
434 |
|
|
if (all_pgoodb='0') then --sequncer2 completed down
|
435 |
|
|
x86_state <= "000"; --go back to standby
|
436 |
|
|
end if;
|
437 |
|
|
|
438 |
|
|
when others => --error
|
439 |
|
|
x86_state <= "000"; --go to state 0
|
440 |
|
|
all_onb <= '0';
|
441 |
|
|
end case;
|
442 |
|
|
end if;
|
443 |
|
|
end if;
|
444 |
|
|
end process;
|
445 |
|
|
|
446 |
|
|
--simple DELAY2:
|
447 |
|
|
process ( reset_n, clk, delaysig_in2 )
|
448 |
|
|
begin
|
449 |
|
|
if ( reset_n='0' or delaysig_in2='0') then
|
450 |
|
|
delaysig_out2 <= '0';
|
451 |
|
|
delaycounter2 <= (others => '0');
|
452 |
|
|
elsif (clk'event and clk='1') then
|
453 |
|
|
if ( delaycounter2 = "01111010000100100000" ) then --after 20msec (40ns clk period)
|
454 |
|
|
delaysig_out2 <= '1';
|
455 |
|
|
delaycounter2 <= delaycounter2; --stop counting
|
456 |
|
|
else
|
457 |
|
|
delaycounter2 <= delaycounter2 +1;
|
458 |
|
|
delaysig_out2 <= '0';
|
459 |
|
|
end if;
|
460 |
|
|
end if;
|
461 |
|
|
end process;
|
462 |
|
|
|
463 |
|
|
|
464 |
|
|
|
465 |
|
|
-- RESETS AND OTHER STUFF #############################
|
466 |
|
|
|
467 |
|
|
PCH_RSTBTN_N1 <= BMC_TO_CPU_RST_N AND VCORECPU1_PG AND VCORECPU2_PG AND P1V0_PCH_S0_PG AND P3V3_S0_PG;
|
468 |
|
|
process ( PCH_RSTBTN_N1 ) --3state buffer
|
469 |
|
|
begin
|
470 |
|
|
if (PCH_RSTBTN_N1='1') then PCH_RSTBTN_N <= 'Z';
|
471 |
|
|
else PCH_RSTBTN_N <= '0';
|
472 |
|
|
end if;
|
473 |
|
|
end process;
|
474 |
|
|
|
475 |
|
|
RST_SSD_N <= PLTRST_N AND P3V3_S0_PG AND P1V8_SSD_PG AND P1V2_SSD_PG;
|
476 |
|
|
RST_PCIESLT1_N <= PLTRST_N AND P3V3_S0_PG;
|
477 |
|
|
RST_PCIESLT2_N <= PLTRST_N AND P3V3_S0_PG;
|
478 |
|
|
RST_PCIESLT3_N <= PLTRST_N AND P3V3_S0_PG;
|
479 |
|
|
RST_PCIESLT4_N <= PLTRST_N AND P3V3_S0_PG;
|
480 |
|
|
|
481 |
|
|
|
482 |
|
|
-- Other stuff:
|
483 |
|
|
pseqstate_out(7 downto 4) <= pseqstate_outa;
|
484 |
|
|
pseqstate_out(3 downto 0) <= pseqstate_outb;
|
485 |
|
|
ALL_PWR_ON_LED_N <= NOT (all_pgooda AND all_pgoodb);
|
486 |
|
|
PWRFAIL_LED_N <= NOT (pfailurea OR pfailureb);
|
487 |
|
|
pfailure <= pfailurea OR pfailureb;
|
488 |
|
|
|
489 |
|
|
|
490 |
|
|
--end file ----------------------------------------------------------------------
|
491 |
|
|
end Behavioral;
|