九九热最新网址,777奇米四色米奇影院在线播放,国产精品18久久久久久久久久,中文有码视频,亚洲一区在线免费观看,国产91精品在线,婷婷丁香六月天

華中科技大學Verilog語言實驗報告.docx

上傳人:good****022 文檔編號:116537878 上傳時間:2022-07-05 格式:DOCX 頁數(shù):34 大?。?.11MB
收藏 版權(quán)申訴 舉報 下載
華中科技大學Verilog語言實驗報告.docx_第1頁
第1頁 / 共34頁
華中科技大學Verilog語言實驗報告.docx_第2頁
第2頁 / 共34頁
華中科技大學Verilog語言實驗報告.docx_第3頁
第3頁 / 共34頁

下載文檔到電腦,查找使用更方便

12 積分

下載資源

還剩頁未讀,繼續(xù)閱讀

資源描述:

《華中科技大學Verilog語言實驗報告.docx》由會員分享,可在線閱讀,更多相關(guān)《華中科技大學Verilog語言實驗報告.docx(34頁珍藏版)》請在裝配圖網(wǎng)上搜索。

1、2016Verilog 語言 實驗報告專 業(yè):計算機科學與技術(shù)班 級:CS1409學 號:U201414813姓 名:唐禮威電 話:15827505005郵 件:完成日期:2016.6.13華 中 科 技 大 學 課 程 實 驗 報 告目 錄1數(shù)據(jù)通路實驗11.1實驗目的11.2實驗內(nèi)容及要求11.3實驗方案21.4實驗步驟21.5故障及分析21.6仿真與結(jié)果31.7心得與體會42FSM實驗52.1實驗目的52.2實驗內(nèi)容及要求52.3實驗方案62.4實驗步驟62.5故障及分析72.6仿真與結(jié)果72.7心得與體會83意見和建議94附錄1011 數(shù)據(jù)通路實驗1.1 實驗目的綜合應用掌握的簡單組合

2、電路和時序電路的設計方法,完成一個簡單的數(shù)據(jù)通路的設計。1.2 實驗內(nèi)容及要求1. 根據(jù)下圖給出的數(shù)據(jù)通路(圖中R0、R1和ACC是寄存器,+是加法器,其它則是多路選擇器),完成相應的Verilog程序設計,圖中數(shù)據(jù)線的寬度為8位,要求可以擴充至16位或者是32位;2. 根據(jù)下圖給出的數(shù)據(jù)通路(圖中SUM和NEXT是寄存器,Memory是存儲器,+是加法器,=0是比較器,其它則是多路選擇器),完成相應的Verilog程序設計,圖中數(shù)據(jù)線的寬度為8位,要求可以擴充至16位或者是32位。實驗要求:程序必須自己編寫,滿足數(shù)據(jù)通路設計要求,綜合結(jié)果正確。1.3 實驗方案根據(jù)要求,先把選擇器、加法器、寄

3、存器、比較器和存儲器分模塊編寫,在主模塊中根據(jù)數(shù)據(jù)通路調(diào)用即可。題目中要求數(shù)據(jù)線寬度為8位,并且可以擴充至16位或32位,所以在前面定義WIDTH,利用parameter的參數(shù)傳遞功能來實現(xiàn)。1.4 實驗步驟1.分模塊編寫代碼(見附錄)2.運行綜合Run Synthesis3.綜合成功后檢查RTL Analysis中的電路圖Schematic1.5 故障及分析剛開始跑出來很多線是斷的,后來發(fā)現(xiàn)是引腳對應部分的代碼沒有寫完整。后來加法器和ACC的參數(shù)順序?qū)戝e,導致接線與題給的不一致,發(fā)現(xiàn)問題后及時改正了。1.6 仿真與結(jié)果Schematic圖形如下:第一個數(shù)據(jù)通路:第二個數(shù)據(jù)通路:由以上兩圖可得

