2017年11月14日 星期二

暫停與啟動按鍵分開

always@(posedge clk_L ) 
begin

if (reset)
begin
count <= 0;
pause_flag <= 0;
end
else if (pause_flag)
begin
if (!start_pre && start)
begin
count <= count+1;
pause_flag <= 0;
end
end
else if (!pause_pre && pause)
begin
count <= count;
pause_flag <= 1;
end
else
count <= count+1;

pause_pre <= pause;
start_pre <= start;
end

沒有留言:

張貼留言