Newbie to VHDL

Discussion in 'Homework Help' started by Tricky, May 13, 2012.

  1. Tricky

    Thread Starter New Member

    May 13, 2012
    5
    0
    Hi all ..
    I'm new to VHDL and confused with this design

    when Acknwledgement= '1' and clk='1' then
    count should be count+1;
    and when Acknwledgement= '0' my total counted value should be assigned to the 'output' irrespective of clk and after that resetting count='0'.

    can anyone help with this.
    Thanks in advance.
     
  2. Tricky

    Thread Starter New Member

    May 13, 2012
    5
    0
    Code ( (Unknown Language)):
    1.  
    2. library IEEE;
    3. use IEEE.STD_LOGIC_1164.ALL;
    4.  
    5.  
    6. entity acknw is
    7.     Port ( acknw: in  STD_LOGIC;
    8.            clk : in  STD_LOGIC;
    9.            output : out INTEGER RANGE 0 To 15);
    10. end acknw;
    11.  
    12. architecture Behavioral of acknw is
    13.  
    14. begin
    15.  
    16. process(clk,acknw)
    17. variable c : INTEGER RANGE 0 To 15 ;
    18. begin
    19.  
    20. if(clk'event and clk='1') then
    21.      if(acknw='1') then
    22.      
    23.             c := c+1;  
    24.                  output <= c;    
    25.     else
    26.         c := 0 ;    
    27.         output <= c;
    28.     end if;    --when reset equal to '1' make count equal to 0.
    29. end if;
    30. end process;
    31.  
    32. end Behavioral;
    33.  

    But I need the output value has integer value like 120 or 300 etc.,
    can anyone guide me !!!
     
    Last edited by a moderator: May 14, 2012
  3. StayatHomeElectronics

    Well-Known Member

    Sep 25, 2008
    864
    40
    What exactly is your question?
     
  4. Tricky

    Thread Starter New Member

    May 13, 2012
    5
    0
    Iam getting the output value in binary format like 101,111 but I need this value as 5,7 i.e., the counted clock value .
    How this can be made.
    Thnks in advance
     
  5. StayatHomeElectronics

    Well-Known Member

    Sep 25, 2008
    864
    40
    How are you looking at the output? Given that VHDL is used to describe digital systems, the binary representation of the number seems reasonable.
     
  6. Tricky

    Thread Starter New Member

    May 13, 2012
    5
    0
    You are correct but is there a way to get the counts values in decimal number?
     
  7. StayatHomeElectronics

    Well-Known Member

    Sep 25, 2008
    864
    40
    To be output where? How are you looking at the number, through a simulator? What are you using to run the vhdl?
     
Loading...