[問題] Verilog小問題已刪文

看板Programming作者 (Hero)時間16年前 (2009/12/05 15:12), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/1
有一個 counter : 從 0 ~ 4 而這個 module 只有在 counter 為 1,3 的時候才 output =1 分兩個always區塊[如下] 這種方式 不知道正不正確呢 ? counter 01234 output 01010 module counter(input rst, clk, output reg out); reg [1:0]tmp; always@(posedge clk) begin if (!rst) begin tmp<=0; end else if(tmp==4) tmp<=0; else tmp<=tmp+1; end always@(tmp) if (tmp==1 || tmp==3) out=1; else out=0; end endmodule -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 24.2.127.59
文章代碼(AID): #1B6WVstw (Programming)