教案微機(jī)原理、pacoblaze-2.2note_第1頁
教案微機(jī)原理、pacoblaze-2.2note_第2頁
教案微機(jī)原理、pacoblaze-2.2note_第3頁
教案微機(jī)原理、pacoblaze-2.2note_第4頁
教案微機(jī)原理、pacoblaze-2.2note_第5頁
已閱讀5頁,還剩5頁未讀, 繼續(xù)免費(fèi)閱讀

付費(fèi)下載

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡介

Copyright(C)2004,2006PabloBleyerRedistributionanduseinsourceandbinaryforms,withorwithoutmodification,arepermittedprovidedthatthefollowingconditionsaremet:Redistributionsofsourcecodemustretaintheabovecopyrightnotice,thislistofconditionsandthefollowingdier.Redistributionsinbinaryformmustreproducetheabovecopyrightnotice,thislistofconditionsandthefollowingdierintheationand/orothermaterialsprovidedwiththedistribution.Thenameoftheauthormaynotbeusedtoendorseorpromoteproductsderivedfromthissoftwarewithoutspecificpriorwrittenpermission.THISSOFTWAREISPROVIDEDBYTHEAUTHOR"ASIS"ANDANYEXPRESSORIMPLIEDWARRANTIES,INCLUDING,BUTNOTLIMITEDTO,THEIMPLIEDWARRANTIESOFMERCHANTABILITYANDFITNESSFORAPARTICULARPURPOSEAREDIED.INNOEVENTSHALLTHEAUTHORBELIABLEFORANYDIRECT,INDIRECT,AL,SPECIAL,EXEMRY,ORCONSEQUENTIALDAMAGES(INCLUDING,BUTNOTLIMITEDTO,PROCUREMENTOFSUBSTITUTEGOODSORSERVICES;LOSSOFUSE,DATA,ORPROFITS;BUSINESSINTERRUPTION)HOWEVERCAUSEDANDONANYTHEORYOFLIABILITY,WHETHERINCONTRACT,STRICTLIABILITY,ORTORT(INCLUDINGNEGLIGENCEOROTHERWISE)ARISINGINANYWAYOUTOFTHEUSEOFTHISSOFTWARE,EVENIFADVISEDOFTHEPOSSIBILITYOFSUCHDAMAGE./**`ifndef `define `include `ifdef //USE_ONEHOT_ENCODINGifdef語句,否則執(zhí)行else`defineoperation(x) `defineoperation_is(x) `defineoperation(x) `defineoperation_is(x)operationxmodule`PACOBLAZE_ALU( ACOLAZE_ALU(shift_operation,shift_direction,shift_constant,result,operand_a,operand_b,`ifdef //HAS_WIDE_ALU, //HAS_WIDE_ALUresultwoperand_u,carry_in,zero_out //HAS_WIDE_ALU沒被定義,模塊包含參數(shù)carry_in,zero_out`ifdef //HAS_DEBUG,input[`operation_width-1:0]operation; //輸入端口定義,寬度為operation_width(在包含文件中已定義)的操作符input[2:0]shift_operation; //輸入端口定義,寬度為3移位操作符input input //outputreg[`operand_width-1:0]result; //resultinput[`operand_width-1:0]operand_a,operand_b;//operand_a,operand_b`ifdef outputreg[`operand_width-1:0]resultw;///<wideALUhighinput[`operand_width-1:0]operand_u,operand_v;///<wideALUhighinputcarry_in; outputzero_out; //輸出端口定義/<Zeroout`ifdef outputreg[8*`alu_debug_width:1]debug;//輸出端口定義,寄存器定義/<ALUdebugstringreg[18*8:1]debug_rabc; //寄存器定義/<ALUdebugoperandsandresultreg[7*8:1]debug_cz; //寄存器定義/<ALUdebugflags/**Adder/substractersecondoperand.wire[`operand_width-1:0addsub_b || || )?~operand_b`ifdefHAS_WIDE_ALU wire[2*`operand_width-1:0]addsubw_b=(`operation_is(`op_subw)||`operation_is(`op_subwcy))?~{operand_v,operand_b}wireaddsub_carry= //如果是“op_addcy”操作,則addsub_carry=carry_in`ifdef||)?carry_in: || `ifdef||)?1://~b=>b'`ifdef||)?~carry_in://~b-c=>b'-c. wire[1+`operand_width-1:0]addsub_result=operand_a+addsub_b+addsub_carry;//線網(wǎng)定義addsub_result,表示運(yùn)算的結(jié)果包含進(jìn)位(最`ifdefwire[1+2*`operand_width-1:0]addsubw_result{operand_u,operand_a}+addsubw_b+/**Shiftbitvalue.//synthesisparallel_casefull_casewireshift_bit=(shift_operation==`opcode_rr)?operand_a[0]://==`opcode_slx(shift_operation==`opcode_rl)?operand_a[7]://==`opcode_srx(shift_operation==`opcode_rsa)?carry_in:shift_constant;//==`ifdefwire[2*`operand_width-1:0]resultx={resultw,assignzero_out`ifdefHAS_MUL_OPERATION(`operation_is(`op_mul))?~|resultx:`ifdef(`operation_is(`op_addw)||||`operation_is(`op_subw)||)?~|resultxalwaysshift_operation,shift_direction,shift_constant,shift_bit,result,operand_a,operand_b,carry_in,carry_out,addsub_result,addsub_b,addsub_carry`ifdef) y("op:%b%h(%h)=(%h),(%h)",operation,operation,result,operand_a,$disy("as:%h=%h+%h+%b",addsub_result,operand_a,addsub_b,//alwaysalways //alwaysbegin-endshift_operation,shift_direction,shift_constant,shift_bit,result,operand_a,operand_b,carry_in,carry_out,addsub_result,addsub_carry`ifdefbegin: /*Defaults*/carry_out=`ifdefHAS_WIDE_ALUresultw=//synthesisparallel_case`ifdefUSE_ONEHOT_ENCODINGcase(1'b1)case ,{carry_out,result}= PARE_OPERATION如果 pare或者op_sub或者op_subcy,需對帶進(jìn)位的addsub_result按位取反給carry_out,result賦

{carry_out,result}={~addsub_result[8], result=operand_a&operand_b; result=operand_a|operand_b;`ifdef beginresult=operand_a&operand_b;carry_out=^result;end result=operand_a^operand_b; if(shift_direction) //如果右移{resultcarry_outshift_bitoperand_a}; //如果是左移{carry_out,result}={operand_a,`ifdef {resultw,result}=operand_a*`ifdef{carry_out,resultw,result}=

{carry_out,resultw,result}={~addsubw_result[16], result=operand_b; //case //begin`ifdef `includealwa

溫馨提示

  • 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)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

最新文檔

評論

0/150

提交評論