當前位置:編程學習大全網 - 網站源碼 - FPGA verilog中能否寫出來壹個保證,只有在每當0-3號按鍵任意壹個按下,程序會運行壹次!只運行壹次!

FPGA verilog中能否寫出來壹個保證,只有在每當0-3號按鍵任意壹個按下,程序會運行壹次!只運行壹次!

程序只運行壹次功能,建議用T觸發器實現,可實現 鎖按鍵信號,使按鍵只能第壹次有效。

當復位時,Q_out<=0;其他時輸出結果為Q_out<=in^Q_out。

T觸發器模塊,代碼:

module T_trigger(rst,in,Q_out);

input rst,in;

output Q_out;

reg Q_out;

always@(in or rst)

begin

if(!rst)Q_out<=0;

else Q_out<=in^Q_out;

end

endmodule

至於,數碼管顯示,可參考我下面的程序看看:

module shumaguan(data,rst,m1,m2);

input rst;

input[4:0]data;

output[6:0]m1,m2;

reg[6:0]m1,m2;

reg[3:0]n1,n2;

reg[7:0]db[9:0];

parameter

db[0]=7'b1000000;db[1]=7'b1111001;db[2]=7'b0100100;db[3]=7'b0110000;db[4]=7'b0011001;

db[5]=7'b0010010;db[6]=7'b0000010;db[7]=7'b1111000;db[8]=7'b0000000;db[9]=7'b0010000;

always@(data)

begin

if(!rst)

begin

m1<=db[0];

m2<=db[0];

end

else

begin

n1<=data/'d10;

n2<=data%'d10;

m1<=db[n1];

m2<=db[n2];

end

end

endmodule

  • 上一篇:如何在MAC上安裝make 以及 wget
  • 下一篇:鬥魚怎麽參與抽獎呢
  • copyright 2024編程學習大全網