可編程ASC技術.doc_第1頁
可編程ASC技術.doc_第2頁
可編程ASC技術.doc_第3頁
可編程ASC技術.doc_第4頁
可編程ASC技術.doc_第5頁
已閱讀5頁,還剩11頁未讀 繼續(xù)免費閱讀

下載本文檔

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

文檔簡介

可編程ASIC技術課程作業(yè)2014姓名:陳志豪學號:120900812班級:自動12031舉例說明阻塞賦值和非阻塞賦值有什么本質(zhì)的區(qū)別?非阻塞賦值module non_block(c,b,a,clk);output c,b; input clk,a;reg c,b;always (posedge clk) begin b=a; c=b; endendmodule阻塞賦值module block(c,b,a,clk);output c,b;input clk,a;reg c,b;always (posedge clk) begin b=a; c=b; endendmodule非阻塞賦值仿真波形圖 阻塞賦值仿真波形圖 由此可見阻塞賦值是并行賦值,非阻塞賦值是隨機的。2用持續(xù)賦值語句描述一個4選1數(shù)據(jù)選擇器。4選1的數(shù)據(jù)選擇器程序:module mux4_1(out,in1,in2,in3,in4,sel1,sel2);input in1,in2,in3,in4;output out;input sel1,sel2;assign out=sel1?(sel2?in4:in3):(sel2?in2:in1);endmodule3設計一個功能和引腳與74138類似的譯碼器,并仿真。譯碼器程序:module encoder(out, in,en);output7:0 out;/*定義八位二進制碼輸出口*/input2:0 in;/*定義三位二進制碼輸入口*/input2:0 en;/*三個使能端*/reg7:0 out;always (in or en) begin if(en=3b100) case(in) 3d0: out=8b11111110; 3d1: out=8b11111101; 3d2: out=8b11111011; 3d3: out=8b11110111; 3d4: out=8b11101111; 3d5: out=8b11011111; 3d6: out=8b10111111; 3d7: out=8b01111111; endcase else out=8b11111111; endendmodule4設計一個4位、可預置、可清零的移位寄存器,并仿真??深A置、可清零的移位寄存器程序:module shift_register(out,in,reset,set,clk);output3:0 out;/*定義四位輸出端*/input in,reset,set,clk;/*輸入信號、清零端、置數(shù)端、時鐘信號*/reg3:0 out;reg3:0 md;/*置數(shù)寄存器*/always(posedge clk)begin begin md=4b1101;end/*這里預置數(shù)為1101,可以根據(jù)需要更改*/ if(reset) begin out=0;end else begin if(set) begin out=md;end/*置數(shù)信號為1,置數(shù)*/ else begin out=out,in;end endendendmodule5設計一個上升沿觸發(fā)的可預置、可清零16進制計數(shù)器,并仿真。如果要改為10進制計數(shù)器,應對該設計做哪些修改?module counter_16(Q,en,clock,clear,S);output 3:0Q;input 3:0S;input en,clock,clear;reg3:0Q;always (posedge clock) begin if (clear=0) begin Q=4b0000; end else if(en=1) begin Q=S; end else begin Q=4b1001)Q=4b0000;/當Q的值大于等于9,跳到06分別用結(jié)構描述、數(shù)據(jù)流描述、行為描述三種方式,設計一個2位加法器,并比較上述三種方式各自的優(yōu)缺點。結(jié)構描述module full_add(a,b,cin,sum,cout);input a,b,cin;output sum,cout;wire s1,m1,m2,m3;and (m1,a,b),(m2,b,cin),(m3,a,cin);xor (s1,a,b),(sum,s1,cin);or(cout,m1,m2,m3);endmoduleinclude “full_add.v”module add_2_1(sum,cout,a,b,cin);input cin;input1:0 a,b;output1:0 sum;output cout;full_add f0(a0,b0,cin,sum0,cin1);/級聯(lián)full_add f1(a0,b0,cin1,sum1,cout);endmodule數(shù)據(jù)流描述module add_2_2 (a,b,cin,sum,cout);input cin;input 1:0 a,b;output 1:0 sum;output cout;assign cout,sum=a+b+cin;endmodule行為描述module add_2_3(cout,sum,a,b,cin); output1:0 sum; output cout; input1:0 a,b; input cin; reg1:0 sum; reg cout; always ( a or b or cin ) begin cout,sum=a+b+cin; end endmodule7利用狀態(tài)機設計一個序列檢測器,該檢測器在有“101”序列輸入時輸出為1,其他輸入情況下,輸出為0。請畫出狀態(tài)轉(zhuǎn)移圖,并用Verilog語言描述實現(xiàn),并仿真。狀態(tài)說明:S0:表示初始狀態(tài);S1:表示檢測到一個“1”信號;S2:表示檢測到一個“10”信號;S3:表示檢測到一個“101”信號;序列檢測器程序:module serial_detected(out,in,clk,reset);output out;/*結(jié)果輸出端*/input in;/*串行輸入的數(shù)據(jù)*/input reset,clk;/*清零信號、時鐘信號*/reg out;reg2:0 S,NS;parameter S0=2b00,S1=2b01,S2=2b10,S3=2b11;/*狀態(tài)編碼*/always(posedge clk or negedge reset)/*根據(jù)輸入信號更新狀態(tài)*/ begin if(!reset) S=S0; else S=NS; endalways(S or in)/*根據(jù)輸入,鎖存記憶輸入信號*/begincase(S) S0: if(in) NS=S1; else NS=S0; S1: if(in) NS=S1; else NS=S2; S2: if(in) NS=S3; else NS=S0; S3: if(in) NS=S1; else NS=S2;endcaseend always(S or reset or in) /*輸出對應的結(jié)果*/begin if(!reset) out= 0; else if(S = S3) out= 1; else out= 0; end endmodule8設計一個加法器,實現(xiàn)sum=a0+a1+a2+a3,a0、a1、a2、a3寬度都是8位。如用下面兩種方法實現(xiàn),哪種方法更好一些(即速度更快 and/or 資源更?。?。(1)sum=(a0+a1)+a2)+a3(2)sum=(a0+a1)+(a2+a3)9用流水線技術對上例中的sum=(a0+a1)+a2)+a3的實現(xiàn)方式進行優(yōu)化,對比最高工作頻率,并分析說明:流水線設計技術為什么能提高數(shù)字系統(tǒng)的工作頻率?未采用流水線技術程序:module adder8_1(sum,cout,cout1,cout2,a1,a2,a3,a4,cin,clk);output7:0 sum;/*和*/output cout1,cout2,cout;/*每執(zhí)行一個加法產(chǎn)生的進位信號*/input7:0 a1,a2,a3,a4;/*四個八位二進制數(shù)*/input cin,clk;/*cin為低位進位信號,低位加法時為0,clk為時鐘信號*/reg7:0 S1,S2,sum;reg cout1,cout2,cout;always(posedge clk)begin cout1,S1=a1+a2+cin;/*第一個時鐘來執(zhí)行第一步加法*/endalways(posedge clk)begin cout2,S2=S1+a3; /*第二個時鐘來執(zhí)行第二步加法*/endalways(posedge clk)begin cout,sum=S2+a4; /*第三個時鐘來執(zhí)行第三步加法*/endendmodule采用流水線技術程序:module addder8_3(cout1,cout2,cout3,sum,a1,a2,a3,a4,cin,clk);output7:0 sum;/*總和*/output cout1,cout2,cout3;/*每執(zhí)行兩個數(shù)相加產(chǎn)生的進位信號*/input7:0 a1,a2,a3,a4;/*四個加數(shù)*/input cin,clk;/*低位進位信號,作低位加法器為0、時鐘信號*/reg7:0 sum,sum1,sum2;reg cout1,cout2,cout3,firstc,secondc,thirdc;reg3:0 tempa1,tempa2,tempa3,tempb1,tempb2,tempb3,firstsum,secondsum,thirdsum; /*存儲每四位相加的寄存器類型數(shù)*/always(posedge clk) begin firstc,firstsum=a13:0+a23:0+cin;/*a1和a2低四位相加*/ tempa1=a17:4; tempb1=a27:4; endalways(posedge clk) begin cout1,sum17:4=tempa1+tempb1+firstc; /*a2和a2高四位相加*/ sum13:0=firstsum; endalways(posedge clk) begin secondc,secondsum=sum13:0+a33:0; /*前兩數(shù)的和的低四位和a3低四位相加*/ tempa2=sum17:4; tempb2=a37:4; endalways(posedge clk) begin cout2,sum27:4=tempa2+tempb2+secondc; /*前兩數(shù)的和的高四位和a3高四位相加*/ sum23:0=secondsum; endalways(posedge clk) begin thirdc,thirdsum=sum23:0+a43:0; /*前三數(shù)的和的低四位和a4低四位相加*/ tempa3=sum27:4; tempb3=a47:4; endalways(posedge clk) begin cout3,sum7:4=tempa3+tempb3+thirdc; /*前兩數(shù)的和的高四位和a2高四位相加*/ sum3:0=thirdsum; endendmodule一級的寄存器組將大的組合邏輯切割成小的組合邏輯,以犧牲電路的面積來換取速度的。10分析下列的Verilog HDL模塊,畫出對應的邏輯圖或?qū)懗鲞壿嫳磉_式(組),并概括地說明其邏輯功能。module exe1(out, d3, d2,d1,d0, s1,s0);output out3, out2, out1, out0;input d3, d2,d1,d0, s1,s0;not (not_s1,s1), (not_s0,s0);and (out0, d0, not_s1, not_s0), (out1, d1, not_s1, s0);and (out2, d2, s1, not_s0), (out3, d3, s1, s0);or (out, out0, out1, out2, out3);endmodule根據(jù)不同的s1和s0,輸出通道進行變化:(1) 當s1=0,s0=0時,out0=d0;(2) 當s1=0,s0=1時,out1=d1;(3) 當s1=1,s0=0時,out2=d2;(4) 當s1=1,s0=1時,out3=d3。邏輯表達式組:out0=S1S0d0out1=S1S0d1out2=S1S0d2out3=S1S0d3out=out0+out1+out2+out3實現(xiàn)的邏輯功能就是典型的數(shù)據(jù)通道選擇器11分析下列的Verilog HDL模塊,用時序波圖形或流程框圖描述其行為,并概括地說明其邏輯功能。module exe2(fd_out, clk, d, clr);output fd_out;reg fd_out;input 15:0 d;input clk, clr;reg 15:0 cnt;always (posedge clk)beginif (!clr) cnt = 4h0000;elsebegincnt = cnt - 1;if (cnt=0) begin fd_out = 1; cnt = d; endelse fd_out = 0;endendendmodule該程序?qū)崿F(xiàn)的是可變模的減法計數(shù)器,輸出的是每當?shù)竭_設定模值就輸出1,相當于對設定模進行檢測。12分析下列的Verilog HDL模塊,寫出對應的邏輯表達式(組)或真值表,并概括地說明其邏輯功能。module exe3(op_result, func_sel, op_a, op_b);output 7:0 op_result;input 2:0 func_sel;input 3:0 op_a, op_b;reg 7:0 op_result;always (func_sel or op_a or op_b)begincase (func_sel)3b000:op_result = op_a + op_b;3b0

溫馨提示

  • 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

提交評論