Nios II - Platform Designer 建立 Custom Component
建立好一個 Nios II System 之後 我們就可以利用 Nios II Software Build Tool 在上面開發 C Program 了 不過建立 Custom Component 的好處就是可以讓某些運算改由硬體來做 藉此提升效能 基本上參考手冊都把流程講完了 ( Nios II Custom Instruction User Guide ) 所以這裡只整理一些重點 跟自己在實作過程中碰到的問題 然後手冊雖然很長 但真的要有耐心一步一步照著做! 尤其是在 Platform Designer 建立 Custom Component 的地方 ================================================= Hardware 部分 下表列出了幾種 Custom Instruction Combinational => 該 Custom Component 為組合 (Combinational) 電路 Multicycle => 該 Custom Component 為時序 (Sequential) 電路 其中根據運算的 Cycle Count 是否固定,又可分為 fixed 或 variable fixed 表示從 start 送出後,固定某個 Cycle 數後就算好結果並回傳 (因此 done 訊號為非必要) variable 表示從 start 送出後,當 done 回傳為 1 時即可算好結果並回傳 (因此 done 訊號為必要) Extended => 讓該 Custom Component 可以做多個 Operation 用 n 來決定對該 Custom Component 下什麼指令 ================================================= Software 部分 建立好硬體部分後 就可以開啟 Software Build Tool 首先在手冊裡頭有提到自訂指令的函式宣告 例如這是回傳型態為 float 的函式 不過我們不需要這麼辛苦去 call 這些 function 因為在 <system.h> 裡頭都幫我們定義好了 接下來要在 code 中加入 #include <system.h> 然後先按 Build Project...