我正在尝试使用D触发器异步复位来创建计数器。 它成功编译,但这是我在ModelSim模拟过程中得到的错误:
'error loading design'
除此之外,我还发现了其他四个错误:
# ** Error: (vopt-3053) C:/modeltech64_10.1c/examples/project3.v(48): Illegal output port connection for "'q' (1st connection)".
#
# ** Error: (vopt-3053) C:/modeltech64_10.1c/examples/project3.v(49): Illegal output port connection for "'q' (1st connection)".
#
# ** Error: (vopt-3053) C:/modeltech64_10.1c/examples/project3.v(50): Illegal output port connection for "'q' (1st connection)".
#
# ** Error: (vopt-3053) C:/modeltech64_10.1c/examples/project3.v(51): Illegal output port connection for "'q' (1st connection)".
这是该计划:
module Flipflap_TN(q,t,clk,reset);
input t,clk,reset;
output q;
reg q;
reg temp=0;
always@(negedge clk,negedge reset)
begin
if(reset)
begin
if(t==0)
temp=temp;
else
temp=~temp;
q=temp;
end
else
q=0;
end
endmodule
module counter(q,t,clk,m,reset);
input t,clk,m,reset;
output [3:0]q;
reg [3:0]q;
wire h0,h1,h2,h3;
xor(h0,clk,m);
xor(h1,q[0],m);
xor(h2,q[1],m);
xor(h3,q[2],m);
Flipflap_TN FTN1(q[0],t,h0,reset);
Flipflap_TN FTN2(q[1],t,h1,reset);
Flipflap_TN FTN3(q[2],t,h2,reset);
Flipflap_TN FTN4(q[3],t,h3,reset);
initial
begin
if(m==1 & q==4'b1111)
q=4'b0;
else if(m==0 & q==4'b1010)
q=4'b0;
end
endmodule
如何解决这些错误?