The new code is -
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity timernew is
port (clk : in std_logic;
flag : out std_logic := '0' );
end timernew;
architecture Behavioral of timernew is
begin
process(clk)
variable count : integer:=0;
variable count1: integer:=0;
constant int: integer :=(10**6);
begin
if(clk'event and clk='1') then
count := count +1; --increment counter.
if count = int then
count := 0;
else
count1 := count1 + 1;
if count1 > 1000 then flag <= '1' ;
end if;
end if;
end if;
end process;
end Behavioral;