I made some changes and the code finally works fine.
Thank you very much.
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.NUMERIC_STD.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity timernew is
port (clk : in std_logic;
flag : out std_logic := '0' );
end timernew;
architecture behave of timernew is
signal count : integer:=0;
signal count1: integer:=0;
begin
process(clk)
constant int: integer :=(10**6);
begin
if(clk'event and clk='1') then
if count = int then
count <= 0;
count1 <= count1 + 1;
else
count <= count + 1;
end if;
if count1 > 1000 then flag <= '1' ;
else flag <= '0';
end if;
end if;
end process;
end behave;