簡體   English   中英

在 Verilog 中使用門級描述的 JK 觸發器給我一個時序錯誤

[英]JK-flip flop using gate level description in Verilog give me a timming error

我仍然在最低的 Verilog 級別(門級別)玩。 我在其中找到了這篇文章: https : //electronics.stackexchange.com/questions/390661/is-it-possible-to-create-a-working-jk-flip-flop-using-gate-level-description-in我可以理解應該可以實現這個想法,並且我可以解決使用主從 JK 觸發器將其用作分頻器。 我使用 Icestorm 工具鏈,Yosys 沒有抱怨,但 Next-PNR 給了我這個錯誤:

ERROR:由於存在組合循環、時序端口規范不完整等,時序分析失敗。

這是我的代碼:

module syncRX(clk, signal, detect);
    output wire [7:0] detect;
    input clk, signal;
    
    reg [6:0] det = 7'b1001010;
    
    assign detect = {det, jk5_out};
    
    jk_flip_flop_edge_triggered jk0(.Q(jk5_out), .Qn(Qn), .C(clk), .J(1), .K(1), .RESETn(0));

endmodule // top

module jk_flip_flop_edge_triggered(Q, Qn, C, J, K, RESETn);
   output Q;
   output Qn;
   input  C;
   input  J;
   input  K;
   input  RESETn;

   wire   Kn;   // The complement of the K input.
   wire   D;   
   wire   D1;   // Data input to the D latch.   
   wire   Cn;   // Control input to the D latch.
   wire   Cnn;  // Control input to the SR latch.
   wire   DQ;   // Output from the D latch, inputs to the gated SR latch (S).
   wire   DQn;  // Output from the D latch, inputs to the gated SR latch (R).

   assign D1 = !RESETn ? 0 : D;  // Upon reset force D1 = 0

   not(Kn, K);   
   and(J1, J, Qn);
   and(K1, Kn, Q);   
   or(D, J1, K1);   
   not(Cn, C);
   not(Cnn, Cn);   
   d_latch dl(DQ, DQn, Cn, D1);
   sr_latch_gated sr(Q, Qn, Cnn, DQ, DQn);   
endmodule

module d_latch(Q, Qn, G, D);
   output Q;
   output Qn;
   input  G;   
   input  D;

   wire   Dn; 
   wire   D1;
   wire   Dn1;

   not(Dn, D);   
   and(D1, G, D);
   and(Dn1, G, Dn);   
   nor(Qn, D1, Q);
   nor(Q, Dn1, Qn);
endmodule

module sr_latch_gated(Q, Qn, G, S, R);
   output Q;
   output Qn;
   input  G;   
   input  S;
   input  R;

   wire   S1;
   wire   R1;
   
   and(S1, G, S);
   and(R1, G, R);   
   nor(Qn, S1, Q);
   nor(Q, R1, Qn);
endmodule

好吧,如果我問發生了什么,我可以想象答案,我想知道為什么以及如何使它起作用! 謝謝大家!

循環:

引腳syncRX.jk0.dl.D --> 引腳syncRX.jk0.dl.Q/Qn --> 引腳syncRX.jk0.sr.S/R --> 引腳syncRX.jk0.sr.Q/Qn -->引腳syncRX.jk0.dl.D

如果您從標准庫中實例化鎖存單元,則與時序路徑和時序檢查相關的問題將由該單元處理。

我當然認為每個著名的實現工具都會報告循環。 但是既然你說Yosys沒有抱怨,我也很困惑(我沒有用過Yosys。)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM