[問題] 同步記數器初始值

看板Electronics作者 (syuan)時間7年前 (2016/10/07 09:54), 編輯推噓1(109)
留言10則, 3人參與, 最新討論串1/1
小弟我最近有個問題 我試著利用verilog邏輯閘拚出一個同步記數器 發現功能如果分開測的話應該是正常的 但是現在發現我DFF的初始值,不知道怎麼給導致功能無法正常運作 想請問一下大大有沒有啥建議? module counter_3b (rst_n, clk, cnt); input rst_n, clk; output [2:0]cnt; assign d2 = cnt[0] ^ cnt [1]; assign d3 = (cnt[0] & cnt[1]) ^ cnt[2]; assign clk_r = clk & rst_n; //rst功能 assign init_d = 1'b0 | cnt[0]; D_type DFF1(.CP(clk_r), .D(init_d), .Q(cnt[0]), .Q_bar(dff1b_out)); D_type DFF2(.CP(clk_r), .D(d2), .Q(cnt[1]), .Q_bar(dff2b_out)); D_type DFF3(.CP(clk_r), .D(d3), .Q(cnt[2]), .Q_bar(dff3b_out)); module D_type (CP_clk, D, Q, Q_bar); input CP_clk, D; output Q, Q_bar; nand nand_1 (out_1, out_4, out_2); nand nand_2 (out_2, out_1, CP_clk); nand nand_3 (out_3, out_2, CP_clk, out_4); nand nand_4 (out_4, out_3, D); nand nand_5 (Q, out_2, Q_bar); nand nand_6 (Q_bar, Q, out_3); endmodule -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 211.75.124.162 ※ 文章網址: https://www.ptt.cc/bbs/Electronics/M.1475805278.A.D70.html

10/07 10:26, , 1F
none..
10/07 10:26, 1F

10/07 10:56, , 2F
1. DFF1 的 Q 要接到 DFF2 的 D
10/07 10:56, 2F

10/07 10:56, , 3F
2. 通常會用 set / reset的機制進行初始化設計
10/07 10:56, 3F

10/07 10:59, , 4F
習慣上會用 behavior model 取代 instantiate cell 的寫
10/07 10:59, 4F

10/07 10:59, , 5F
10/07 10:59, 5F

10/07 11:01, , 6F
3. 除非限用 cell library / full customer 的流程,
10/07 11:01, 6F

10/07 11:01, , 7F
習慣上會用 behavior model 取代 instantiate cell 的寫
10/07 11:01, 7F

10/07 11:01, , 8F
法。X
10/07 11:01, 8F

10/07 11:09, , 9F
因為我想用cell lib的方式寫看看,下部的dff不做更改,只
10/07 11:09, 9F

10/07 11:09, , 10F
能在外部電路設計!
10/07 11:09, 10F
文章代碼(AID): #1Nzm1Urm (Electronics)