gpt4 book ai didi

vhdl - 组件未在 VHDL generate 语句中正确实例化

转载 作者:行者123 更新时间:2023-12-01 06:30:37 25 4
gpt4 key购买 nike

我正在开发一个 VHDL 项目来设计一个 8 位 ALU,使用之前设计的一位 ALU。为此,我使用 generate 语句生成 ALU 的位 1-6,而位 0 和 7 在该 block 外处理。发生的事情是当我去模拟 ALU 时,无论输入是什么,1-6 位的值都不会改变。我知道一位 ALU 工作正常,因为手动实例化 8 个一位 ALU 可以按预期工作。

我认为发生的事情是出于某种原因,生成 block 中的组件实例没有被正确编译。当我在 ModelSim 中运行模拟时,消息出现在记录中,指出“组件实例 bit1_6:bitslice 未绑定(bind)”。为了说明发生了什么,我为架构 firstGen 发布的代码没有编译,说“没有带有标签 bit1_6 的语句:找到 bitslice”(使用 FOR ALL : ... 掩盖了不良行为,因为lsb 和 msb 被很好地实例化了)。有谁知道这是怎么回事吗?

ENTITY alu8bit IS
PORT( A, B : IN bit_vector(7 downto 0);
P,K,R : IN bit_vector(3 downto 0);
ci : IN bit;
Z : OUT bit_vector(7 downto 0);
co : OUT bit);
END;

ARCHITECTURE firstGen of alu8bit IS

COMPONENT bitslice
PORT(a, b, ci: IN bit;
P, K, R : IN bit_vector(3 downto 0);
ri, cn: OUT bit);
END COMPONENT;

FOR bit1_6: bitslice USE ENTITY work.one_bit_alu(alu_1_bit);
FOR others : bitslice USE ENTITY work.one_bit_alu(alu_1_bit);
signal c : bit_vector(7 downto 1);
BEGIN
lsb : bitslice PORT MAP(A(0), B(0), ci, P, K, R, Z(0), c(1));
GEN_MIDDLE_BITS: FOR I IN 1 TO 6 GENERATE
bit1_6 : bitslice PORT MAP(A(I), B(I), c(I), P, K, R, Z(I), c(I+1));
end generate;
msb : bitslice PORT MAP(A(7), B(7), c(7), P, K, R, Z(7), co);
END;

最佳答案

generate 语句为命名空间添加了一个额外的层次结构层。使用内部配置规范时,您只能在直接范围内配置组件。生成器(或 block )内的任何内容都变得无法访问。您可以使用生成语句的声明区域来指定中间切片的配置绑定(bind):

GEN_MIDDLE_BITS: FOR I IN 1 TO 6 GENERATE
for bit1_6 : bitslice use entity work.one_bit_alu(alu_1_bit);
begin
bit1_6 : bitslice PORT MAP(A(I), B(I), c(I), P, K, R, Z(I), c(I+1));
end generate;

您还可以考虑使用外部配置声明将所有内容放在一起。如果需要,可以类似于 VHDL-93 直接实体实例化来实例化配置。

关于vhdl - 组件未在 VHDL generate 语句中正确实例化,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25896099/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com