【发布时间】:2016-01-18 14:38:21
【问题描述】:
我正在尝试模拟我的 VHDL 代码。似乎存在差异,因为位 q(0 down to 0) 和 q1(0 down to 0) 有一些值,但是当我将它们分配给新向量时,它们的值不正确(在同一个周期中)@987654321 @。由于我的下一个状态逻辑取决于这两个位,因此结果是不正确的。
这里,r和t被赋值给q(0 down to 0)和q1(0 down to 0),如代码所示。在示例中,r 应取值 1,因为 q[0] 为 1。但结果是 0。
我想知道这个问题的原因是什么?
when S0 => state <= S0;
funct <= '0';
load_m <= '0';
load_a <= '0';
load_q <= '0';
load_q1 <= '0';
shift <= '0';
dc <= '0';
rst_counter <= '0';
rst_shifter <= '0';
done <= '0';
--q0 <= to_bit(q(0 downto 0));
--q11 <= to_bit(q1);
r <= q(0 downto 0);
t <= q1(0 downto 0);
if ( (q(0 downto 0) = "1" and q1(0 downto 0) = "1") or (q(0 downto 0) = "0" and q1(0 downto 0) = "0")) then
next_state <= S4;
elsif (q(0 downto 0) = "0" and q1(0 downto 0) = "1") then
next_state <= S2;
elsif (q(0 downto 0) = "1" and q1(0 downto 0) = "0") then
next_state <= S1;
end if;
【问题讨论】:
-
您的代码示例不是Minimal, Complete, and Verifiable example。在 VHDL 中,查看声明、结构、完整过程和所有涉及的信号分配通常很有帮助。没有足够的信息来回答。您使用长度为 1 的数组类型而不是元素类型是否有某些原因?
标签: vhdl simulation modelsim