• 方案介紹
  • 附件下載
  • 相關(guān)推薦
申請入駐 產(chǎn)業(yè)圖譜

可變模式計數(shù)器設(shè)計Verilog代碼Quartus AX301開發(fā)板

加入交流群
掃碼加入
獲取工程師必備禮包
參與熱點資訊討論

2-231216195141F7.doc

共1個文件

名稱:Quartus可變模式計數(shù)器設(shè)計Verilog代碼AX301開發(fā)板

軟件:Quartus

語言:Verilog

代碼功能:可變模式計數(shù)器設(shè)計設(shè)計模為4、8、12、16的可變計數(shù)器。 要求:(1)計數(shù)周期為0.5秒; (2)用按鍵選擇計數(shù)模式;和記數(shù)。 (3)用LED燈表示當(dāng)前計數(shù)模式 。

FPGA代碼Verilog/VHDL代碼資源下載:www.hdlcode.com

本代碼已在AX301開發(fā)板驗證,開發(fā)板如下,其他開發(fā)板可以修改管腳適配:

AX301開發(fā)板照片.png

演示視頻:

設(shè)計文檔:

1. 工程文件

2. 程序文件

3. 程序編譯

4. RTL圖

5. 管腳分配

6. Testbench

7. 仿真圖

整體仿真圖

分頻模塊

控制模塊

顯示模塊

部分代碼展示:

//控制模塊
module?mod_counter(
input?clk_2Hz,//0.5秒,2Hz
input?reset_n,//復(fù)位
input?key_1,//按鍵1
input?key_2,//按鍵2
input?key_3,//按鍵3
input?key_4,//按鍵4
output?reg?[4:0]?counter//計數(shù)器輸出
);
reg?[4:0]?mod_cnt=5'd4;
always@(posedge?clk_2Hz?or?negedge?reset_n)?
if(!reset_n)//低電平復(fù)位
mod_cnt<=5'd4;
else
if(key_1==0)//模4
mod_cnt<=5'd4;
else?if(key_2==0)//模8
mod_cnt<=5'd8;
else?if(key_3==0)//模12
mod_cnt<=5'd12;
else?if(key_4==0)//模16
mod_cnt<=5'd16;
always@(posedge?clk_2Hz?or?negedge?reset_n)?
if(!reset_n)//低電平復(fù)位
counter<=5'd0;
else
if(counter>=mod_cnt-1)//計數(shù)0~mod_cnt-1
counter<=5'd0;
else
counter<=counter+5'd1;//累加
endmodule

點擊鏈接獲取代碼文件:http://www.hdlcode.com/index.php?m=home&c=View&a=index&aid=339

  • 2-231216195141F7.doc
    下載

相關(guān)推薦