Support of Cross Calls between Microprocessor and FPGA in CPU-FPGA Coupling Architecture
- G. NguyenThiHuong and Seon Wook Kim
Support of Cross Calls between Microprocessor and FPGA in CPU-FPGA - - PowerPoint PPT Presentation
Support of Cross Calls between Microprocessor and FPGA in CPU-FPGA Coupling Architecture G. NguyenThiHuong and Seon Wook Kim Microarchitecture and Compiler Laboratory School of Electrical Engineering Korea University Motivation
void process (struct data* head) { struct data* p; int ret = 0; for( p = head; p; p = p->next){ p->content = (struct elem*) calloc (p->size); if( !p->content ){ ret = 1; break; } else{ ….. } } return ret; } struct data* head; int main (void) { ….. error = process (head); ….. }
process() calloc()
calloc()
main() process() main() call call return call return
Arguments passing through argument registers and stack.
Code partitioning process:
Divides codes into hardware and software sections Prepares the address resolution
Compilation process:
Compiles software code section into executable objects Translates hardware code section into Verilog code and synthesizes them to HW bitstreams (HWIPs).
Execution process:
Running SW executable code in a microprocessor & HWIPs in FPGA The FPGA communicates with the host processor through a communication channel and memory. Processor M e m
y C code GCC2Veril
translator GCC compiler Executa ble code Hardwa re bitstrea m HW codes SW codes Verilo g code FPGA
Assigning an hardware identification number hwid to each HWIP
Static link: use the symbol table obtained an executable file to resolve software addresses at HLL-to-HDL translation. Dynamic link: Assign an identification number swid to each SW callee called from HW Use an address_resolver() to obtain SW callee address at run time from swid
Processor
Argument Reg Argument Reg Argument Reg Argument Reg SP LR
HW controller SW/HW interface
Control unit Datapath
HWIP 1
Argument
…
Local variables Control unit Datapath
HWIP N
Controls and schedules the execution between a processor and HWIPs
Provides a uniform interface to communicate with the host processor
Argument registers HW stack pointer Link register
Stack space
Control unit Datapath
HWIP1
Argument 0 Argument 2 Argument 3 Argument 1 SP
HW controller
Control unit Datapath
HWIP N
SW/HW interface
hwid = 1 enable
Argument 4 Pushed registers
…
SW return addr
call + hwid
Processor
Wrapper Stack space
Caller ID (return addr)
HW controller
Control unit Datapath
HWIP N
SW/HW interface
Argument 4 Pushed registers
Control unit Datapath
HWIP1
finish interrupt
…
Processor
Interrupt handler Wrapper HW_finish =1
SW return addr
Stack space
Caller ID (return addr)
Control unit Datapath
HWIP1
Argument 0 Argument 2 Argument 3 Argument 1 SP HW return addr
HW controller
Control unit Datapath
HWIP N
SW/HW interface
HWIP’s Argument 4 Pushed registers
…
SW callee argument 4
call + swid interrupt + swid
Processor
Interrupt handler Wrapper func_ptr =0xaef0
pc=func_ptr Stack space
Caller ID (return addr)
Argument 0 Argument 2 Argument 3 Argument 1 SP HW return addr
HW controller
Control unit Datapath
HWIP N
SW/HW interface
HWIP’s Argument 4 Pushed registers
…
SW callee argument 4
Processor
SW callee
Control unit Datapath
HWIP 1
Wrapper
Pushed registers
Stack space
Caller ID (return addr) return addr
return value HW return addr
HW controller
Control unit Datapath
HWIP N
SW/HW interface
HWIP’s Argument 4 Pushed registers
…
Caller ID (return addr)
SW finish enable
Processor
Wrapper
Control unit Datapath
HWIP1
Stack space
SW callee argument 4
Processor
Interrupt handler
Argument 0 Argument 2 Argument 3 Argument 1 SP Return addr
HW controller SW/HW interface
HWIP1’s argument 4 Pushed registers
…
call + hwid = 2 enable Control unit Datapath
HWIP2
HWIP2’s argument 4
…
Control unit Datapath
HWIP1
Pushed registers
Stack space
Return addr
Interrupt handler
return value return addr
HW controller
Control unit Datapath
HWIP2
SW/HW interface
HWIP1’s argument 4 Pushed registers
…
HWIP2’s argument 4
finish enable Control unit Datapath
HWIP1
Processor …
Pushed registers
Stack space
Return addr
Benchmarks Number of calls Call overhead (%) aifftr 300 3.52 aiifft 300 4.00 fft 100 2.71 bezier 20 0.11 idctrn 600 4.62 rgbyiq 10 0.02 viterb 200 8.37 autcor 100 0.05 factorial 10 19.91