library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
use ieee.std_logic_arith.all;
use ieee.numeric_bit.all;
use ieee.numeric_std.all;
entity multiplexer is
port (
A,B: in std_logic_vector (7 downto 0);
CI: in std_logic;
CO: out std_logic;
ANS: out std_logic_vector (7 downto 0);
OP: in std_logic_vector(1 downto 0);
EN: in std_logic);
end multiplexer;
architecture archi of multiplexer is
signal tmp: std_logic_vector (8 downto 0);
begin
process (EN) begin
if (EN = '1') Then
case OP is
when "00" =>
tmp <= conv_std_logic_vector((conv_integer(A)+conv_integer(B)+conv_integer(CI)),9);
ANS<= tmp(7 downto 0);
CO <= tmp(8);
when "01" =>
tmp <= conv_std_logic_vector((conv_integer(A)-conv_integer(B)+conv_integer(CI)),9);
ANS<= tmp(7 downto 0);
CO <= tmp(8);
when others => NULL;
end case;
else
NULL;
end if;
end process;
end archi;
误差,其操作是在管线19来用于缀运算符没有可行的条目“=”也键入错误解决缀表达式“=”作为类型std.STANDARD.BOOLEAN。我哪里错了? wave output用来选择VHDL程序以执行
切勿使用'std_logic_arith','std_logic_signed'和'std_logic_unsigned'。这个软件包不符合标准。你可以用'numeric_std'完成你所需的一切。此外,你的代码不会工作,因为输入不在灵敏度列表中。实际上,我会用时钟来做,以避免危害,并且可以肯定的是,结果是在适当的时候。但我不确定是否有必要。 – Staszek
当我删除了std_logic_arith和std_logic_unsigned并添加了numeric_std.all时,出现了很多错误。他们大多集中在函数tmp的conv_integer部分。在调整代码之后,因为我犯了一个错误,所以在声明EN时,程序编译并运行成功,但ANS和CO中没有任何值,它们被显示为UUU,值仅在tmp?中。请参阅我上传的波形输出。我哪里错了。请帮忙。 –
呃...很简单。停止使用来自这些库的所有内容。包括conv_integer。查找与numeric_std等效的内容。例如,而不是conv_integer使用to_integer。至于在tmp中与UUU的问题 - 用改进的代码提出另一个问题,而不是标准库,这是更长的故事。 – Staszek