1 / 16

2013 HPDS 寒假訓練課程 Emulator(VM)

2013 HPDS 寒假訓練課程 Emulator(VM). Presenter: Hung-Fu Li. 基本 Emulator. 你知道如何配置記憶體 你會撰寫讀取某個檔案的程式 讀取一種格式進行某個特定行為 Ex: XML Reader, 自定義的 2 進位格式. 基本 Emulator. Emulator: 用軟體技術模擬硬體工作行為 Ex: 模擬圖靈機 (Tuning Machine). 基本 Emulator. By the way: 一個電腦用的語言,如果它可以模擬圖靈機,則它就是一個完整的程式語言. 基本 Emulator.

Download Presentation

2013 HPDS 寒假訓練課程 Emulator(VM)

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. 2013HPDS 寒假訓練課程Emulator(VM) Presenter: Hung-Fu Li

  2. 基本Emulator • 你知道如何配置記憶體 • 你會撰寫讀取某個檔案的程式 • 讀取一種格式進行某個特定行為 • Ex: XML Reader, 自定義的2進位格式

  3. 基本Emulator • Emulator:用軟體技術模擬硬體工作行為 • Ex: 模擬圖靈機(Tuning Machine)

  4. 基本Emulator • By the way: • 一個電腦用的語言,如果它可以模擬圖靈機,則它就是一個完整的程式語言

  5. 基本Emulator • 常見Emulator • 遊戲Emulator:

  6. 基本Emulator • 常見Emulator • Android Emulator-基於QEmu

  7. HalfNes • 程式行為:讀取記憶體執行行為 • 中斷:在每個周期的開端,紀錄程式位置,記錄狀態,通知cpu讀取特定位置記憶體執行函式。中斷處理常式要自行加上rti, jsr, rts等返回指令

  8. 基本Emulator • 課本上的CPU行為 • 模擬器模擬行為 : Fetch Decode Exec Memory Access Write-back Ins=mem[PC] Switch (Ins) Call Handler Function

  9. 基本Emulator • 硬體流程 • 模擬器流程 Start Start Emu Load Bios Rom Read Configure, Load Bios File, Allocate Memory Power On Self Test Load Loader from MBR Load Loader from MBR Bootstrap Bootstrap

  10. 基本Emulator

  11. MIPS • RISC(精簡指令集) • 位址對齊4byte • 32個整數暫存器 • 指令長度固定4byte • *格式簡單

  12. MIPS • R type

  13. MIPS • I Type

  14. MIPS • J Type

  15. 延伸閱讀 • 檔案格式 • 執行檔是一組Opcode、資料、符號的檔案包。由作業系統Loader載入到一個記憶體區段後將指令暫存器移動到記憶體區段起始位置。 • 執行檔包括:檔頭, 區段描述表, 已解析符號表, 未解析符號表, 區段列, 已初始化資料區段, 未初始化資料區段

  16. Homework • 定義API來將指令放到指令佇列,模擬fetch, decode與exec行為 • 詳細參數與功能參考http://en.wikipedia.org/wiki/MIPS_architecture • 產生一個具有迴圈的binary code檔案,讓模擬器讀檔,印出每一步(每次移動Program Counter)的每個暫存器狀態。 • 用Lex+yacc撰寫Assembler將文字的組合語言轉為binary code(不需要使用expr node)輸出到

More Related