數(shù)字鐘報告西安交通大學_第1頁
數(shù)字鐘報告西安交通大學_第2頁
數(shù)字鐘報告西安交通大學_第3頁
數(shù)字鐘報告西安交通大學_第4頁
數(shù)字鐘報告西安交通大學_第5頁
已閱讀5頁,還剩7頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領

文檔簡介

1、精選優(yōu)質文檔-傾情為你奉上 HDL綜合實驗報告 學號: 電氣 班 一.實驗目的通過使用ISE13.4和FPGA進行簡單邏輯門的設計與實現(xiàn),進而達到以下目的:1)學習使用ISE軟件生成一個新工程文件;2)學習使用HDL進行電路設計;3)學會編輯頂層文件和用戶約束文件;4)熟悉仿真、綜合、實現(xiàn)以及FPGA配置等;5)熟悉在Basys2開發(fā)板上的簡單外圍設備的控制。二.實驗要求數(shù)字鐘 設計一個完整的數(shù)字鐘,小時和分鐘用數(shù)碼管顯示,秒用發(fā)光二極管閃爍顯示,每秒閃爍。如有可能,請增加校時功能(P162,(2)。三.實驗內容1).工程文件的建立 操作步驟: File-New Project-輸入工程文件名

2、-選擇Family:Spartan 3E;Device:XC3S100E;Package:CP132;Preferred Language:Verilog-Finish2) .輸入HDL(Verilog)程序 操作步驟: Project-New Source-選擇Verilog Module-輸入文件名-Next-Finish-進入程序輸入頁面-編寫邏輯門的Verilog程序如下:timescale 1ns / 1ps/ Company: / Engineer: / / Create Date: 13:26:34 05/07/2014 / Design Name: / Module Name:

3、 CLock_top / Project Name: / Target Devices: / Tool versions: / Description: / Dependencies: / Revision: / Revision 0.01 - File Created/ Additional Comments: /module CLock_top( input wire clk, input wire clr, input wire addBtn0, input wire addBtn1, input wire addBtn2, output Second_Flash, output 6:0

4、 a_to_g, output 3:0 an ); wire 3:0 Second_L; wire 3:0 Second_H; wire 3:0 Minute_L; wire 3:0 Minute_H; wire 3:0 Hour_L; wire 3:0 Hour_H; wire jinwei1; wire jinwei2; SecondPulse U0(.clk(clk),.clr(clr),.sec(Second_Flash);cnt60 U1(.clk(Second_Flash),.clr(clr),.cnt60_L(Second_L),.cnt60_H(Second_H),.carry

5、(jinwei1);cnt60 U2(.clk(jinwei1|addBtn0),.clr(clr),.cnt60_L(Minute_L),.cnt60_H(Minute_H),.carry(jinwei2),.an(addBtn0);cnt24 U4(.clk(jinwei2|addBtn2),.clr(clr),.cnt24_L(Hour_L),.cnt24_H(Hour_H),.carry(carry);disp U3(.clk(clk),.LED0_num(Minute_L),.LED1_num(Minute_H),.LED2_num(Hour_L),.LED3_num(Hour_H)

6、,.a_to_g(a_to_g),.an(an);endmodulemodule SecondPulse(input wire clk,input wire clr,output reg sec);reg 26:0 q1;always(posedge clk or posedge clr)beginif(clr=1)q1<=0;else if(q1=)beginq1<=0;sec=sec;endelseq1<=q1+1;endendmodulemodule cnt60(input wire clk,input wire clr,input wire an,output reg

7、3:0cnt60_L,output reg3:0cnt60_H,output reg carry);initial begincnt60_L=0;cnt60_H=0;endalways(posedge clk or posedge clr)beginif(clr=1)begincnt60_L<=0;cnt60_H<=0;endelsebegincarry<=0;cnt60_L<=cnt60_L+1;if(cnt60_L=9)begincnt60_L<=0;cnt60_H<=cnt60_H+1;endif(cnt60_H=5&&cnt60_L=

8、9)begincnt60_L<=0;cnt60_H<=0;if(an=0)carry<=1;endendendendmodulemodule cnt24(input wire clk,input wire clr,output reg3:0cnt24_L,output reg3:0cnt24_H,output reg carry);initial begincnt24_L=0;cnt24_H=0;endalways(posedge clk or posedge clr)beginif(clr=1)begincnt24_L<=0;cnt24_H<=0;endelse

9、begincarry<=0;cnt24_L<=cnt24_L+1;if(cnt24_L=9)begincnt24_L<=0;cnt24_H<=cnt24_H+1;endif(cnt24_H=2&&cnt24_L=3)begincnt24_L<=0;cnt24_H<=0;carry<=1;endendendendmodulemodule disp(input wire clk,input 3:0LED0_num,input 3:0LED1_num,input 3:0LED2_num,input 3:0LED3_num,output reg

10、6:0a_to_g,output reg3:0 an);reg1:0s;reg3:0 digit;reg16:0 clkdiv;always(*)beginan=4'b1111;s<=clkdiv16:15;ans=0;case(s)0:digit<=LED0_num3:0;1:digit<=LED1_num3:0;2:digit<=LED2_num3:0;3:digit<=LED3_num3:0;default:digit<=LED3_num3:0;endcasecase(digit)0:a_to_g=7'b;1:a_to_g=7'

11、b;2:a_to_g=7'b;3:a_to_g=7'b;4:a_to_g=7'b;5:a_to_g=7'b;6:a_to_g=7'b;7:a_to_g=7'b;8:a_to_g=7'b;9:a_to_g=7'b;'hA:a_to_g=7'b;'hB:a_to_g=7'b;'hC:a_to_g=7'b;'hD:a_to_g=7'b;'hE:a_to_g=7'b;'hF:a_to_g=7'b;default:a_to_g=7'b;e

12、ndcaseendalways(posedge clk)beginclkdiv<=clkdiv+1;endendmodule3).約束文件的編寫 操作步驟: Project-New Source-選擇Implantation Constraints File-輸入文件名-Next-Finish-輸入ucf文件如下:NET "a_to_g0"LOC=M12;NET "a_to_g1"LOC=L13;NET "a_to_g2"LOC=P12;NET "a_to_g3"LOC=N11;NET "a_to_

13、g4"LOC=N14;NET "a_to_g5"LOC=H12;NET "a_to_g6"LOC=L14;NET "an3"LOC=K14;NET "an2"LOC=M13;NET "an1"LOC=J12;NET "an0"LOC=F12;NET"clk"LOC=B8;NET"clr"LOC=A7;NET"Second_Flash"LOC=M5;NET"addBtn2"LOC=M4;NET&quo

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經(jīng)權益所有人同意不得將文件中的內容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
  • 6. 下載文件中如有侵權或不適當內容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論