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

Subversion Repositories powerseq

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 buenos
----------------------------------------------------------------------------------
2
-- Engineer: Istvan Nagy
3
-- Create Date: 10/06/2024 10:10:13 AM
4
---Version 1.0
5
-- License: 0BSD, no restrictions for use, no need to publish modified versions. 
6
--   The BSD 0-clause license: Copyright (C) 2024 by Istvan Nagy buenoshun@gmail.com 
7
--   Permission to use, copy, modify, and/or distribute this software for any purpose 
8
--   with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND 
9
--   THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE.
10
-- Module Name: example - Behavioral
11
-- Target devices: Microchip Igloo preferred, due to attributes.
12
-- This code shows how a sequencer is typically used on a simpler board.
13
-- Synthesis statistics: 489 registers, 1340 LUTs. 
14
----------------------------------------------------------------------------------
15
library IEEE;
16
use IEEE.STD_LOGIC_1164.ALL;
17
use IEEE.NUMERIC_STD.ALL;
18
library IEEE;
19
use IEEE.STD_LOGIC_1164.ALL;
20
use IEEE.STD_LOGIC_ARITH.ALL;
21
use IEEE.STD_LOGIC_UNSIGNED.ALL;
22
--entity header  ----------------------------------------------------------------
23
entity example is
24
    Port (
25
           clk  : in std_logic; --25MHz clock
26
           reset_n  : in std_logic; --FPGA reset, needs 1ms from standby 3.3V on
27
           forcepoweron  : in std_logic; --from dip switch, avoid failure response
28
           thermal_n : in std_logic; --thermal shutdown, externally combine multiple sources 
29
           pfailure : out std_logic; --assers during failure --1 if one or more railes failed.
30
           pseqstate_out  : out std_logic_vector(3 downto 0); --we can monitor status through a pin with TopJtag
31
           --rails:
32
           P3V3_EN : out std_logic;
33
           P2V5_EN : out std_logic;
34
           P1V8_EN : out std_logic;
35
           P1V5_EN : out std_logic;
36
           P1V2_EN : out std_logic;
37
           P1V0_CORE_EN : out std_logic;
38
           PCH_PWRGD : out std_logic; --glue logic output to chipset
39
           board_reset_n : out std_logic;
40
           P3V3_OK : in std_logic;
41
           P2V5_OK : in std_logic;
42
           P1V8_OK : in std_logic;
43
           P1V5_OK : in std_logic;
44
           P1V2_OK : in std_logic;
45
           P1V0_CORE_PGOOD : in std_logic;
46
           CK505_PLL_LOCK : in std_logic;
47
           --from IPMC or BMC:
48
           all_on  : in std_logic; --power master ordered the sequence to commence on
49
           all_pgood: out std_logic --tell the power master that all is on
50
           );
51
end example;
52
 
53
--architecture start ------------------------------------------------------------
54
architecture Behavioral of example is
55
 
56
-- INTERNAL SIGNALS -------------------------------------------------------------
57
 
58
           SIGNAL PSEQ_RAIL_PG :  std_logic_vector(127 downto 0); --map to rails
59
           SIGNAL PSEQ_RAIL_EN :  std_logic_vector(127 downto 0); --map to rails
60
           SIGNAL failed_rails :  std_logic_vector(255 downto 0); --bits=1 for failed rails
61
           SIGNAL tick_out :  std_logic; --available if needed outside, 1pulse in every several thousand clk
62
 
63
           SIGNAL delaysig_out1 :  std_logic;
64
           SIGNAL delaysig_in1  :  std_logic;
65
           SIGNAL delaycounter1  :  std_logic_vector(19 downto 0);
66
 
67
 
68
--------- COMPONENT DECLARATIONS (introducing the IPs) --------------------------
69
        COMPONENT pseq_3redundant
