@iar
2017-12-22T03:20:42.000000Z
字数 1902
阅读 274
Novu
- This README describes the structure and design of PCI-e driver for NovuFPGA, and HOW-TO-RUN instructions
- PCI-e driver git: link
git checkout <commit_hash>
to switch to particular commit. PLEASE make clean
before checkout/checkin!ba66
. pci_close
, may cause segment_fault.read_result
can only read 4MB from DDR (Given premise that result is always < 4MB)5f23
. pci_close
.read_result
can read any size from DDR.The FPGA driver has 2 parts: Kernel-space driver + User-space driver
pci_skel.[c/h]
: This is the kernel driver core file. It defined APIs to do these operations:
IOCTL_CMD_READ_REG
IOCTL_CMD_WRITE_REG
IOCTL_CMD_DMA_READ_BUF
IOCTL_CMD_DMA_WRITE_BUF
IOCTL_CMD_DMA_READ_RESULT
: DEPRECATEDIOCTL_CMD_EXECUTE_NPU
: NEW CMDThe DMA is limit by the kmalloc size, which is restricted by linux kernel to 4MB. So the kernel-space driver's DMA_READ_BUF, DMA_WRITE_BUF can R/W 4MB each instruction.
Pcie.[c/h]
: This is the user driver core file, It defined APIs for application to call so as to R/W memory, and start NPU. Notice: ALL user-space API need to call kernel-space driver in between open/close clause. The best practice is to use user-space driver on large block memory block to compensate the over-head.The main API:
set_write_mem
: this function calls the kernel API: DMA_WRITE_BUF
to write ANY size of user space memory into FPGA's DDR space, 4MB each time in the do...while loop
. set_read_mem
read_result
this function is DEPRECATEDexecute_npu
this is the function to call instead of read_result
, this function is blocking to trigger NPU to finish and wait for it to finish. Please call set_read_mem
to read result from DDR.Test/vgg2_test.c
: This is the example test to show the use of User-space driver to interact with FPGA.
execute_npu
& set_read_mem
.python dif.py
to verify the bin output with ofm.bin