1 | library ieee;
|
2 | use ieee.std_logic_1164.all;
|
3 | use ieee.std_logic_unsigned.all;
|
4 | entity req is
|
5 | port(fpga_clk: in std_logic;
|
6 | evt_pwr_en: in std_logic;
|
7 | ifc_we_n : inout std_logic;
|
8 | hreset_n : inout std_logic;
|
9 | pwr_rst_n : in std_logic;
|
10 | ifc_ad8_15 : inout std_logic_vector( 7 downto 0);
|
11 | sensevdd_en_n : out std_logic;
|
12 | iopwr_en : out std_logic;
|
13 | iopwr_en_n : out std_logic;
|
14 | ddrpwr_en : out std_logic;
|
15 | ddrpwr_en_n : out std_logic;
|
16 | vdd_en : out std_logic;
|
17 | vdd_en_n : out std_logic;
|
18 | vcore_en : out std_logic;
|
19 | evt_pwr_ok : out std_logic;
|
20 | v3v3_pgood: in std_logic);
|
21 | end req;
|
22 | architecture power of req is
|
23 | signal tier_cnt: std_logic_vector(19 downto 0);
|
24 | signal tier_cnt_int:std_logic;
|
25 | signal tier : std_logic_vector(3 downto 0);
|
26 | signal vcore_en_cnt: std_logic_vector(9 downto 0);
|
27 | signal pwr_gd_cnt : std_logic_vector(19 downto 0);
|
28 | signal pwr_ok_cnt: std_logic_vector(19 downto 0);
|
29 | signal rst_holf_f : std_logic;
|
30 | signal req_rst_r : std_logic;
|
31 | signal req_cop_trst_r : std_logic;
|
32 | signal cfg_egn_use0 : std_logic;
|
33 | signal cpu_rst_n : std_logic;
|
34 | signal pwr_rst_cnt : std_logic_vector(9 downto 0);
|
35 | signal rcw_config_word : std_logic_vector( 7 downto 0);
|
36 | begin
|
37 |
|
38 | pon_rst_n <= (pwr_rst_n when pwr_ok_cnt(19) = '1' else '1') when v3v3_pgood and pwr_gd_cnt(19) = '1' else pwr_rst_n;
|
39 |
|
40 | process(tier_cnt_int)
|
41 | begin
|
42 | if(rising_edge(tier_cnt_int)) then
|
43 | if(v3v3_pgood = '0') then
|
44 | tier_cnt(3 downto 0) <= "1111";
|
45 | else
|
46 | tier(3) <= tier(2);
|
47 | tier(2) <= tier(1);
|
48 | tier(1) <= tier(0);
|
49 | tier(0) <= evt_pwr_en;
|
50 | end if;
|
51 | end if;
|
52 | end process;
|
53 |
|
54 | process(fpga_clk)
|
55 | begin
|
56 | if(rising_edge(fpga_clk)) then
|
57 | if(v3v3_pgood = '0') then
|
58 | vcore_en_cnt <= (others => '0');
|
59 | else
|
60 | if(vcore_en_cnt > "0110000000") then
|
61 | vcore_en_cnt <= "1111111111";
|
62 | else
|
63 | vcore_en_cnt <= vcore_en_cnt + 1;
|
64 | end if;
|
65 | end if;
|
66 | end if;
|
67 | end process;
|
68 | process(fpga_clk)
|
69 | begin
|
70 | if(rising_edge(fpga_clk)) then
|
71 | if(v3v3_pgood = '0') then
|
72 | pwr_gd_cnt <= (others => '0');
|
73 | else
|
74 | if(pwr_gd_cnt > x"08000") then
|
75 | pwr_gd_cnt <= (others => '1');
|
76 | else
|
77 | pwr_gd_cnt <= pwr_gd_cnt + 1;
|
78 | end if;
|
79 | end if;
|
80 | end if;
|
81 | end process;
|
82 |
|
83 | process(fpga_clk)
|
84 | begin
|
85 | if(rising_edge (fpga_clk)) then
|
86 | if( (not(cpu_rst_n) or (rst_holf_f) or (hreset_n and (not(req_rst_r)) and req_cop_trst_r ))= '1') then
|
87 | cfg_egn_use0 <= ifc_we_n;
|
88 | end if;
|
89 | end if;
|
90 | end process;
|
91 |
|
92 | process(fpga_clk)
|
93 | begin
|
94 | if(rising_edge(fpga_clk)) then
|
95 | if(pwr_rst_n = '0') then
|
96 | rcw_config_word <= ifc_ad8_15;
|
97 | end if;
|
98 | end if;
|
99 | end process;
|
100 | end power;
|