选择要执行的操作的VHDL程序 ieee库; 使用ieee.std_logic_1164.all; 使用ieee.std_logic_unsigned.all; 使用ieee.std_logic_arith.all; 使用ieee.numeric_bit.all; 使用ieee.numeric_std.all; 实体多路复用器 港口( A、 B:标准逻辑向量(7到0); CI:标准逻辑; CO:输出标准逻辑; ANS:输出标准逻辑向量(7到0); OP:标准逻辑向量(1到0); EN:标准逻辑中); 终端复用器; 多路复用器的体系结构是 信号tmp:std_逻辑_向量(8到0); 开始 进程(EN)开始 如果(EN='1'),则 案例OP是 当“00”=> tmp

选择要执行的操作的VHDL程序 ieee库; 使用ieee.std_logic_1164.all; 使用ieee.std_logic_unsigned.all; 使用ieee.std_logic_arith.all; 使用ieee.numeric_bit.all; 使用ieee.numeric_std.all; 实体多路复用器 港口( A、 B:标准逻辑向量(7到0); CI:标准逻辑; CO:输出标准逻辑; ANS:输出标准逻辑向量(7到0); OP:标准逻辑向量(1到0); EN:标准逻辑中); 终端复用器; 多路复用器的体系结构是 信号tmp:std_逻辑_向量(8到0); 开始 进程(EN)开始 如果(EN='1'),则 案例OP是 当“00”=> tmp,vhdl,alu,Vhdl,Alu,这肯定是: 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

这肯定是:

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;
应该是这样的:

EN: in std_logic_vector
您的错误消息是,没有定义的
“=”
运算符可以将
std_逻辑_向量
'1'
进行比较,后者是类型为
std_逻辑
的文本,这肯定是:

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;
应该是这样的:

EN: in std_logic_vector

您的错误消息是,没有定义的
“=”
运算符可以将
std\u逻辑向量
'1'
进行比较,后者是类型为
std\u逻辑

的文本,永远不要使用
std\u逻辑算术
std\u逻辑有符号
,和
std\u逻辑无符号
。这些包装不是标准的。您可以使用
数字\u std
完成所有需要的操作。此外,您的代码将无法工作,因为输入不在敏感度列表中。事实上,为了避免危险,我会用时钟来做这件事,当然,结果是在适当的时间。但我不确定是否有必要。当我删除了std_logic_arith和std_logic_unsigned并添加了数字std.all时,出现了很多错误。其中大部分集中在函数tmp的conv_整数部分。同样在调整代码后,由于我犯了一个错误,在EN声明中,程序编译并运行成功,但ANS和CO中没有值,它们显示为UUU,值仅在tmp?中?。请看我上传的波形输出。我哪里做错了。请帮忙,嗯。。。简单。停止使用那些库中的所有内容。包括conv_整数。查找等效的数值。例如,不使用conv_integer,而使用to_integer。至于tmp中UUU的问题-用改进的代码问另一个问题,没有标准库,这是一个较长的问题。永远不要使用
std\u logic\u arith
std\u logic\u signed
,和
std\u logic\u unsigned
。这些包装不是标准的。您可以使用
数字\u std
完成所有需要的操作。此外,您的代码将无法工作,因为输入不在敏感度列表中。事实上,为了避免危险,我会用时钟来做这件事,当然,结果是在适当的时间。但我不确定是否有必要。当我删除了std_logic_arith和std_logic_unsigned并添加了数字std.all时,出现了很多错误。其中大部分集中在函数tmp的conv_整数部分。同样在调整代码后,由于我犯了一个错误,在EN声明中,程序编译并运行成功,但ANS和CO中没有值,它们显示为UUU,值仅在tmp?中?。请看我上传的波形输出。我哪里做错了。请帮忙,嗯。。。简单。停止使用那些库中的所有内容。包括conv_整数。查找等效的数值。例如,不使用conv_integer,而使用to_integer。至于tmp中UUU的问题——用改进的代码问另一个问题,没有标准库,这是一个较长的故事。非常感谢。我纠正了这一点,程序编译成功,但是,波形输出显示tmp有值,但ANS或CO中没有值?当我将00000001(A)与11111111(B)相加时,它显示为uu。tmp中的值显示为100000000,但ANS或CO中没有值。它们显示为U?请帮忙?正如@Staszek所说:你需要问一个新问题。堆栈溢出的思想是,未来有相同问题的用户可以搜索特定问题的特定答案。未来的用户可以搜索相同的错误消息,也许这个问题和答案会对他们有所帮助。现在你有了一个新问题;请问一个新问题。非常感谢。我纠正了这一点,程序编译成功,但是,波形输出显示tmp有值,但ANS或CO中没有值?当我将00000001(A)与11111111(B)相加时,它显示为uu。tmp中的值显示为100000000,但ANS或CO中没有值。它们显示为U?请帮忙?正如@Staszek所说:你需要问一个新问题。堆栈溢出的思想是,未来有相同问题的用户可以搜索特定问题的特定答案。未来的用户可以搜索相同的错误消息,也许这个问题和答案会对他们有所帮助。现在你有了一个新问题;请问一个新问题。