Vhdl 模拟中8位加法器的输出为xxxxxxxxx ieee库; 使用ieee.numeric_std.all; 使用ieee.std_logic_1164.all; 实体八位加法器是 端口(子添加:标准逻辑中;dis:标准逻辑中; OPa:标准逻辑向量(7到0); OPb:标准逻辑向量(7到0); Dout:out标准逻辑向量(8到0):=(其他=>'Z'); 终端实体八位加法器; 介绍了八位加法器的结构 信号结果:标准逻辑向量(8到0):=(其他=>'0'); 开始 输出:过程(dis、结果)为 开始 如果dis='0',则 多兹’; 其他的 Dout

Vhdl 模拟中8位加法器的输出为xxxxxxxxx ieee库; 使用ieee.numeric_std.all; 使用ieee.std_logic_1164.all; 实体八位加法器是 端口(子添加:标准逻辑中;dis:标准逻辑中; OPa:标准逻辑向量(7到0); OPb:标准逻辑向量(7到0); Dout:out标准逻辑向量(8到0):=(其他=>'Z'); 终端实体八位加法器; 介绍了八位加法器的结构 信号结果:标准逻辑向量(8到0):=(其他=>'0'); 开始 输出:过程(dis、结果)为 开始 如果dis='0',则 多兹’; 其他的 Dout,vhdl,quartus,Vhdl,Quartus,一个问题是信号分配(提供了一个测试平台(需要一个测试平台,缺乏测试平台妨碍了mkgrieger1和Matthew Taylor的准确回答): ieee库; 使用ieee.std_logic_1164.all; 使用ieee.numeric_std.all; 实体八位加法器是 终端实体; 八位加法器的体系结构foo是 信号子添加:标准逻辑:='1'; 信号dis:std_逻辑:='1'; 信号OPa:标准逻辑向量(7到0); 信号OPb:std_逻辑_向量(7到0); 信号双:标准逻辑向量(8到0

一个问题是信号分配(
提供了一个测试平台(需要一个测试平台,缺乏测试平台妨碍了mkgrieger1和Matthew Taylor的准确回答):

ieee库;
使用ieee.std_logic_1164.all;
使用ieee.numeric_std.all;
实体八位加法器是
终端实体;
八位加法器的体系结构foo是
信号子添加:标准逻辑:='1';
信号dis:std_逻辑:='1';
信号OPa:标准逻辑向量(7到0);
信号OPb:std_逻辑_向量(7到0);
信号双:标准逻辑向量(8到0);
开始
DUT:
实体功.八位加法器
港口地图(
SUBADD=>SUBADD,
dis=>dis,
OPa=>OPa,
OPb=>OPb,
Dout=>Dout
);
刺激:
过程
开始
对于0到9循环中的i

OPa对
结果
的所有分配都发生在一个过程中。-2008 14.7.2驱动因素"process语句中的每个信号分配语句都为某些标量信号定义了一组驱动程序。process语句中的给定标量信号有一个驱动程序,前提是该process语句中至少有一个信号分配语句,且该信号的目标信号的最长静态前缀为ssignment语句表示或表示S是子元素的复合信号。每个这样的信号分配语句都被称为与该驱动程序关联。“是的。我的错。我采纳了你的建议,但模拟结果与你的不一样,我的输出确实发生了变化,但只有LSB的值变为0,而其他的仍然显示X。我甚至复制了你的整个代码,以在我的计算机上验证结果,但结果仍然是一样的。我怀疑最后的语句
result(result'left)在您的问题中提供一个。它可以重新打开。
library ieee;
use ieee.numeric_std.all;
use ieee.std_logic_1164.all;

entity eight_bits_adder is
     port(SUBADD:in std_logic;dis:in std_logic;
        OPa:in std_logic_vector(7 downto 0);
        OPb:in std_logic_vector(7 downto 0);
        Dout:out std_logic_vector(8 downto 0):=(others=>'Z'));
     end entity eight_bits_adder;

architecture behavioral of eight_bits_adder is
signal result:std_logic_vector(8 downto 0):=(others=>'0');
begin
output:process(dis,result) is
begin
    if dis='0' then
        Dout<=(others=>'Z');
    else
        Dout<=result;
    end if;
end process output;

OP:
process (SUBADD,OPa,OPb) is -- remove OPb_temp from sensitivity list
    -- variable temp:      std_logic;
    variable Carry:     std_logic;
    variable OPb_temp:  std_logic_vector(OPb'range);
begin
    OPb_temp := OPb;  -- <=  becomes variable assignment :=
    -- temp := SUBADD;
    Carry := SUBADD;
    if SUBADD = '1' then
        OPb_temp := not OPb_temp;   -- <=  becomes variable assignment :=
    end if;
    for index in OPa'reverse_range loop
        result(index) <= OPa(index) xor Carry; -- CHANGE
        Carry := (OPa(index) and OPb_temp(index)) or ((OPa(index) xor OPb_temp(index)) and Carry);  --CHANGE
    end loop;
    result(8) <= Carry;
end process OP;
end architecture behavioral;
    OPb_temp<=not OPb_temp;
    result(index)<=OPa(index) xor OPb_temp(index);