A
ashu
Guest
hi ,
is it possible to write any clocked function in procedure i.e. i had
written a simple DOWNCOUNTER by using procedure, but when i m calling
the procedure it is counting only up to one place like 15, 14....
can any body suggest some remedy ........code is given below
------------------------------------------------------------------------------------------------------------------------------------
ibrary ieee ;
use ieee.std_logic_1164.all ;
use ieee.std_logic_unsigned.all ;
use ieee.std_logic_arith.all ;
entity check is
port (
clk ,rst : in std_logic ;
count : out std_logic_vector(3 downto 0)
);
end check ;
architecture a of check is
--- declaration of procedure ---
procedure my (
signal clock ,reset : in std_logic ;
signal co : out std_logic_vector(3 downto 0)
) is
variable q : integer range 15 downto 0 ;
begin
if ( reset = '1' ) then
if (clock'event and clock = '1') then
if (q = 0) then
q := 15 ;
else
q := q - 1 ;
end if ;
co <= conv_std_logic_vector(q,4) ;
end if ;
else
q := 15 ;
co <= "1111" ;
end if ;
end my ;
begin
-------------- -------- procedure call ----- -----------------
----------------
my (clk,rst,count); ------ here it is counting only upto
14 i.e. only one place
end a ;
is it possible to write any clocked function in procedure i.e. i had
written a simple DOWNCOUNTER by using procedure, but when i m calling
the procedure it is counting only up to one place like 15, 14....
can any body suggest some remedy ........code is given below
------------------------------------------------------------------------------------------------------------------------------------
ibrary ieee ;
use ieee.std_logic_1164.all ;
use ieee.std_logic_unsigned.all ;
use ieee.std_logic_arith.all ;
entity check is
port (
clk ,rst : in std_logic ;
count : out std_logic_vector(3 downto 0)
);
end check ;
architecture a of check is
--- declaration of procedure ---
procedure my (
signal clock ,reset : in std_logic ;
signal co : out std_logic_vector(3 downto 0)
) is
variable q : integer range 15 downto 0 ;
begin
if ( reset = '1' ) then
if (clock'event and clock = '1') then
if (q = 0) then
q := 15 ;
else
q := q - 1 ;
end if ;
co <= conv_std_logic_vector(q,4) ;
end if ;
else
q := 15 ;
co <= "1111" ;
end if ;
end my ;
begin
-------------- -------- procedure call ----- -----------------
----------------
my (clk,rst,count); ------ here it is counting only upto
14 i.e. only one place
end a ;