From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

What is the "Dynamic FPGA Interface Cast" function for?

I've read and re-read the documentation for the Dynamic FPGA Interface Cast function, and I cannot figure out what it's for nor when I would want to use it. Has anyone used this function and can provide an example?

Message 1 of 13
(5,157 Views)

Don't have a good example right now, but I have used that function.  It can come in handy especially when you are trying to make reuse code.  With that function, you can make an FPGA reference appear as a different FPGA interface.  So you could have an FPGA with an DMA1, DMA2, and DMA3.  You can then use that function to cast the interface to just have DMA1.  You can now reuse all of that code you made for another project that only used DMA1.

 

Probably did not explain that well.  For the system I did, the Open Dynamic Bitfile Reference was used since I made all of my FPGAs use the same interface.


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 13
(5,144 Views)

@crossrulz wrote:

Don't have a good example right now, but I have used that function.  It can come in handy especially when you are trying to make reuse code.  With that function, you can make an FPGA reference appear as a different FPGA interface.  So you could have an FPGA with an DMA1, DMA2, and DMA3.  You can then use that function to cast the interface to just have DMA1.  You can now reuse all of that code you made for another project that only used DMA1.

 

Probably did not explain that well.  For the system I did, the Open Dynamic Bitfile Reference was used since I made all of my FPGAs use the same interface.


What I don't understand is that the cast function requires an input that is already a dynamic FPGA reference. If the reference is already dynamic, shouldn't that reference just convert itself when you wire it to a subVI that is expecting a dynamic reference?

 

I attached a project for what I'm talking about with the auto-conversion. I get the point of dynamic FPGA reference but I think the only time I've used this function is when the LabVIEW compiler breaks the wire when it isn't supposed to so I type cast the reference to itself.

Matt J | National Instruments | CLA
Message 3 of 13
(5,140 Views)

Does the cast convert the names of items? For example, if you open a reference to a VI that has a numeric called Number, can you cast it to a session that expects a numeric control named Control 1? What happens if the data types don't match? Same thing with FIFOs - in what order does it match the resources? I feel like the help for this function should be a lot clearer.

0 Kudos
Message 4 of 13
(5,089 Views)

Yes, I am unable to find any documentation on this topic either and my FPGA dynamic references continue to break going into my SubVI's.

 

Has anyone found an example for this yet?  The Dynamic FPGA Interface Cast Function's type cast does not make any sense to me.  I'm not sure how to create a dynamic cast into the function.

 

Labview Representatives?

0 Kudos
Message 5 of 13
(4,873 Views)

@stoneadam wrote:

Yes, I am unable to find any documentation on this topic either and my FPGA dynamic references continue to break going into my SubVI's.


I realize that dynamic FPGA references are supposed to be the future, but I've given up on them for now unless I specifically need a dynamic reference. If I'm only referencing one bitfile, I find the old style of a non-dynamic FPGA reference bound to a type definition works well and everything updates the way I'd like when I update the FPGA VI.

 

You can also make your dynamic reference a type definition, so you only need to update it in one place.

0 Kudos
Message 6 of 13
(4,859 Views)

I got the Dynamic FPGA Reference working with some help from NI.

 

Basically you do the following in order to pass a dynamic reference into one or more sub-vi's:

1. Create an Open FPGA VI Reference, Select the Dynamic Mode option, (I selected Run the FPCA VI) and select the reference type (I chose bitfile as I have had numerous issues with the VI reference type),

2. connect that output into the input of your subvi, which should reference the following item...

3. Create an FPGA Dynamic Interface Refnum and convert it to a control (FPGA Interface control in my attached image).  Do not configure the reference, leave it blank/do not Import a configuration.

4. You will need to pass the blank FPGA Dynamic Reference into an FPGA Dynamic Type Cast as shown.  The Type will be made by once again creating an FPGA Dynamic Reference conrol, but this time configuring the Control with your FPGA configuration (Import from Bitfile, etc).  Additionally, you can make this Type control a typedef, this will minimize reconfigurations that must be done in subsequent subvi's each time a new FPGA bitfile is created or VI modified.

5. The SubVI out port should be connected in series with the Session Out  of the FPGA Dynamic Type Cast.

 

Note that when you re-enter the original calling VI that prior to using the FPGA reference signal that you will once again have to perform the type cast operation.

 

Hopefully this helps.

Message 7 of 13
(4,847 Views)

As of LV2017 SP1.

 

The differences are:

1. Dynamic FPGA References - Don't workSmiley Mad, are fragile and break when you move the code to another development computer...and can't seem to get them to update/repair at all.

2. Old Style Do Work...Smiley Happy

 

The other problem with Dynamic references seems to be they don't update organically, so when you add FP controls to the FPGA vi, the dynamic ref. does not update - so the nodes are broken or can't be created on the RT side.

 

The old style FPGA ref, when linked to the bitfile - is the most robust way to go.

0 Kudos
Message 8 of 13
(3,764 Views)

So, I used to share your feelings on this, but after some issues with the old-style FPGA references and a lack of similar problems with dynamic references, I have to say that my conclusion is almost exactly opposite yours, depending on what your code is doing. Dynamic references can save you from a lot of updates in some situations. For example, let's say you have several different FPGA VIs for different projects, but they all incorporate some common piece of code, and you have corresponding common RT code to talk to that particular set of FPGA front panel elements. With a dynamic reference, you can have actually common code that doesn't reference a particular bitfile but instead references particular controls (or FIFOs, etc) and doesn't change when you switch FPGA VIs or modify one of them.

 

I think it's fair to say that neither reference approach works perfectly, but one of them probably works well enough for whatever your situation is. However, which one that is depends on your specific use case.

0 Kudos
Message 9 of 13
(3,761 Views)

Nathan,

 

I respect your choice of methods and it likely works well for the type of applications you are paid to devise. 

 

That said: You got the Dynamic Reference to work??...It did work on a project I just inherited to complete - but then is completely broken when I attempt to open the code on another log-in on the SAME machine. I cannot figure out how to get them to work again, I could use the convert to dynamic ref thingy...but the original code did not need this.

 

So 'it's very fragile' in my experience. As this code is for a critical monitoring system, I can't accept the fact

1. It worked.

2. No longer works - for some unknown reason- not from a code change, or LV version change.

3. Can not be 'restored' to functioning  in the same manner.

4. I cannot rationalize the 'work-around', why does it need it now?...it *worked* before originally???

5. Carefully, without making eye-contact, Delete all the 'Dynamic' reference stuff and get back to coding the application.

 

I am not sure 'What problem the Dynamic FPGA reference' is trying to solve...I've not had problems with FPGA references in the past at all really, until I do, I'm not quite sure what they are for?

 

Forgive my terseness, I've been coding LV too many, many years, and had to suffer without most of these toolkits. And they often present more problems then they solve. Tried the Shared-Variable engine much?Smiley Tongue

Regards

Jack Hamilton

 

0 Kudos
Message 10 of 13
(3,755 Views)