1 / 15

PCSPIM 的介紹

PCSPIM 的介紹. 王昱偉. PCSPIM 的介紹. Download and Installation Window Interface and Console Interface Simulator Setting 程式結構參數與 Data Type System Call Program Layout Run program. Download and Installation. 下載 pcspim 壓縮檔並解壓縮 執行 setup.exe 並安裝 執行 pcspim.exe. Window Interface. Registers. Text.

evan
Download Presentation

PCSPIM 的介紹

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. PCSPIM的介紹 王昱偉

  2. PCSPIM的介紹 Download and Installation Window Interface and Console Interface Simulator Setting 程式結構參數與Data Type System Call Program Layout Run program

  3. Download and Installation • 下載pcspim壓縮檔並解壓縮 • 執行setup.exe並安裝 • 執行pcspim.exe

  4. Window Interface Registers Text Data Messages

  5. Window Interface • Registers 顯示MIPS中所有register的值 • Text 顯示所有指令的位址 • Data 顯示load進來的資料和Stack中的資料 • Message 顯示pcspim的一些資訊,包含error message

  6. Console Interface • 程式執行的畫面

  7. Simulator Setting • 用圖中設定即可,一般不需要更動

  8. Simulator Usage • Simulator Clear Registers:將registers中的資料 清除 Reinitialize:重新初始化simulator Reload:重新讀取檔案 Go:執行程式 BreakPoint:可設定程式執行的中斷點 Single/Multiple Step:可用在debug時

  9. 程式結構參數與Data Type • .text 代表後面的是程式的本文 • .globl 程式開始的地方 • main 主程式 • .data 設定要用到的資料 • label 定位程式的某一個地方,可用在迴圈等 • .word , .half: 32/16 bit integer • .byte: 8 bit integer (類似C語言中的char) • ascii,asciiz : string (字串) • .double , .float 浮點數 • newline(“\n”) , tab(“\t”)

  10. System Call • 可以呼叫系統提供的system call read , print等 • 常用兩個register $v0 指定要用的system call種類 接收read的資料 $a0 儲存要print的資料

  11. System Call • Example 讀入一個integer li $v0 , 5 #指定system call的種類 syscall #執行system call 輸出一個string 假設msg代表一個字串 li $v0 , 4 #指定system call的種類 la $a0 , msg #將字串存入$a0 syscall

  12. System Call

  13. Function • 呼叫涵式 main function #主程式 …. #code Jal function label(副涵式名稱) #呼叫涵式 …. .text #副涵式 function label : code Jr $ra

  14. Program Layout .text #code section .globl main #start point: must be global main: code .data#data section data label : #data setting .text#function code section function label: code

  15. Run Program • 將程式寫出並儲存成文字檔(txt) • First run the program 1.Simulator->Clear Registers 2.Simulator->Reinitialize 3.File->Open->open the file 4.Simulator->Go • After edit the file(ex. there are errors) 1.Repeat the step 1 , 2 2.Simulator->Reload the file 3.Simulator->Go

More Related