LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
USE IEEE.STD_LOGIC_UNSIGNED.ALL;
ENTITY tranlit IS
PORT(ala,resert:IN STD_LOGIC;
r1,r2,g1,g2,y1,y2:OUT STD_LOGIC);
END tranlit;
ARCHITECTURE behav OF tranlit IS
SIGNAL f,k:STD_LOGIC_VECTOR(2 DOWNTO 0);
SIGNAL flag:STD_LOGIC;
--SIGNAL k:STD_LOGIC_VECTOR(2 DOWNTO 0);
BEGIN
flag<='1';
aROCESS(ala,resert)
BEGIN
IF(ala='1') THEN
f<="000";
END IF;
--END PROCESS a;
--bROCESS(resert)
--BEGIN
IF(resert='1') THEN
f<="001";
END IF;
END PROCESS a;
cROCESS(f)
BEGIN
k<=f;
CASE k IS
WHEN "000"=>r1<='1';r2<='1';g1<='0';g2<='0';y1<='0';y2<='0';
WHEN "001"=>r1<='1';r2<='0';g1<='0';g2<='1';y1<='0';y2<='0';
WHEN "010"=>r1<='1';r2<='0';g1<='0';g2<='0';y1<='1';y2<='0';
WHEN "011"=>r1<='0';r2<='0';g1<='0';g2<='0';y1<='1';y2<='1';
WHEN "100"=>r1<='0';r2<='1';g1<='0';g2<='0';y1<='1';y2<='0';
WHEN "101"=>r1<='0';r2<='1';g1<='1';g2<='0';y1<='0';y2<='0';
WHEN OTHERS=> r1<='0';r2<='0';g1<='0';g2<='0';y1<='0';y2<='0';
END CASE;
IF(k="101") THEN
flag<='0';
END IF;
IF(flag='1') THEN
IF(k="001") THEN
k<=k+1;--AFTER 10S;
ELSE
k<=k+1;--AFTER 2S;
END IF;
ELSE
IF(k="101") THEN
k<=k-1 ;--AFTER 10S;
ELSE
k<=k-1 ;--AFTER 2S;
END IF;
END IF;
f<=k;
END PROCESS c;
END behav;
是一个交通灯的程序。报错为:
Error: Line 13: File c:\maxplus2\tranlit.vhd: Signal "f" has multiple sources
Error: Line 14: File c:\maxplus2\tranlit.vhd: Signal "flag" has multiple sources
前面本来还有几个警告,我觉得大概是在顺序结构中带并发行为,所以只有最后一句生效。但是这两个错误怎么回事我就茫然了。请各位前辈指点!
[em01][em01]
ToT 我要晕了,那个问题解决了这个问题又冒出来!我改后的程序中有一句
WHILE (f/="000") LOOP
编译时报错:
Error: Line 29: File c:\maxplus2\tranlit2.vhd: Unsupported feature error: Loops other thaWHILE (f/="000") LOOP
n 'for loops' are not supported; at line 29 in file 'c:\maxplus2\tranlit2.vhd'
可是为什么呢?书上明明有这种语句啊!请高手不吝赐教!