我的代码编译时产生以下错误:试图使用VHDL缓冲区 - 不工作
错误:HDLCompiler:439 - “E:/电子工程2/DIGITAL/Resit_Year/Assignment_7_seg/4_Bit_Counter/Bit_Counter/counter_tb.vhd” 47号线:模拟器:模式缓冲区的正式端口count_out不能用的模式出来 ERROR实际端口count_out有关777 - 库工作顶级VHDL设计单位counter_tb的静态阐述失败
不知道如何解决这个问题。
全码:
-----------------------------------------------------------------------------------
entity Four_Bit_Counter is
Port (clock : in STD_LOGIC;
reset : in STD_LOGIC;
pause : in STD_LOGIC;
count_out : buffer STD_LOGIC_VECTOR (3 downto 0);
student_id : buffer STD_LOGIC_VECTOR (3 downto 0) );
end Four_Bit_Counter;
----------------------------------------------------------------------------------
architecture Behavioral of Four_Bit_Counter is
signal temp_count : std_logic_vector(3 downto 0) := "0000" ;
signal slow_clock : std_logic ;
signal clock_divider : std_logic_vector(1 downto 0) := "00";
variable cout_out : std_logic_vector(3 downto 0):= "0000";
begin
---------------------------------------------------------------------------------
clock_division : process (clock, clock_divider)
begin
if
clock'event and clock = '1' then
clock_divider <= clock_divider + 1;
end if;
slow_clock <= clock_divider(1);
end process;
--------------------------------------------------------------------------------
counting : process(reset, pause, slow_clock, temp_count)
begin
if reset = '1' then
temp_count <= "0000";
elsif pause = '1' then
temp_count <= temp_count;
else
if slow_clock'event and slow_clock= '1' then
if temp_count < 15 then
temp_count <= temp_count + 1;
else
temp_count <= "0000";
end if;
end if;
end if;
count_out <= temp_count;
end process;
----------------------------------------------------------------------------------
student : process (reset, pause, slow_clock, temp_count)
begin
IF (cout_out = "0010") THEN
student_id <= "0010";
ELSIF (cout_out = "0011") THEN
student_id <= "0001";
ELSIF (cout_out = "0100") THEN
student_id <= "0000";
ELSIF (cout_out = "0101") THEN
student_id <= "0000";
ELSIF (cout_out = "0110") THEN
student_id <= "1001";
ELSIF (cout_out = "0111") THEN
student_id <= "0011";
ELSIF (cout_out = "1000") THEN
student_id <= "0010";
ELSIF (cout_out = "1001") THEN
student_id <= "0110";
ELSE student_id <= "1000";
END IF;
end process student;
--student_id <= "0010" when count_out >= "0001" else
--"0001" when count_out >= "0011" else
--"0000" when count_out >= "0101" else
--"0000" when count_out >= "0111" else
--"1001" when count_out >= "1000" else
--"0011" when count_out >= "1001" else
--"0000" when count_out >= "1011" else
--"0110" when count_out >= "1100" else
--"1000";
end Behavioral;
IEEE Std 1076-2008 6.5.2接口对象声明,注7 - 尽管模式输出端口与模式缓冲区的端口具有相同的语义,但它们之间存在重要的设计文档区分。目的是模式输出端口应该只读取被动活动,即用于在监视器或属性或断言检查器中用于验证的功能。如果读取输出端口的值以实现描述的算法行为,则该端口应该是模式缓冲区。 *应*具有推荐权重(不是强制性的)。 – user1155120 2014-11-26 00:27:32
换句话说,你*可以*用'out'替换'buffer' ......但你可能*不应该*。感谢您的澄清。 – 2014-11-26 00:52:05
*应该*表示建议对于2008年的标准是新的,并且对设计描述的合法性没有任何影响。注7可以忽略,建议不可测试。标准并不意味着提供样式要求。另一方面是综合供应商支持的做法? – user1155120 2014-11-26 05:56:52