4、,成功完成了要求的數(shù)據(jù)通路的設計,滿足了各基本器件的輸入輸出鏈接要求;改變數(shù)據(jù)線寬度后再檢查電路圖,發(fā)現(xiàn)數(shù)據(jù)線做出相應改變,完成該實驗。1.7 心得與體會對數(shù)據(jù)通路的設計有了更好的理解,明白了數(shù)據(jù)通路的基本器件構(gòu)成,熟悉了這些器件的功能和端口,掌握了Verilog完成基本運算器件的設計,完成了數(shù)據(jù)通路的設計。 2 FSM實驗2.1 實驗目的掌握用Verilog語言進行FSM設計、實現(xiàn)和仿真的方法。2.2 實驗內(nèi)容及要求5.1_1、用FSM實現(xiàn)一個mealy型序列檢測器,對一位的串行輸入序列中的“1”的數(shù)量進行檢測。如果“1”的總數(shù)可以被3整除,輸出“1”,否則輸出“0”。5.1_2、用FSM實

5、現(xiàn)一個moore型序列檢測器,對兩位的串行輸入序列進行檢測。輸入01,00時,輸出0,輸入11,00時,輸出1,輸入10,00時,輸出反向。5.1_3、用FSM實現(xiàn)一個計數(shù)器(采用存儲器),對一位的輸入進行計數(shù)。計數(shù)序列為:000,001,011,101,111,010。5.2、用FSM實現(xiàn)一個序列識別器,該FSM的狀態(tài)轉(zhuǎn)移圖如下所示,它能夠?qū)σ晃坏拇休斎胄蛄兄械摹?”的數(shù)量進行檢測。如果FSM發(fā)現(xiàn)輸入“1”的總數(shù)可以被3整除時,輸出“1”;否則,輸出“0”。同時針對“01011011101”輸入序列,寫出相應的仿真程序并進行真波測試。2.3 實驗方案先根據(jù)要求畫出狀態(tài)圖,根據(jù)狀態(tài)圖編寫程序

6、,根據(jù)程序編寫仿真程序,最后得出結(jié)果和結(jié)論。2.4 實驗步驟5.1_1狀態(tài)圖:S1S0 in=1/1 in=1/0 in=0/0 in=1/0 in=1/0S4S3 in=0/0 in=1/1 in=0/05.1_2狀態(tài)圖:S0 in=00 in=01 in=10 in=11S2S1S3S6S5S4 in=00 in=00 in=00 out=0 out翻轉(zhuǎn) out=15.1_3狀態(tài)圖:1.根據(jù)以上狀態(tài)圖編寫源程序(見附錄)2.運行綜合Run Synthesis3.綜合正確后編寫仿真程序4.仿真,得到仿真波形,驗證結(jié)果2.5 故障及分析無故障2.6 仿真與結(jié)果5.1_1:如圖,1的個數(shù)是3的倍

7、數(shù)時輸出1與預期一致5.1_2:如圖,輸入01后再輸入00,輸出0;輸入11后再輸入00,輸出1;輸入10后再輸入00,輸出翻轉(zhuǎn):與預期一致5.1_3:如圖,輸出序列為000,001,011,101,111,010(重復)與預期一致5.2:如圖,1的個數(shù)是3的倍數(shù)時輸出1與預期一致2.7 心得與體會這次實驗通過FSM設計明白了設計的過程和步驟,首先要知道分為哪些狀態(tài),設計的是何種電路,如何選擇用mealy還是moore型電路,狀態(tài)轉(zhuǎn)移要如何實現(xiàn)。知道了mealy型和moore型電路的區(qū)別:當要求輸出對輸入快速響應并希望電路簡單時選擇mealy型,當要求時序輸出穩(wěn)定,能接受輸出序列晚一個周期,即

8、選擇moore型電路不增加電路復雜性時,選擇moore型電路。3 意見和建議建議老師上課還是用中文PPT比較好,另外作業(yè)練習也用中文給出來,題目要求也盡量具體些,這樣會減少我們學習的成本,更加有效的學習這門課。4 附錄源程序:4.1(第一個數(shù)據(jù)通路)/主模塊module text4(S0,S1,S2,S3,Clk,reset,load,outR0,outR1,outACC,outS0,outS1,outS2,outS3,outA); parameter WIDTH=8; /位寬8位 input S0,S1,S2,S3,Clk,reset,load; output WIDTH-1:0 outR0

