LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

FPGA Reference Questions

Hello,

 

I have a couple questions regarding FPGA references used within realtime host applications.

 

1) NI documentation states that you can open up a reference to either a FPGA VI, Build-spec, or Bitfile. This confuses me. I assume that every FPGA VI must be compiled into a bitfile before it can be loaded into the FPGA. Thus, it would make sense that you would open a reference to an FPGA bitfile. But what exactly does it mean to open a reference to an FPGA VI or Build-Spec? If you open a reference to a FPGA VI or build spec, does that mean that the FPGA VI is compiled at runtime? So in that case, what's the difference between opening a reference to an FPGA VI vs build spec?

 

2) What exactly does the 'Dynamic FPGA Interface Cast Function' block do? Why would you cast an FPGA reference into a different type? What purpose would that serve? Not that I would, but could I really cast an FPGA reference to a toggle button reference?

 

 

0 Kudos
Message 1 of 10
(3,737 Views)

@TeagueHall wrote:

2) What exactly does the 'Dynamic FPGA Interface Cast Function' block do? Why would you cast an FPGA reference into a different type? What purpose would that serve? Not that I would, but could I really cast an FPGA reference to a toggle button reference?


Reuse.  You can actually cast your FPGA reference to another FPGA reference with fewer "interfaces" (front panel IO, DMA FIFOs).  Therefore, you can make more generic code with the specific interfaces you need to run on the RT.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 10
(3,725 Views)

@TeagueHall wrote:

1) NI documentation states that you can open up a reference to either a FPGA VI, Build-spec, or Bitfile. This confuses me. I assume that every FPGA VI must be compiled into a bitfile before it can be loaded into the FPGA. Thus, it would make sense that you would open a reference to an FPGA bitfile. But what exactly does it mean to open a reference to an FPGA VI or Build-Spec? If you open a reference to a FPGA VI or build spec, does that mean that the FPGA VI is compiled at runtime? So in that case, what's the difference between opening a reference to an FPGA VI vs build spec? 



When you open a reference to an FPGA VI it will, when you try to run your code, check if the bitfile matches the current VI state. So if you modified the FPGA VI since you last created the bitfile it will not let you run the code, LV will tell you the FPGA VI needs to be compiled first.

When you open a reference to a bitfile there's no such check. You have to make sure the bitfile is up to date.

I never used the build spec option, I would assume it is similar to the VI option.

So in the end all options require a bitfile, it's just a different way to select it and LV does more or less checks.

 

0 Kudos
Message 3 of 10
(3,703 Views)

Yes another benefit of referencing a VI instead of the compiled bit file, is the front panel of the running VI will be connected to the compiled code on the FPGA.  In the past this allowed me to run my host code in source, but then open the front panel to my FPGA and see it running.  From here I can interact with the FPGA front panel to have it invoke parts of the FPGA code manually, or to see indicators of various debug information.  Of course when compiled into an EXE this doesn't really work, so I usually change to reference the bitfile in the EXE.

0 Kudos
Message 4 of 10
(3,678 Views)

@TeagueHall wrote:

1) NI documentation states that you can open up a reference to either a FPGA VI, Build-spec, or Bitfile. This confuses me. I assume that every FPGA VI must be compiled into a bitfile before it can be loaded into the FPGA. Thus, it would make sense that you would open a reference to an FPGA bitfile. But what exactly does it mean to open a reference to an FPGA VI or Build-Spec? If you open a reference to a FPGA VI or build spec, does that mean that the FPGA VI is compiled at runtime? So in that case, what's the difference between opening a reference to an FPGA VI vs build spec?


When you open a reference to an FPGA VI, you gain the ability to run that FPGA VI in interactive mode while the host code is running. This is very helpful for debugging, because you can see the front panel of your FPGA running, and even modify values on it. Additionally, if you're running on a desktop target and you set your FPGA to run in simulation, everything works properly - the FPGA executes in simulation in parallel with the host and you can debug both of them together. You cannot do this when you open a reference to a bitfile or a build specification.

 

I've never needed to open a reference to a build specification, but it could be useful if you have multiple build specifications for the same VI (for example with different optimizations) that you want to compare. If you have multiple similar FPGA VIs, referencing a build specification lets you switch between them without modifying your code (instead, change the build specification to reference a different top-level VI), although I'm not sure when it would be helpful to do that.

0 Kudos
Message 5 of 10
(3,676 Views)

For me personally, I find the "VI" Option useful when the FPGA target is set to SImulated I/O mode.  This way, no bitfile is required or created.

 

That was I can go in make a few quick changes and re-start whatever interfacing code I'm using.  Execution of FPGA code in simulated mode is very very slow but for testing, sometimes it's still a real time saver.

0 Kudos
Message 6 of 10
(3,652 Views)

Referencing the Build Spec is useful if you want to run the same VI on different Hardware Targets.

Message 7 of 10
(3,638 Views)

Hello
I'm working on a project based on the example getting started 5783.

My problem is that when I compile by referring to the bitfile, the project works perfectly, but when I refer to the VI without changing anything, I have an error in the stream on the AO loop.

I tried to do some modifications in the FPGA VI and compile to have a new bitfile, the project don't work by refering the new bitfile.

It only works by referring the bitfile by default ! 

what can be the problem ! 

thanks

0 Kudos
Message 8 of 10
(2,644 Views)
Hi MyrzaMBM,

instead of attaching your questions to all old threads concerning FPGA references it might be better to create a new deticated thread just for your problem.

Regards, Jens
Kudos are welcome...
0 Kudos
Message 9 of 10
(2,640 Views)

Ok, Thank you !

0 Kudos
Message 10 of 10
(2,638 Views)