//以下程式如果要正常執行,需要加入按鍵去抖部分
always@( posedge clk )
begin
if( !rst )
cnt
end
else
case ( {button1,button2} )
2"b00:
2"b10:
if ( cnt == "hff )
error
2"b01:
if ( cnt == "h00 )
2"b11:
endcase
//以下程式如果要正常執行,需要加入按鍵去抖部分
always@( posedge clk )
begin
if( !rst )
begin
cnt
end
else
begin
case ( {button1,button2} )
2"b00:
begin
cnt
end
2"b10:
begin
if ( cnt == "hff )
begin
cnt
error
end
else
begin
cnt
end
end
2"b01:
begin
if ( cnt == "h00 )
begin
cnt
error
end
else
begin
cnt
end
end
2"b11:
begin
cnt
end
endcase
end
end