PARWAN-CPU-狀態(tài)機(jī)設(shè)計(jì)說(shuō)明書_第1頁(yè)
PARWAN-CPU-狀態(tài)機(jī)設(shè)計(jì)說(shuō)明書_第2頁(yè)
PARWAN-CPU-狀態(tài)機(jī)設(shè)計(jì)說(shuō)明書_第3頁(yè)
PARWAN-CPU-狀態(tài)機(jī)設(shè)計(jì)說(shuō)明書_第4頁(yè)
PARWAN-CPU-狀態(tài)機(jī)設(shè)計(jì)說(shuō)明書_第5頁(yè)
已閱讀5頁(yè),還剩5頁(yè)未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

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

文檔簡(jiǎn)介

/基于FPGA的數(shù)字系統(tǒng)設(shè)計(jì)大作業(yè)學(xué)號(hào):13091378 姓名:邢武天 班級(jí):130914題目一:設(shè)計(jì)Parwan的controlsection內(nèi)部狀態(tài)機(jī)s1\s2\..\s9\,并給出功能仿真?題目二:利用分層結(jié)構(gòu)設(shè)計(jì)ParwanCPU,并給出功能仿真?〔利用在實(shí)驗(yàn)課中所給出的TESTBENCH實(shí)驗(yàn)原理圖ControlSectionStructure:s1…s9〔如下圖所示InputsandoutputsofPARWANcontrolsections:–Appliedto,categories,signalname,functions實(shí)驗(yàn)過(guò)程1.1創(chuàng)建工程〔1 打開ISE13.x軟件.選擇File->NewProject在彈出的對(duì)話框中輸入工程名和路徑。〔2 單擊下一步選擇所使用的芯片。Spartan3E開發(fā)板的芯片型號(hào)為Spartan3EXC3S500E芯片.FG320封裝?!? 單擊Next.進(jìn)入工程信息頁(yè)面.確認(rèn)無(wú)誤后.點(diǎn)擊Finish完成工程的創(chuàng)建。1.2測(cè)試文件<1>選擇菜單欄中的Project->NewSource。<2>在SelectSourceType窗口中.選擇左側(cè)的VHDLTestBench,在右側(cè)FileName欄中輸入文件名par_control_unit_tb<3>單擊Next按鈕.選擇關(guān)聯(lián)文件。1.3實(shí)驗(yàn)截圖實(shí)驗(yàn)代碼在實(shí)現(xiàn)過(guò)程中.除了定義CPU的信號(hào)接口外.還設(shè)置了一個(gè)輸出類型的接口.名字叫present_state_value,主要是用來(lái)在調(diào)試或仿真的過(guò)程中輸出CPU所處的狀態(tài).便于調(diào)試分析。整個(gè)狀態(tài)機(jī)的實(shí)現(xiàn)過(guò)程主要使用了case…IS…when邏輯結(jié)構(gòu)。用了present_state和next_state兩個(gè)狀態(tài)變量。詳細(xì)的實(shí)現(xiàn)代碼如下所示:LIBRARYIEEE;USEIEEE.std_logic_1164.ALL;USEwork.synthesis_utilities.ALL;--ENTITYpar_control_unitISPORT<clk:INstd_logic;--registercontrolsignals:load_ac,zero_ac,load_ir,increment_pc,load_page_pc,load_offset_pc,reset_pc,load_page_mar,load_offset_mar,load_sr,cm_carry_sr,--busconnectioncontrolsignals:pc_on_mar_page_bus,ir_on_mar_page_bus,pc_on_mar_offset_bus,dbus_on_mar_offset_bus,pc_offset_on_dbus,obus_on_dbus,databus_on_dbus,mar_on_adbus,dbus_on_databus,--logicunitfunctioncontroloutputs:arith_shift_left,arith_shift_right:OUTstd_logic;alu_and,alu_not,alu_a,alu_add,alu_b,alu_sub:outstd_logic;--inputsfromthedatasection:ir_lines:INstd_logic_vector<7DOWNTO0>;status:INstd_logic_vector<3DOWNTO0>;--memorycontrolandotherexternalsignals:read_mem,write_mem:OUTstd_logic;interrupt:INstd_logic; --test present_state_value:outstd_logic_vector<3DOWNTO0>>;ENDpar_control_unit;--ARCHITECTUREdataflow_synthesizableOFpar_control_unitISTYPEcpu_statesIS<s1,s2,s3,s4,s5,s6,s7,s8,s9>;SIGNALpresent_state,next_state:cpu_states; SIGNALnext_state_value:std_logic_vector<3DOWNTO0>;BEGINclocking:PROCESS<clk,interrupt>BEGINIF<interrupt='1'>THENpresent_state<=s1; present_state_value<="0001";ELSIFclk'EVENTANDclk='0'THENpresent_state<=next_state; present_state_value<=next_state_value;ENDIF;ENDPROCESSclocking;--sequencing:PROCESS<present_state,ir_lines,status,interrupt>BEGINload_ac<='0';zero_ac<='0';load_ir<='0';increment_pc<='0';load_page_pc<='0';load_offset_pc<='0';reset_pc<='0';load_page_mar<='0';load_offset_mar<='0';load_sr<='0';cm_carry_sr<='0';--busconnectioncontrolsignals:pc_on_mar_page_bus<='0';ir_on_mar_page_bus<='0';pc_on_mar_offset_bus<='0';dbus_on_mar_offset_bus<='0';pc_offset_on_dbus<='0';obus_on_dbus<='0';databus_on_dbus<='0';mar_on_adbus<='0';dbus_on_databus<='0';--logicunitfunctioncontroloutputs:arith_shift_left<='0';arith_shift_right<='0';alu_and<='0';alu_not<='0';alu_a<='0';alu_add<='0';alu_b<='0';alu_sub<='0';--memorycontrolandotherexternalsignals:read_mem<='0';write_mem<='0';CASEpresent_stateISWHENs1=>1IF<interrupt='1'>THENreset_pc<='1';next_state<=s1; next_state_value<="0001";ELSEpc_on_mar_page_bus<='1';pc_on_mar_offset_bus<='1';load_page_mar<='1';load_offset_mar<='1';next_state<=s2; next_state_value<="0010";ENDIF;WHENs2=>2--readmemoryintoirmar_on_adbus<='1';read_mem<='1';databus_on_dbus<='1';alu_a<='1'; load_ir<='1';increment_pc<='1';next_state<=s3; next_state_value<="0011";WHENs3=>3pc_on_mar_page_bus<='1';pc_on_mar_offset_bus<='1';load_page_mar<='1';load_offset_mar<='1';IF<ir_lines<7DOWNTO4>/="1110">THENnext_state<=s4; next_state_value<="0100";ELSECASEir_lines<3DOWNTO0>ISWHEN"0001"=>--clazero_ac<='1';load_ac<='1'; WHEN"0100"=>--cmccm_carry_sr<='1';WHEN"1000"=>--aslalu_b<='1';arith_shift_left<='1';load_sr<='1';load_ac<='1';WHEN"1001"=>--asralu_b<='1';arith_shift_right<='1';load_sr<='1';load_ac<='1';WHENOTHERS=>NULL;ENDCASE;next_state<=s2; next_state_value<="0010";ENDIF;WHENs4=>4--readmemoryintomaroffsetmar_on_adbus<='1';read_mem<='1';databus_on_dbus<='1';dbus_on_mar_offset_bus<='1';load_offset_mar<='1';IF<ir_lines<7DOWNTO6>/="11">THENir_on_mar_page_bus<='1';load_page_mar<='1';IF<ir_lines<4>='1'>THEN next_state<=s5; next_state_value<="0101"; ELSEnext_state<=s6; next_state_value<="0110";ENDIF;ELSE--jsrorbra,donotaltermar--pageIF<ir_lines<5>='0'>THEN--jsrnext_state<=s7; next_state_value<="0111";ELSEnext_state<=s9; next_state_value<="1001"; ENDIF;ENDIF;increment_pc<='1';WHENs5=>5--readactualoperandfrommemoryintomar--offset mar_on_adbus<='1';read_mem<='1';databus_on_dbus<='1';dbus_on_mar_offset_bus<='1';load_offset_mar<='1';next_state<=s6; next_state_value<="0110";WHENs6=>6IF<ir_lines<7DOWNTO5>="100">THEN--jmpload_page_pc<='1';load_offset_pc<='1';next_state<=s2; next_state_value<="0010";ELSIF<ir_lines<7DOWNTO5>="101">THEN--maronadbus,acondatabus,write--tomemorymar_on_adbus<='1';alu_b<='1';obus_on_dbus<='1';dbus_on_databus<='1';write_mem<='1';next_state<=s1; next_state_value<="0001";ELSIF<ir_lines<7>='0'>THEN--lda,and,add,sub--maronadbus,readmemoryfor--operand,performoperationmar_on_adbus<='1';read_mem<='1';databus_on_dbus<='1';IF<ir_lines<6>='0'>THEN lda,and IF<ir_lines<5>='0'> THEN--lda alu_a<='1'; ELSE--and alu_and<='1';ENDIF;ELSEadd,subIF<ir_lines<5>='0'>THEN--addalu_add<='1';ELSE--subalu_sub<='1';ENDIF;ENDIF;load_sr<='1';load_ac<='1';next_state<=s1; next_state_value<="0001";ENDIF;WHENs7=>7--writepcoffsettotopofsubroutinemar_on_adbus<='1';pc_offset_on_dbus<='1';dbus_on_databus<='1';write_mem<='1';load_offset_pc<='1';next_state<=s8; next_state_value<="1000";WHENs8=>8increment_pc<='1';next_state<=s1; next_state_value<="0001";WHENs9=>9IF<all_or<statusANDir_lines<3DOWNTO0>>='1'>THENload_offset_pc<='1';ENDIF;next_state<=s1; next_state_value<="0001";實(shí)驗(yàn)原理實(shí)驗(yàn)過(guò)程創(chuàng)建工程〔1 打開ISE13.x軟件.選擇File->NewProject在彈出的對(duì)話框中輸入工程名和路徑?!? 單擊下一步選擇所使用的芯片。Spartan3E開發(fā)板的芯片型號(hào)為Spartan3EXC3S500E芯片.FG320封裝。〔3 單擊Next.進(jìn)入工程信息頁(yè)面.確認(rèn)無(wú)誤后.點(diǎn)擊Finish完成工程的創(chuàng)建。設(shè)計(jì)輸入選擇Project->Addcopyofsource.將實(shí)驗(yàn)的源代碼添加到工程中。綜合實(shí)現(xiàn)編寫匯編測(cè)試代碼〔2用文本編輯器打開實(shí)驗(yàn)源代碼中的simple.asm文件。〔3將測(cè)試代碼轉(zhuǎn)換為內(nèi)存文件〔4編譯并執(zhí)行程序設(shè)計(jì)仿真結(jié)果截圖編寫testbench代碼對(duì)以上的狀態(tài)機(jī)進(jìn)行功能仿真。Testbench的核心代碼如下:stim_proc:processbegin --

溫馨提示

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

最新文檔

評(píng)論

0/150

提交評(píng)論