modelsim中仿真错误:Iteration limit reached at time 2 ns.
时间:10-02
整理:3721RD
点击:
Error: (vsim-3601) Iteration limit reached at time 2 ns.
module top是用来做test bentch的,后面两个module是实现D flip flop的。
代码如下:
module top;
wire Q,Qn;
reg D,clk;
reg restn;
E_D_Flip_Flop edfflp(Q,Qn,D,clk,restn);
initial
begin
clk = 1'b0;
restn = 1'b0;
#2 restn = 1'b1;//似乎是在restn=1的时候,仿真不下去的
end
always
#4.3 clk = ~clk;
initial
begin
#1 D = 1'b1;
#3.1 D = 1'b0;
#3.2 D = 1'b1;
#3.3 D = 1'b0;
#3.5 D = 1'b1;
#3.6 D = 1'b0;
#3.7 D = 1'b1;
#3.8 D = 1'b0;
#3.9 $finish; //terminate the simulation end
end
endmodule
//第一个图,Gated D Latch
module Gated_D_Latch(Q,Qn,D,clk,rstn);
input D,clk,rstn;
output Q,Qn;
wire Dn, So, Ro;
not #0.05 n0(Dn,D);
nand #0.03 nd0(So,D,clk);
nand #0.02 nd1(Ro,Dn,clk);
nand #0.01 nd2(Q,So,Qn,rstn);
nand #0.02 nd3(Qn,Ro,Q,rstn);
endmodule
//第二个图:edged D Flip Flop with reset.
module E_D_Flip_Flop(Q,Qn,D,clk,resetn);
input D,clk,resetn;
output Q,Qn;
wire clkn,Qm;
not #0.01 n0(clkn,clk);
Gated_D_Latch D_Master(Qm,,D,clk,resetn);
Gated_D_Latch D_Slave(Q,Qn,Qm,clkn,resetn);
endmodule
其中, D latch是这个图:
edged flip-flop如下图:
module top是用来做test bentch的,后面两个module是实现D flip flop的。
代码如下:
module top;
wire Q,Qn;
reg D,clk;
reg restn;
E_D_Flip_Flop edfflp(Q,Qn,D,clk,restn);
initial
begin
clk = 1'b0;
restn = 1'b0;
#2 restn = 1'b1;//似乎是在restn=1的时候,仿真不下去的
end
always
#4.3 clk = ~clk;
initial
begin
#1 D = 1'b1;
#3.1 D = 1'b0;
#3.2 D = 1'b1;
#3.3 D = 1'b0;
#3.5 D = 1'b1;
#3.6 D = 1'b0;
#3.7 D = 1'b1;
#3.8 D = 1'b0;
#3.9 $finish; //terminate the simulation end
end
endmodule
//第一个图,Gated D Latch
module Gated_D_Latch(Q,Qn,D,clk,rstn);
input D,clk,rstn;
output Q,Qn;
wire Dn, So, Ro;
not #0.05 n0(Dn,D);
nand #0.03 nd0(So,D,clk);
nand #0.02 nd1(Ro,Dn,clk);
nand #0.01 nd2(Q,So,Qn,rstn);
nand #0.02 nd3(Qn,Ro,Q,rstn);
endmodule
//第二个图:edged D Flip Flop with reset.
module E_D_Flip_Flop(Q,Qn,D,clk,resetn);
input D,clk,resetn;
output Q,Qn;
wire clkn,Qm;
not #0.01 n0(clkn,clk);
Gated_D_Latch D_Master(Qm,,D,clk,resetn);
Gated_D_Latch D_Slave(Q,Qn,Qm,clkn,resetn);
endmodule
其中, D latch是这个图:
edged flip-flop如下图:
modelsim里的runtime options->iteration limit一般是5000,如果迭代次数不够,就将5000改大一些,但是如果改大了还有错误,说明环路迭代停止条件设置错误,导致迭代无限循环下去
testbench中写了时间尺度了没。就是 `timescale 1ns/1ps