LabWindows/CVI User Group Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Using your existing Visual C Project with the CVI Runtime

Hi,

I was wondering if there is any official or documented way to convert the project settings of my existing Visual C++ 2008 project so that it can call the C to FPGA interface.

This way we can take existing programs written in C/C++ and accelerate them by using FPGAs and the C interface to FPGA,

Thanks,

John Stratoudakis

john@aleconsultants.com

www.WallStreetFPGA.com

0 Kudos
Message 1 of 4
(4,442 Views)

Hi John,

Are you wanting to use the C-Interface to FPGA with LabWindows/CVI or the Visual Studio IDE? LabVIEW FPGA allows your you to easily create a header file that contains type enum definitions for the memory that you have configured in the LabVIEW FPGA code. You can download the LabVIEW FPGA bit stream to the FPGA hardware from your C host application through the NI-RIO driver layer. You can also perform data operations on the FPGA hardware through the NI-RIO driver layer by passing the type enum definitions for the memory you predefined in the LabVIEW FPGA code. There is a C-Interface to LabVIEW FPGA FAQ and a C-Interface Tutorial that will help to get started with this. In summary, you can interface with the FPGA hardware through the NI-RIO driver layer by passing information about the memory address that is defined in the auto-generated C-Interface to LabVIEW FPGA.

-Adri Kruger

LabWindows/CVI and Measurement Studio

Product Manager

Adri Kruger
National Instruments
LabVIEW Product Marketing
0 Kudos
Message 2 of 4
(3,166 Views)

I am trying to use the C-Interface to FPGA from inside the Visual Studio IDE.  The reason I wish to use the C-Interface to FPGA is to be able to convert an existing Visual C++ Project from a simple Visual C++ Project to one that can also access the C-Interface to FPGA.

When I figure out all of the changes that I have to make to my existing Visual C++ Project to have it be able to call the C-Interface to FPGA I will post the results here.

Thanks

0 Kudos
Message 3 of 4
(3,166 Views)

John,

You can do this with your existing Visual Studio C++ applications. The C-API Generator in LabVIEW FPGA will provide you with a header file similar to this one that I generated based on LabVIEW FPGA code I developed.

CInterfaceToFPGAcode.png

I have indicated a few areas in the file that are important for interfacing with the FPGA-based hardware.

  1. NiFpga.h: This is the header file that allows for communicating through the NI-RIO driver to the FPGA-based hardware.
  2. The file name of the LabVIEW FPGA bitfile: This represents the digital circuitry that you define with LabVIEW FPGA and will be used to download onto the FPGA hardware to create a physical representation on the reconfigurable hardware platform.
  3. LabVIEW FPGA bitfile Signature: This is unique to the LabVIEW FPGA code that you compiled.
  4. Type enums: This will be used when making function calls through the NI-RIO driver layer.

This is a sample of the C host application code that you can develop that communicates with the FPGA-based hardware through the NI-RIO driver layer.

This example shows how you can reads from a FIFO of signed 16-bit integers. The function that I am calling is included in the NI-RIO driver (NiFpga.h header file) and is defined as follows:

readfunction.png

In my code I am reading a DMA FIFO on the FPGA-based hardware by making to this function call through the NI-RIO driver and passing  the type enum for the FIFO memory that I defined in the LabVIEW FPGA VI.

readinCode.png

Let me know if you have any additional questions about this interface.

Adri Kruger

LabWindows/CVI and Measurement Studio

Product Manager

Adri Kruger
National Instruments
LabVIEW Product Marketing
0 Kudos
Message 4 of 4
(3,166 Views)