![Verilog連續(xù)輸入數(shù)據(jù)處理_第1頁](http://file3.renrendoc.com/fileroot_temp3/2022-1/22/51e6c624-9e1c-40bf-b84d-3efed3e190e3/51e6c624-9e1c-40bf-b84d-3efed3e190e31.gif)
![Verilog連續(xù)輸入數(shù)據(jù)處理_第2頁](http://file3.renrendoc.com/fileroot_temp3/2022-1/22/51e6c624-9e1c-40bf-b84d-3efed3e190e3/51e6c624-9e1c-40bf-b84d-3efed3e190e32.gif)
![Verilog連續(xù)輸入數(shù)據(jù)處理_第3頁](http://file3.renrendoc.com/fileroot_temp3/2022-1/22/51e6c624-9e1c-40bf-b84d-3efed3e190e3/51e6c624-9e1c-40bf-b84d-3efed3e190e33.gif)
![Verilog連續(xù)輸入數(shù)據(jù)處理_第4頁](http://file3.renrendoc.com/fileroot_temp3/2022-1/22/51e6c624-9e1c-40bf-b84d-3efed3e190e3/51e6c624-9e1c-40bf-b84d-3efed3e190e34.gif)
![Verilog連續(xù)輸入數(shù)據(jù)處理_第5頁](http://file3.renrendoc.com/fileroot_temp3/2022-1/22/51e6c624-9e1c-40bf-b84d-3efed3e190e3/51e6c624-9e1c-40bf-b84d-3efed3e190e35.gif)
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認(rèn)領(lǐng)
文檔簡介
1、連續(xù)輸入數(shù)據(jù)處理一,題目 對題目的說明: 1,當(dāng)Start信號變?yōu)榈偷臅r候,表示輸入數(shù)據(jù)無效,系統(tǒng)回到初始狀態(tài)。 2,當(dāng)Rst信號變?yōu)榈偷臅r候,系統(tǒng)復(fù)位。 3,數(shù)據(jù)輸入的過程中,系統(tǒng)可以在任意時刻復(fù)位。 4,輸入數(shù)據(jù)人為地不超過20個。二,設(shè)計思想概述考慮到這是一個時序題目,這就涉及到結(jié)果的輸出延時問題。是在數(shù)據(jù)輸入結(jié)束后立刻流出結(jié)果,還是允許延時若干時鐘周期后再流出結(jié)果,要根據(jù)具體的性能要求來決定。在我們小組的設(shè)計中,采取盡快流出結(jié)果的設(shè)計方式。即當(dāng)輸入8位全零的數(shù)據(jù)時,在時鐘下一拍就可以得到計算結(jié)果。借鑒計算機體系結(jié)構(gòu)中的流水的思想,可以考慮數(shù)據(jù)一邊輸入一邊送入相關(guān)的功能部件進行計算,主要
2、是加法器和乘法器。應(yīng)該盡可能選擇低位數(shù)的加法器和乘法器以減少設(shè)計成本。本實驗共涉及到3個加法器和2個乘法器。加法器分別是11位,14位和18位。乘法器分別是8位和18位。三,各站的描述 基本的數(shù)據(jù)流程如下,觸發(fā)器由一個時鐘clk統(tǒng)一控制。數(shù)據(jù)選擇器在此沒有畫出。四,F(xiàn)SM圖示描述 全部程序共包括9個狀態(tài),根據(jù)輸入數(shù)據(jù)是否為全零來判斷選擇狀態(tài)的轉(zhuǎn)化。初始狀態(tài)設(shè)置為State0。StateY, StateY3, StateY4分別是運算狀態(tài)。五,程序描述部分 1,主程序代碼主要部分 (1)以下是FSM控制流程always(present_state or Serial_in) begin case
3、(present_state) State0: begin Sel=3'b000; if(!Serial_in) Next_state=State0; else Next_state=State1; end State1: begin if(!Serial_in) Next_state=StateY; else Next_state=State2; endState2: begin if(!Serial_in) Next_state=StateY; else Next_state=State3; end State3: begin if(!Serial_in) Next_state=S
4、tateY3; else Next_state=State4; end State4: begin if(!Serial_in) Next_state=StateY4; else Next_state=State5; end State5: begin if(!Serial_in) Next_state=StateY; else Next_state=State5; end StateY: /output process begin Sel=3'b100; Next_state=State0; end StateY3: begin Sel=3'b010; Next_state=
5、State0; end StateY4: begin Sel=3'b001; Next_state=State0; end default: Next_state=State0; endcase end (2)數(shù)據(jù)通路代碼always(posedge clk) begin if(!Rst) begin Z0<=8'b0; Z4<=14'b0; Z5<=19'b0; Z6<=11'b0; present_state<=State0; / state jump end else begin if(!Start) begin Z0
6、<=8'b0; Z4<=14'b0; Z5<=19'b0; Z6<=11'b0; present_state<=State0; end else Z0<=Serial_in; Z4<=Z3; Z5<=Z2; Z6<=Z1; present_state<=Next_state; end end (3)內(nèi)部寄存器之間關(guān)系代碼 always(Z0 or Z4 or Z5 or Z6 or Rst or Start) /data process begin if(!Rst)|(!Start) begin Z1&
7、lt;=10'b0; Z2<=18'b0; Z3<=13'b0; end else Z1<=Z0+Z6; Z2<=Z0*Z6+Z5; Z3<=Z07:4*Z03:0+Z4; end 2,測試碼程序部分 timescale 10ns/1ns /define time module test; reg7:0 Serial_in; reg Start,Rst; reg clk; wire13:0 Y; wire17:0 Y3; wire18:0 Y4; parameter Delay=10; /delay parametermainprogram
8、 FSM_DATA(Y,Y3,Y4,Done,Serial_in,clk,Rst,Start); always #(Delay/2) clk=clk; /set clk initial /initial process begin clk=1; Rst=0; Start=0; Serial_in=8'b0; #(0.1*Delay) Start=1; Rst=1; #Delay Serial_in= 8'b0100_0010; #Delay Serial_in= 8'b0001_0010; #Delay Serial_in= 8'b1000_0010; #(0.
9、2*Delay) Rst=0; #Delay Rst=1; #(0.1*Delay) Serial_in= 8'b0010_0010; #Delay Serial_in= 8'b0001_0100; #Delay Serial_in= 8'b0000_0000; #Delay Rst=0; #Delay Rst=1; #(2*Delay) Serial_in= 8'b0000_0101; #Delay Serial_in= 8'b0000_0011; #Delay Serial_in= 8'b0001_0010; #Delay Serial_in
10、= 8'b0000_0000; #Delay Rst=0; #Delay Rst=1; #(2*Delay) Serial_in= 8'b0000_0010; #Delay Serial_in= 8'b0000_0011; #Delay Serial_in= 8'b0001_0000; #Delay Serial_in= 8'b0000_1011; #Delay Serial_in= 8'b0000_0000; #Delay Rst=0; #Delay Rst=1; #(2*Delay) Serial_in= 8'b0001_0010;
11、#Delay Serial_in= 8'b0010_0011; #Delay Serial_in= 8'b0010_0100; #Delay Serial_in= 8'b0100_0111; #Delay Serial_in= 8'b0110_0101; #Delay Serial_in= 8'b0000_0000; #(30*Delay) $finish; endinitial $monitor ($time,"Serial_in=%b Y=%b Y3=%b Y4=%b",Serial_in,Y,Y3,Y4); endmodule六
12、,仿真波形比較 選用仿真軟件:ModelSim SE 根據(jù)前面的測試碼的輸入驗證邏輯功能Serial_in= 8b0010_0010; Serial_in= 8'b0001_0100; Serial_in= 8b0000_0000; 按邏輯結(jié)果為2*2+1*4=8 二進制結(jié)果為:1000 仿真波形如下: Serial_in= 8'b0000_0101; Serial_in= 8'b0000_0011; Serial_in= 8b0001_0010; Serial_in= 8b0000_0000; 按邏輯結(jié)果為=5*3+5*18+3*18=159; 二進制結(jié)果為:1001
13、1111 仿真波形如下: Serial_in= 8'b0000_0010; Serial_in= 8'b0000_0011; Serial_in= 8'b0001_0000; Serial_in= 8'b0000_1011; Serial_in= 8'b0000_0000; 邏輯結(jié)果為:2*3+2*16+2*11+3*16+3*11+16*11=317二進制:100111101 仿真波形如下: 通過仿真可以看出,基本的邏輯功能得到了正確的實現(xiàn),而且數(shù)據(jù)一旦輸入完畢,結(jié)果在時鐘下一拍立刻輸出,實時性得到了證實。七,RTL級電路Software: Synpl
14、ify Pro Technology: Altera MAX9000Port: EPM9320Frequency: 100MHz八,結(jié)果設(shè)計分析1, 邏輯級數(shù)比較長,延時可能比較大2,3個加法器,2個乘法器3,4個數(shù)據(jù)選擇器,3個三態(tài)門4,4個D觸發(fā)器,1個ROM5,基本邏輯功能得到實現(xiàn)綜合后的圖和與預(yù)計的圖相比較相差不大,綜合后的圖所用器件不多,綜合頻率很高,能夠很好地節(jié)約成本,從邏輯結(jié)構(gòu)上來看電路也得到了優(yōu)化。九,幾點設(shè)計感悟1, 很多的方面需要考慮,遇到了很多沒有想到的問題,只有做過才會知道。For example不同always語句中不能對同一個變量賦值,仿真沒有錯誤,綜合時才發(fā)現(xiàn)。連
15、續(xù)賦值和阻塞賦值不能寫在一個循環(huán)里等等。2, 多請教一些老師朋友對自己的設(shè)計會有很大幫助。3, 對仿真綜合軟件的使用參考一些書籍,盡快熟練掌握軟件使用。附錄(主程序源代碼):module mainprogram(Y,Y3,Y4,Done,Serial_in,clk,Rst,Start); input7:0 Serial_in; / 8 bit input input clk,Start,Rst; output Y,Y3,Y4,Done; / output signals reg Done; reg2:0 Sel; /select signal reg13:0 Y; reg17:0 Y3; re
16、g18:0 Y4; reg7:0 Z0; reg10:0 Z1,Z6; reg18:0 Z2,Z5; reg13:0 Z3,Z4; /inner register define reg3:0 present_state, Next_state; /state define parameter State0= 4'b0000, /gray code State1= 4'b0001, State2= 4'b0011, State3= 4'b0010, State4= 4'b0110, State5= 4'b0100, StateY= 4'b1
17、100, StateY3=4'b1000, StateY4=4'b1001; always(posedge clk) /or negedge Rst or negedge Start) begin if(!Rst) begin Z0<=8'b0; Z4<=14'b0; Z5<=19'b0; Z6<=11'b0; present_state<=State0; / state jump end else begin if(!Start) begin Z0<=8'b0; Z4<=14'b0; Z
18、5<=19'b0; Z6<=11'b0; present_state<=State0; end /Start=0 then jump to state else Z0<=Serial_in; Z4<=Z3; Z5<=Z2; Z6<=Z1; /inner register relation present_state<=Next_state; end end always(Z0 or Z4 or Z5 or Z6 or Rst or Start) /data process begin if(!Rst)|(!Start) begin
19、 Z1<=10'b0; Z2<=18'b0; Z3<=13'b0; end else Z1<=Z0+Z6; Z2<=Z0*Z6+Z5; Z3<=Z07:4*Z03:0+Z4; end always(present_state or Serial_in) begin case(present_state) State0: /initial process begin Sel=3'b000; if(!Serial_in) Next_state=State0; else Next_state=State1; / state jump
20、 end State1: begin if(!Serial_in) Next_state=StateY; else Next_state=State2; end State2: begin if(!Serial_in) Next_state=StateY; else Next_state=State3; end State3: begin if(!Serial_in) Next_state=StateY3; else Next_state=State4; end State4: begin if(!Serial_in) Next_state=StateY4; else Next_state=State5; end State5: begin if(!Serial_in) Next_state=StateY; else Next_state=State5; end StateY: /output process begin Sel=3'b100; Next_state=State0; end
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 班主任心理健康與壓力管理的培訓(xùn)總結(jié)
- 公交掃惡除霸承諾書范本
- 2025-2030全球船用防火窗行業(yè)調(diào)研及趨勢分析報告
- 2025年全球及中國運動刺激療法行業(yè)頭部企業(yè)市場占有率及排名調(diào)研報告
- 2025年全球及中國矩形橋式起重機行業(yè)頭部企業(yè)市場占有率及排名調(diào)研報告
- 2025-2030全球便攜式鼻腔沖洗器行業(yè)調(diào)研及趨勢分析報告
- 2025-2030全球農(nóng)用氧化亞銅行業(yè)調(diào)研及趨勢分析報告
- 2025年全球及中國鋼制螺旋錐齒輪行業(yè)頭部企業(yè)市場占有率及排名調(diào)研報告
- 2025年全球及中國戶外電氣箱行業(yè)頭部企業(yè)市場占有率及排名調(diào)研報告
- 2025-2030全球軸承精密滾珠行業(yè)調(diào)研及趨勢分析報告
- 蛋糕店服務(wù)員勞動合同
- 土地買賣合同參考模板
- 2025高考數(shù)學(xué)二輪復(fù)習(xí)-專題一-微專題10-同構(gòu)函數(shù)問題-專項訓(xùn)練【含答案】
- 2025年天津市政建設(shè)集團招聘筆試參考題庫含答案解析
- 2024-2030年中國烘焙食品行業(yè)運營效益及營銷前景預(yù)測報告
- 2025年上半年水利部長江水利委員會事業(yè)單位招聘68人(湖北武漢)重點基礎(chǔ)提升(共500題)附帶答案詳解
- 寧德時代筆試題庫
- 五年級下冊北京版英語單詞
- 康復(fù)醫(yī)院患者隱私保護管理制度
- 新課標(biāo)I、Ⅱ卷 (2024-2020) 近五年高考英語真題滿分作文
- 浙江省嘉興市2023-2024學(xué)年六年級(上)期末數(shù)學(xué)試卷
評論
0/150
提交評論