EmbDev.net

Forum: FPGA, VHDL & Verilog Counter in the existing program


von Hareesh M. (Company: Mindteck) (hareeshp)


Rate this post
useful
not useful
hi,
i have a vhdl code written below,
1
 
2
library ieee;
3
use ieee.std_logic_1164.all;
4
use ieee.numeric_std.all;
5
use ieee.std_logic_unsigned.all;
6
  entity powerseq is
7
  port(      fpga_clk: in std_logic;
8
          EN_1v  : out std_logic;    -- Enabling signal of 1V
9
          EN_1v8  : out std_logic;  -- Enabling signal of 1V8
10
          EN_1v2 : out std_logic;    -- Enabling signal of 1V2
11
          EN_1v35 : out std_logic;  -- Enabling signal of 1V35
12
          EN_2v5 : out std_logic;    -- Enabling signal of 2V5
13
          EN_3v3 : out std_logic;    -- Enabling signal of 3V3  
14
          EN_V1P0 : out std_logic;  -- Enabling signal of V1P0  
15
          PGOOD_1v8 : in std_logic:= '1';   -- Power Good Signal 1V8
16
          PGOOD_1v35 : in std_logic:= '1';  -- Power Good Signal 1V35
17
          PGOOD_2v5 : in std_logic:= '1';  -- Power Good Signal 2V5
18
          PGOOD_3v3 : in std_logic:= '1';  -- Power Good Signal 3V3  
19
          PGOOD_1v  : in std_logic:= '1';  -- Power Good Signal 1V
20
          PGOOD_1v2 : in std_logic:= '1';  -- Power Good Signal 1V2
21
          poreset_b  : out std_logic;
22
          PGOOD_V1P0 : in std_logic:= '1'  -- Power Good Signal V1P0
23
          );
24
 end powerseq;
25
 architecture behav of powerseq is
26
 signal pon_state : integer := 0;
27
 signal counter : integer := 0;
28
 begin
29
  process(fpga_clk) 
30
    begin
31
    
32
      if(rising_edge(fpga_clk)) then
33
        if(pon_state = 0) then 
34
            poreset_b  <= '1';
35
            EN_1v8  <= '1';
36
            EN_1v35 <= '1';
37
            EN_2v5  <= '1';
38
            EN_3v3  <= '1';
39
            pon_state <= 1;
40
            EN_1v <= '0';
41
            EN_V1P0 <= '0';
42
            En_1v2<= '0';
43
        end if;
44
        if(pon_state =  1) then
45
          if((PGOOD_1v8 and PGOOD_1v35 and PGOOD_2v5 and PGOOD_3v3 )='1') then --checking whether the PGOOD signals are stable  
46
            EN_1v <= '1';
47
            EN_V1P0 <= '1';
48
            poreset_b<= '0';
49
            pon_state <= 2;
50
          end if;
51
          if (pon_state = 2) then
52
            if((PGOOD_1v and PGOOD_V1P0)= '1') then --checking whether the PGOOD signals are stable.
53
            En_1v2<= '1';
54
            pon_state <= 3;
55
          end if;
56
          end if;
57
      end if;
58
    end process;
59
  end behav;

in the above code how i can add 2 sec delay before checking the
1
 if((PGOOD_1v8 and PGOOD_1v35 and PGOOD_2v5 and PGOOD_3v3 )='1')
.I have assigned all the signals to leds. and need to see the delay in 
the output leds.

von King Julian (Guest)


Rate this post
useful
not useful
Insert another state between 1 and 2 where you have a counter for 2 sec

von Hareesh M. (Company: Mindteck) (hareeshp)


Rate this post
useful
not useful
King Julian wrote:
> Insert another state between 1 and 2 where you have a counter for 2 sec

actually by adding a counter will solve this problem right?

von Lothar M. (Company: Titel) (lkmiller) (Moderator)


Rate this post
useful
not useful
Hareesh M. wrote:
> i have a vhdl code written below,
> use ieee.numeric_std.all;
> use ieee.std_logic_unsigned.all;
Never use the obsolete std_logic_arith and its std_logic_(un)signed 
together with the numeric_std. You will get strange behaviour and error 
messages due to double type definitions.

Hareesh M. wrote:
> actually by adding a counter will solve this problem right?
Yes, allmost all times in FPGA are realized by counters...

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.