ARCHITECTURE A OF TEST IS
SIGNAL S:STD_LOGIC;
BEGIN
PROCESS(CLK)
BEGIN
IF CLK'EVENT AND CLK='1' THEN
S<=S+1;----问题出在这里
END IF;
END PROCESS;
这样编译总是同不过如果S改为STD_LOGIC_VECTOR(1 DOWNTO 0);
就没问题,请问这是怎么回事,谢谢
Library IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
USE IEEE.STD_LOGIC_ARITH.ALL;
USE IEEE.STD_LOGIC_UNSIGNED.ALL;
ENTITY TEST IS
PORT(
CLK:IN STD_LOGIC;
A:IN STD_LOGIC_VECTOR(1 downto 0);
B:OUT STD_LOGIC_VECTOR(1 DOWNTO 0)
);
END TEST;
ARCHITECTURE X OF TEST IS
SIGNAL S:UNSIGNED(1 DOWNTO 0);
BEGIN
PROCESS(CLK)
BEGIN
IF CLK'EVENT AND CLK='1' THEN
S <= UNSIGNED(A);
S <= S+1;
END IF;
END PROCESS;
B <= STD_LOGIC_VECTOR(S);
END X;
希望这个给你有所启发!