我有以下代码可以计算到 59。它开始时很好,但在 31 之后,开始显示 ASCII 字符,如 '('、'$'、'#' 等,而不是数字。知道我哪里出错了?
LIBRARY ieee;
USE ieee.std_logic_1164.all;
USE ieee.numeric_std.all;
entity counter is
port(clk: IN STD_LOGIC;
secs:OUT INTEGER RANGE 0 to 59);
end counter;
architecture counter_behav of counter is
signal countSVal: INTEGER RANGE 0 to 59:=0;
begin
process(clk)
begin
if(rising_edge(clk)) then
if(countSVal>=59) then
countSVal <= 0;
else
countSVal <= countSVal + 1;
end if;
secs <= countSVal;
end if;
end process;
end counter_behav;