流水線技術原理和Verilog HDL實現(xiàn).doc_第1頁
流水線技術原理和Verilog HDL實現(xiàn).doc_第2頁
流水線技術原理和Verilog HDL實現(xiàn).doc_第3頁
全文預覽已結(jié)束

下載本文檔

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

文檔簡介

流水線技術原理和Verilog HDL實現(xiàn)所謂流水線處理,如同生產(chǎn)裝配線一樣,將操作執(zhí)行工作量分成若干個時間上均衡的操作段,從流水線的起點連續(xù)地輸入,流水線的各操作段以重疊方式執(zhí)行。這使得操作執(zhí)行速度只與流水線輸入的速度有關,而與處理所需的時間無關。這樣,在理想的流水操作狀態(tài)下,其運行效率很高。 如果某個設計的處理流程分為若干步驟,而且整個數(shù)據(jù)處理是單流向的,即沒有反饋或者迭代運算,前一個步驟的輸出是下一個步驟的輸入,則可以采用流水線設計方法來提高系統(tǒng)的工作頻率。 下面用8位全加器作為實例,分別列舉了非流水線方法、2級流水線方法和4級流水線方法。(1)非流水線實現(xiàn)方式module adder_8bits(din_1, clk, cin, dout, din_2, cout); input 7:0 din_1; input clk; input cin; output 7:0 dout; input 7:0 din_2; output cout; reg 7:0 dout; reg cout; always (posedge clk) begincout,dout = din_1 + din_2 + cin; endendmodule(2)2級流水線實現(xiàn)方式:module adder_4bits_2steps(cin_a, cin_b, cin, clk, cout, sum); input 7:0 cin_a; input 7:0 cin_b; input cin; input clk; output cout; output 7:0 sum; reg cout; reg cout_temp; reg 7:0 sum; reg 3:0 sum_temp; always (posedge clk) begincout_temp,sum_temp = cin_a3:0 + cin_b3:0 + cin; end always (posedge clk) begincout,sum = 1b0,cin_a7:4 + 1b0,cin_b7:4 + cout_temp, sum_temp; endendmodule注意:這里在always塊內(nèi)只能用阻塞賦值方式,否則會出現(xiàn)邏輯上的錯誤?。?)4級流水線實現(xiàn)方式:module adder_8bits_4steps(cin_a, cin_b, c_in, clk, c_out, sum_out); input 7:0 cin_a; input 7:0 cin_b; input c_in; input clk; output c_out; output 7:0 sum_out; reg c_out; reg c_out_t1, c_out_t2, c_out_t3; reg 7:0 sum_out; reg 1:0 sum_out_t1; reg 3:0 sum_out_t2; reg 5:0 sum_out_t3; always (posedge clk) beginc_out_t1, sum_out_t1 = 1b0, cin_a1:0 + 1b0, cin_b1:0 + c_in; end always (posedge clk) beginc_out_t2, sum_out_t2 = 1b0, cin_a3:2 + 1b0, cin_b3:2 + c_out_t1, sum_out_t1; end always (posedge clk) beginc_out_t3, sum_out_t3 = 1b0, cin_a5:4 + 1b0, cin_b5:4 + c_out_t2, sum_out_t2; end always (posedge clk) beginc_out, sum_out = 1b0, cin_a7:6 + 1b0, cin_b7:6 + c_out_t3, sum_out_t3; endendmodule總結(jié):利用流水線的設計方法,可大大提高系統(tǒng)的工作速度。這種方法可廣泛運用于各種設計,特別是大型的、對速度要求較高的系統(tǒng)設計。雖然采用流水線會增大資源的使用,但是它可降低寄存器間的傳播延時,保證系統(tǒng)維持高的系統(tǒng)時鐘速度。在實際應用中,考慮到資源的使用和速度的要求,可以根據(jù)實際情況來選擇流水線的級數(shù)以滿足設計需要。 這是一種典型的以面積換速度的設計方法。這里的“面積”主要是指設計所占用的FP

溫馨提示

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

評論

0/150

提交評論