在以下代码中发生以下错误:
错误 (10821):ClockGen.vhd(33) 处的 HDL 错误:无法推断“cont [0]”的寄存器,因为它的行为与任何支持的寄存器模型都不匹配
我尝试使用有符号和无符号变量进行比较,但没有奏效。
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
USE IEEE.STD_LOGIC_ARITH.ALL;
ENTITY ClockGen IS
GENERIC
(Ratio : INTEGER RANGE 0 TO 100 := 10);
PORT
(clk : IN STD_LOGIC;
reset : IN STD_LOGIC;
clk_en : OUT STD_LOGIC);
END ENTITY ClockGen;
ARCHITECTURE Behavior OF ClockGen IS
SIGNAL cont : INTEGER RANGE 0 TO 100 :=0;
BEGIN
--STATEMENTS
Counting : PROCESS (clk, reset)
BEGIN
IF reset='1'
THEN
cont <= 0; clk_en <= '0';
ELSIF RISING_EDGE(clk)
THEN
cont <= cont + 1;
END IF;
IF cont=Ratio AND clk='1' --THE ERROR OCCURS IN THIS LINE
THEN
clk_en <= '1';
ELSIF cont=Ratio AND clk='0'
THEN
clk_en <= '0';
cont<=0;
END IF;
END PROCESS Counting;
END ARCHITECTURE Behavior;