9、,outR1,outACC,outS0,outS1,outS2,outS3,outA; register #(8) R0(inR0,Clk,reset,load,outR0); register #(8) R1(inR1,Clk,reset,load,outR1); register #(8) ACC(inACC,Clk,reset,load,outACC); mux #(8) S0(S0,inS00,inS01,outS0); mux #(8) S1(S1,inS10,inS11,outS1); mux #(8) S2(S2,inS20,inS21,outS2); mux #(8) S3(S

10、3,inS30,inS31,outS3); add #(8) W1(inA0,inA1,outA); assign inS00=outS3; assign inS10=outS3; assign inS01=outR0; assign inS20=outR0; assign inS11=outR1; assign inS21=outR1; assign inA0=outACC; assign inS31=outACC; assign inACC=outA; assign inA1=outS2; assign inS30=outS2; assign inR1=outS1; assign inR0

11、=outS0;endmodule/加法器模塊module add(A,B,C); parameter WIDTH=8; input WIDTH-1:0 A, B; output WIDTH-1:0 C; wire WIDTH:0 DATA; assign DATA=A+B; assign C=DATA7:0;endmodule/寄存器模塊module register(D,Clk,reset,load,Q); parameter WIDTH=8; input WIDTH-1:0 D; input Clk,reset,load; output reg WIDTH-1:0 Q;always (po

12、sedge Clk)if (reset)beginQ = 8b0;end else if (load)beginQ b) out=1; else out=0; endendmodule/存儲器模塊module ROM(ROM_data, ROM_addr);parameter data_WIDTH=8;parameter addr_WIDTH=8;output addr_WIDTH-1:0 ROM_data;input addr_WIDTH-1:0 ROM_addr;reg addr_WIDTH-1:0 ROM data_WIDTH-1:0; / defining 4x2 ROMassign

13、ROM_data = ROMROM_addr; / reading ROM content at the address ROM_addrinitial $readmemb (ROM_data.txt, ROM, 0, 3); / load ROM content from ROM_data.txt fileendmodule/寄存器模塊module register(D,Clk,reset,load,Q); parameter WIDTH=8; input WIDTH-1:0 D; input Clk,reset,load; output reg WIDTH-1:0 Q;always (po

14、sedge Clk)if (reset)beginQ = 8b0;end else if (load)beginQ = D;endendmodule/加法器模塊module add(A,B,C); parameter WIDTH=8; input WIDTH-1:0 A, B; output WIDTH-1:0 C; wire WIDTH:0 DATA; assign DATA=A+B; assign C=DATA7:0;endmodule/二路選擇器模塊module mux(s,x,y,m); parameter WIDTH=8; input WIDTH-1:0 x,y; input s;

15、output WIDTH-1:0 m;assign m =(s?y:x);endmodule5.1_1module lab5_1_1(input clk, input reset, input ain, output reg yout, output reg 3:0 count); reg 1:0 state, nextstate; parameter S0=0, S1=1, S2=2, S3=3; always (posedge clk) / always block to update state if (reset) begin state = S0; count = 0; end el

16、se state = nextstate; always (state or ain) / always block to compute output begin yout = 0; case(state) S0: if(!ain) yout = 1; S1: yout = 0; S2: yout = 0; S3: if(ain) yout = 1; endcase end always (posedge clk) / always block to compute output begin if(ain) count = count + 1; end always (state or ai

17、n) / always block to compute nextstate begin case(state) S0: if(ain) nextstate = S1; else nextstate = S0; S1: if(ain) nextstate = S2; else nextstate = S1; S2: if(ain) nextstate = S3; else nextstate = S2; S3: if(ain) nextstate = S1; else nextstate = S3; endcase end endmodule仿真程序:module lab5_1_1_tb();