70
        PORT(
71
                clk : IN std_logic;
72
                reset_n : IN std_logic;
73
                forcepoweron : IN std_logic;
74
                PSEQ_RAIL_PG : IN std_logic_vector(127 downto 0);
75
                thermal_n : IN std_logic;
76
                all_on : IN std_logic;
77
                PSEQ_RAIL_EN : OUT std_logic_vector(127 downto 0);
78
                failed_rails : OUT std_logic_vector(255 downto 0);
79
                pfailure : OUT std_logic;
80
                tick_out : OUT std_logic;
81
                pseqstate_out : OUT std_logic_vector(3 downto 0);
82
                all_pgood : OUT std_logic
83
                );
84
        END COMPONENT;
85
 
86
 
87
--architecture body start -------------------------------------------------------
88
begin
89
 
90
        Inst_pseq_3redundant: pseq_3redundant PORT MAP(
91
                clk => clk,
92
                reset_n => reset_n,
93
                forcepoweron => forcepoweron,
94
                PSEQ_RAIL_EN => PSEQ_RAIL_EN,
95
                PSEQ_RAIL_PG => PSEQ_RAIL_PG,
96
                thermal_n => thermal_n,
97
                failed_rails => failed_rails,
98
                pfailure => pfailure,
99
                tick_out => tick_out,
100
                pseqstate_out => pseqstate_out,
101
                all_on => all_on,
102
                all_pgood => all_pgood
103
        );
104
 
105
 
106
 
107
-- Rail assignments:
108
 
109
P3V3_EN <= PSEQ_RAIL_EN(0);
110
P2V5_EN <= PSEQ_RAIL_EN(1);
111
P1V8_EN <= PSEQ_RAIL_EN(2);
112
P1V5_EN <= PSEQ_RAIL_EN(3);
113
P1V2_EN <= PSEQ_RAIL_EN(4);
114
P1V0_CORE_EN <= PSEQ_RAIL_EN(5);
115
-- <= PSEQ_RAIL_EN(6); unused, wait for pll
116
PCH_PWRGD <= PSEQ_RAIL_EN(7);
117
delaysig_in1 <= PSEQ_RAIL_EN(8);
118
-- <= PSEQ_RAIL_EN(127 downto 9); unused
119
 
120
PSEQ_RAIL_PG(0) <= P3V3_OK;
121
PSEQ_RAIL_PG(1) <= P2V5_OK;
122
PSEQ_RAIL_PG(2) <= P1V8_OK;
123
PSEQ_RAIL_PG(3) <= P1V5_OK;
124
PSEQ_RAIL_PG(4) <= P1V2_OK;
125
PSEQ_RAIL_PG(5) <= P1V0_CORE_PGOOD;
126
PSEQ_RAIL_PG(6) <= CK505_PLL_LOCK;
127
PSEQ_RAIL_PG(7) <= '1'; --just a chipset powergood, no need to wait.
128
PSEQ_RAIL_PG(8) <= delaysig_out1; --waiting for the 20m reset delay
129
PSEQ_RAIL_PG(127 downto 9) <= (others => '1'); --unused
130
 
131
 
132
--simple DELAY:
133
process ( reset_n, clk, delaysig_in1 )
134
   begin
135
     if ( reset_n='0' or delaysig_in1='0') then
136
        delaysig_out1 <= '0';
137
        delaycounter1 <= (others => '0');
138
     elsif (clk'event and clk='1') then
139
        if ( delaycounter1 = "01111010000100100000" ) then --after 20msec (40ns clk period)
140
           delaysig_out1 <= '1';
141
           delaycounter1 <= delaycounter1; --stop counting
142
        else
143
           delaycounter1 <= delaycounter1 +1;
144
           delaysig_out1 <= '0';
145
        end if;
146
     end if;
147
   end process;
148
 
149
board_reset_n <= delaysig_out1;
150
 
151
 
152
 
153
 
154
--end file ----------------------------------------------------------------------
155
end Behavioral;

powered by: WebSVN 2.1.0

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