VHDL-Modelsim中JK触发器调试迭代限制错误
我正在为modelsim上的jk触发器编写vhdl代码,当我尝试模拟它时,我得到一个错误:错误:在时间0 ns时达到迭代限制 我不确定这意味着什么,但我已经查看了我的大部分源代码,以找出错误,但没有成功。有人能猜出问题出在哪里吗VHDL-Modelsim中JK触发器调试迭代限制错误,vhdl,Vhdl,我正在为modelsim上的jk触发器编写vhdl代码,当我尝试模拟它时,我得到一个错误:错误:在时间0 ns时达到迭代限制 我不确定这意味着什么,但我已经查看了我的大部分源代码,以找出错误,但没有成功。有人能猜出问题出在哪里吗 library ieee; use ieee.std_logic_1164.all; entity SRlatch is port(S,R:in bit; Q : inout bit ; QN : inout bit := '1'); end SRlatch; a
library ieee;
use ieee.std_logic_1164.all;
entity SRlatch is
port(S,R:in bit; Q : inout bit ; QN : inout bit := '1');
end SRlatch;
architecture structural of SRlatch is
begin
Q <= S nand QN;
QN <= R nand Q;
end;
entity JKFlipFlopStruct is
port(J,K,clk : in bit ; Q : inout bit ; QN : inout bit);
end JKFlipFlopStruct;
architecture structural of JKFlipFlopStruct is
component SRlatch is
port(S,R:in bit; Q : inout bit ; QN : inout bit := '1');
end component;
signal J0,K0,J1,K1,J2,K2 : bit;
begin
J0 <= not ( J and QN and clk) );
K0 <= not ( K and Q and clk) );
f1 : SRlatch port map ( J0,K0,J1,K1 );
J2 <= not ( J1 and (not clk) );
K2 <= not ( K1 and (not clk) );
f2 : SRlatch port map ( J2,K2,Q,QN );
end structural;
ieee库;
使用ieee.std_logic_1164.all;
实体SRlatch是
端口(S,R:位内;Q:输入输出位;QN:输入输出位:='1');
端锁;
SRIS的体系结构
开始
Q迭代限制意味着你在设计中创建了一个反馈循环,你让模拟器非常生气!它无法解析循环
使用时钟进程设置J0和K0
jk_flippy_floppy : process (clk)
begin
if rising_edge(clk) then
J0 <= not ( J and QN );
K0 <= not ( K and Q );
end if;
end process jk_flippy_floppy;
jk_flippy_软盘:进程(clk)
开始
如果上升沿(clk),则
J0迭代限制意味着你在设计中创建了一个反馈循环,你让模拟器非常生气!它无法解析循环
使用时钟进程设置J0和K0
jk_flippy_floppy : process (clk)
begin
if rising_edge(clk) then
J0 <= not ( J and QN );
K0 <= not ( K and Q );
end if;
end process jk_flippy_floppy;
jk_flippy_软盘:进程(clk)
开始
如果上升沿(clk),则
正如Russell所说,这个错误通常表明ModelSim陷入了一个无限循环中。在VHDL中,当一个信号被放置在灵敏度列表中并且该信号在过程中发生变化时,就会发生这种情况
一个简单的例子:
process (sig)
begin
sig <= not sig;
end;
它的等效过程是:
process (J2, K2)
begin
Q <= J2 nand QN;
QN <= K2 nand Q;
end process;
解决方案:
1.使您的设计成为顺序设计(即使用同步时钟)
2.使用延迟分配。因此,在SRlatch.vhd中,您应该编写
Q <= S nand QN after 1 ns;
QN <= R nand Q after 2 ns;
正如Russell所说,这个错误通常表明ModelSim陷入了无限循环。在VHDL中,当一个信号被放置在灵敏度列表中并且该信号在过程中发生变化时,就会发生这种情况
一个简单的例子:
process (sig)
begin
sig <= not sig;
end;
它的等效过程是:
process (J2, K2)
begin
Q <= J2 nand QN;
QN <= K2 nand Q;
end process;
解决方案:
1.使您的设计成为顺序设计(即使用同步时钟)
2.使用延迟分配。因此,在SRlatch.vhd中,您应该编写
Q <= S nand QN after 1 ns;
QN <= R nand Q after 2 ns;
Qieee库;
使用ieee.std_logic_1164.all;
实体SRlatch是
端口(S,R:位内;Q:输入输出位:='0';QN:输入输出位:='1');
端锁;
SRIS的体系结构
开始
Qieee库;
使用ieee.std_logic_1164.all;
实体SRlatch是
端口(S,R:位内;Q:输入输出位:='0';QN:输入输出位:='1');
端锁;
SRIS的体系结构
开始
Q尝试仅模拟SR闩锁以查看是否看到相同的错误。尝试仅模拟SR闩锁以查看是否看到相同的错误。如果在SRLatch端口声明中删除QN的默认预设,并使分配给Q和QN的两个延迟不对称,则最短延迟路径将结束准备好了。没有分配中的不对称延迟,也没有默认预设Q和QN将不断来回切换。这说明了亚稳态和克服它的一种方法。见第三段。@DavidKoontz谢谢。我已经修改了它。对于延迟分配,如果在SRLatch端口声明中删除QN的默认预设,并使Q和QN分配中的两个延迟不对称,则最短延迟路径最终将被设置。没有分配中的不对称延迟,也没有默认预设Q和QN将不断来回切换。这说明了亚稳态和克服它的一种方法。见第三段。@DavidKoontz谢谢。我已经修改过了。
process (clk)
begin
if (rising_edge(clk)) then
-- signal assignment
end if;
end process;
Q <= S nand QN after 1 ns;
QN <= R nand Q after 2 ns;
library ieee;
use ieee.std_logic_1164.all;
entity SRlatch is
port(S,R:in bit; Q : inout bit := '0' ; QN : inout bit := '1');
end SRlatch;
architecture structural of SRlatch is
begin
Q <= S nand QN;
QN <= R nand Q;
end structural;
entity JKFlipFlopStruct is
port(J,K,clk : in bit ; Q : inout bit ; QN : inout bit:= '1');
end JKFlipFlopStruct;
architecture structural of JKFlipFlopStruct is
component SRlatch is
port(S,R:in bit; Q : inout bit ; QN : inout bit := '1');
end component;
signal J1 : bit;
signal J0,K0,K1,J2,K2 : bit:= '1';
begin
J0 <= not ( J and QN and (not clk) );
K0 <= not ( K and Q and (not clk) );
f1 : SRlatch port map ( J0,K0,J1,K1 );
J2 <= not ( J1 and clk );
K2 <= not ( K1 and clk );
f2 : SRlatch port map ( J2,K2,Q,QN );
end structural;