Verilog基本語法型態全域變數基本元件多樣的寫法指定assignalwaysinitial運算式分枝迴圈模組函數Task陣列輸出入觀察真值表測試程式訊息顯示注意事項模擬程序硬體工程程式範例XorXor3全加器加法器加減器快速加法器乘法器ALU閂鎖器脈衝偵測計數器多工器暫存器群記憶體延遲問題浮點數狀態機程式計數器CPU0-MiniCPU0pipeline工具QuartusIIIcarusVeritek訊息相關網站參考文獻最新修改簡體版English |
檔案:hello2.c
檔案:hello2.v
編譯執行過程
原理解說在 Using VPI — http://iverilog.wikia.com/wiki/Using_VPI 這篇文章中,記載了這個機製的運作原理,以下是我認為最重要的一段話: The simulator run time (The "vvp" program) gets a handle on a freshly loaded module by looking for the symbol "vlog_startup_routines" in the loaded module. This table, provided by the module author and compiled into the module, is a null terminated table of function pointers. The simulator calls each of the functions in the table in order. The following simple C definition defines a sample table: void (*vlog_startup_routines[])() = { Note that the "vlog_startup_routines" table is an array of function pointers, with the last pointer a 0 to mark the end. The programmer can organize the module to include many startup functions in this table, if desired. 透過這種方式,我們就能讓 Icarus Verilog 的 vvp 虛擬機呼叫 C 語言的函數了。 參考文獻 |
用 Iverilog-vpi 連結 C 語言與 Verilog (2)
page revision: 0, last edited: 22 May 2012 01:47






Post preview:
Close preview