I am trying to implement a 1hz clock for a D flipflop in VHDL.
Below is my code:
entity d_flip_flop is
Port ( clk : in STD_LOGIC;
D : in STD_LOGIC;
Q : out STD_LOGIC);
end d_flip_flop;
architecture Behavioral of d_flip_flop is
signal clk_div: std_logic; --divided clock
begin
--process to divide clock
clk_divider: process(clk) --clk is the clock port
variable clk_count: std_logic_vector(25 downto 0) := (others => '0');
begin
if clk'event and clk = '1' then
clk_count <= clk_count+1;
clk_div <= clk_count(25);
end if;
end process;
--main process
main:process(clk_div)
begin
if clk'event and clk = '1' then
Q <= D;
end if;
end process;
end Behavioral;
But when I tried to compile it, the following error is reported:
ERROR:HDLParsers:808 - "F:/EE4218/XQ/d_flip_flop.vhd" Line 47. + can not have such operands in this context.
I have checked with several reference for the syntax and found nothing wrong with it. Can anyone point out the cause of the error ?
Thanks in advance!