[問題] Verilog小問題已刪文
有一個 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