18、 reg clk,reset,ain; wire yout; wire 3:0 count; integer i; parameter TIME = 400; parameter DELAY = 5; lab5_1_1 DUT (.clk(clk), .ain(ain), .count(count), .reset(reset), .yout(yout); initial begin #TIME $finish; end initial begin clk = 0; for(i = 0; i (TIME/DELAY); i = i + 1) #DELAY clk = clk; end init

19、ial begin reset = 1; #(4*DELAY) reset = 0; #(34*DELAY) reset = 1; #(2*DELAY) reset = 0; end initial begin ain = 0; #(8*DELAY) ain = ain; #(4*DELAY) ain = ain; #(12*DELAY) ain = ain; #(8*DELAY) ain = ain; #(4*DELAY) ain = ain; #(6*DELAY) ain = ain; #(6*DELAY) ain = ain; endendmodule5.1_2module lab5_1

20、_2(input clk, input reset, input 1:0 x, output reg yout, output reg 2:0 nextstate); reg 2:0 state; parameter S0=0, S11=1, S21=2, S31=3, S12=4, S22=5, S32=6; always (posedge clk) / always block to update state if (reset) begin state = S0; nextstate = S0; yout = 0; end else state = nextstate; always (

21、state) / always block to compute output begin case(state) S0: yout = yout; S12: yout = 0; S22: yout = 1; S32: yout = yout; endcase end always (state or x) / always block to compute nextstate begin case(state) S0: if(x = 1) nextstate = S11; else if(x = 3) nextstate = S21; else if(x = 2) nextstate = S

22、31; S11: if(x = 0) nextstate = S12; else if(x = 1) nextstate = S11; else if(x = 3) nextstate = S21; else if(x = 2) nextstate = S31; S12: if(x = 1) nextstate = S11; else if(x = 3) nextstate = S21; else if(x = 2) nextstate = S31; S21: if(x = 0) nextstate = S22; else if(x = 1) nextstate = S11; else if(

23、x = 3) nextstate = S21; else if(x = 2) nextstate = S31; S22: if(x = 1) nextstate = S11; else if(x = 3) nextstate = S21; else if(x = 2) nextstate = S31; S31: if(x = 0) nextstate = S32; else if(x = 1) nextstate = S11; else if(x = 3) nextstate = S21; else if(x = 2) nextstate = S31; S32: if(x = 1) nexts

24、tate = S11; else if(x = 3) nextstate = S21; else if(x = 2) nextstate = S31; endcase endendmodule仿真程序:module lab5_1_2_tb(); reg clk,reset; reg 1:0 x; wire 2:0 nextstate; wire yout; integer i; parameter TIME = 200; parameter DELAY = 5; lab5_1_2 DUT (.clk(clk), .x(x), .reset(reset), .yout(yout), .nexts

25、tate(nextstate); initial begin #TIME $finish; end initial begin clk = 0; for(i = 0; i (TIME/DELAY); i = i + 1) #DELAY clk = clk; end initial begin reset = 1; #(4*DELAY) reset = 0; end initial begin x = 0; #(8*DELAY) x = 3; #(2*DELAY) x = 2; #(2*DELAY) x = 0; #(4*DELAY) x = 2; #(2*DELAY) x = 0; #(2*D

26、ELAY) x = 3; #(2*DELAY) x = 0; #(2*DELAY) x = 1; #(2*DELAY) x = 0; #(2*DELAY) x = 2; #(2*DELAY) x = 3; #(2*DELAY) x = 0; #(6*DELAY) x = 2; #(6*DELAY) x = 0; endendmodule5.1_3module lab5_1_3(input clk, input reset, input x, output reg 2:0 yout, output reg 2:0 nextstate); reg 2:0 state; parameter S0=0

27、, S1=1, S2=2, S3=3, S4=4, S5=5; always (posedge clk) / always block to update state if (reset) begin state = S0; nextstate = S0; end else state = nextstate; always (state or x) / always block to compute output begin case(state) S0: yout = 0; S1: yout = 1; S2: yout = 3; S3: yout = 5; S4: yout = 7; S5

28、: yout = 2; endcase end always (x or state) / always block to compute nextstate begin case(state) S0: if(x) nextstate = S1; else nextstate = S0; S1: if(x) nextstate = S2; else nextstate = S1; S2: if(x) nextstate = S3; else nextstate = S2; S3: if(x) nextstate = S4; else nextstate = S3; S4: if(x) next

29、state = S5; else nextstate = S4; S5: if(x) nextstate = S0; else nextstate = S5; endcase endendmodule仿真程序:module lab5_1_3_tb(); reg clk,reset; reg x; wire 2:0 nextstate; wire 2:0 yout; integer i; parameter TIME = 400; parameter DELAY = 5; lab5_1_3 DUT (.clk(clk), .x(x), .reset(reset), .yout(yout), .n

30、extstate(nextstate); initial begin #TIME $finish; end initial begin clk = 0; for(i = 0; i (TIME/DELAY); i = i + 1) #DELAY clk = clk; end initial begin reset = 1; #(4*DELAY) reset = 0; end initial begin x = 0; #(8*DELAY) x = 1; #(2*DELAY) x = 1; #(2*DELAY) x = 0; #(2*DELAY) x = 1; #(2*DELAY) x = 0; #

31、(2*DELAY) x = 1; #(2*DELAY) x = 0; #(2*DELAY) x = 1; #(2*DELAY) x = 0; #(2*DELAY) x = 1; #(2*DELAY) x = 1; #(2*DELAY) x = 0; #(2*DELAY) x = 1; #(2*DELAY) x = 0; #(2*DELAY) x = 1; #(2*DELAY) x = 0; #(2*DELAY) x = 1; #(2*DELAY) x = 0; endendmodule5.2module lab5_2_1(input clk, input reset, input ain, o

32、utput reg yout, output reg 3:0 count); reg 1:0 state, nextstate; parameter S0=0, S1=1, S2=2, S3=3; always (posedge clk) / always block to update state if (reset) begin state = S0; count = 0; end else begin state = nextstate; if(ain) count = count + 1; end always (state) / always block to compute out

33、put begin yout = 0; case(state) S0: yout = 0; S1: yout = 0; S2: yout = 0; S3: yout = 1; endcase end always (posedge clk) / always block to compute output begin end always (state or ain) / always block to compute nextstate begin case(state) S0: if(ain) nextstate = S1; else nextstate = S0; S1: if(ain)

34、 nextstate = S2; else nextstate = S1; S2: if(ain) nextstate = S3; else nextstate = S2; S3: if(ain) nextstate = S1; else nextstate = S3; endcase end endmodule仿真程序:module lab5_2_1_tb(); reg clk,reset,ain; wire yout; wire 3:0 count; integer i; parameter TIME = 400; parameter DELAY = 5; lab5_2_1 DUT (.c

35、lk(clk), .ain(ain), .count(count), .reset(reset), .yout(yout); initial begin #TIME $finish; end initial begin clk = 0; for(i = 0; i (TIME/DELAY); i = i + 1) #DELAY clk = clk; end initial begin reset = 1; #(4*DELAY) reset = 0; #(34*DELAY) reset = 1; #(2*DELAY) reset = 0; end initial begin ain = 0; #(

36、8*DELAY) ain = ain; #(4*DELAY) ain = ain; #(12*DELAY) ain = ain; #(8*DELAY) ain = ain; #(4*DELAY) ain = ain; #(6*DELAY) ain = ain; #(6*DELAY) ain = ain; endendmodul指導教師評定意見一、原創(chuàng)性聲明 本人鄭重聲明本報告內(nèi)容,是由作者本人獨立完成的。有關(guān)觀點、方法、數(shù)據(jù)和文獻等的引用已在文中指出。除文中已注明引用的內(nèi)容外,本報告不包含任何其他個人或集體已經(jīng)公開發(fā)表的作品成果,不存在剽竊、抄襲行為。 特此聲明!作者簽字: 二、對實驗的學術(shù)評語 三、對實驗的評分評分項目(分值)報告撰寫(30分)實驗過程(70分)最終評定(100分)得分 指導教師簽字: 年 月 日

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

相關(guān)資源

更多
正為您匹配相似的精品文檔
關(guān)于我們 - 網(wǎng)站聲明 - 網(wǎng)站地圖 - 資源地圖 - 友情鏈接 - 網(wǎng)站客服 - 聯(lián)系我們

copyright@ 2023-2025  zhuangpeitu.com 裝配圖網(wǎng)版權(quán)所有   聯(lián)系電話:18123376007

備案號:ICP2024067431-1 川公網(wǎng)安備51140202000466號


本站為文檔C2C交易模式,即用戶上傳的文檔直接被用戶下載,本站只是中間服務平臺,本站所有文檔下載所得的收益歸上傳人(含作者)所有。裝配圖網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對上載內(nèi)容本身不做任何修改或編輯。若文檔所含內(nèi)容侵犯了您的版權(quán)或隱私,請立即通知裝配圖網(wǎng),我們立即給予刪除!