0
module tff(t,i,qbprev,q,qb);
input t,i,qbprev;
output q,qb;
wire q,qb,w1;
begin
assign w1=qbprev;
if(w1==1)begin
not n1(i,i);
end
assign q=i;
not n2(qb,i);
end
endmodule
module counter(a,b,c,cin,x0,x1,x2);
input a,b,c,cin;
output x0,x1,x2;
reg a,b,c,x0,x1,x2,temp,q,qb;
[email protected](posedge cin)
begin
tff t1(.t(1) ,.i(a),.qbprev(1),.q(),.qb());
x0=q;
temp=qb;
tff t2(.t(1) ,.i(b),.qbprev(temp),.q(),.qb());
x1=q;
temp=qb;
tff t3(.t(1) ,.i(c),.qbprev(temp),.q(),.qb());
x2=q;
a=x0;
b=x1;
c=x2;
end
endmodule
這是我在Verilog中的代碼。我的輸入是 - 初始狀態 - a,b,c和cin使用T-flipflop設計3位計數器
我得到許多錯誤,其中第一個錯誤是「w1不是常量」這是什麼意思?
我也收到錯誤「非網絡端口不能模式輸入」但我想要一個輸入!
謝謝。
謝謝你,但我仍然沒有得到我能做的關於w1的事情。我想用它像鐘錶。那另一個錯誤呢? –
對於w1問題更基礎的是,您使用'i'連接模塊的輸入和輸出的方式,我無法描述解決w1問題的方案,直到解決問題。 – Morgan
我解決了使用另一個線temp1,然後使用if else部分。 –