LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Script FPGA Reference

Solved!
Go to solution

I am exploring utilizing the FPGA Advanced Sessions Resources for automating some of the manual FPGA work required on the host side.  To make this work I need to be able to script an FPGA resource.  This gives me the ability to set the data type for the register I would like to read or write in real-time.  I have tried some simple stuff such as type cast or coerce to data type, but none of these work.  I would of course create this reference from a vi or bitfile, but that doesn't buy me much.  

 

I would hope there is a simple way to do this, but if not then there may be a way to use the RVI functions located at C:\Program Files (x86)\National Instruments\LabVIEW 2020\vi.lib\rvi, for example.  

 

Any help appreciated.



-Matt
0 Kudos
Message 1 of 7
(2,057 Views)
Solution
Accepted by topic author Wolleee

Hi Wolleee,

 

There's a way to programmatically configure the registers / FIFOs / target methods of a dynamic FPGA reference control or constant by using the private property "User Data" of the classes RefNum or RefNumConstant. See the example attached.

 

I'm still wondering why you need to configure a strictly-typed FPGA refnum since the toolkit you want to use allows dynamic access to the resources (registers, fifo, ...) from a plain generic FPGA reference ?

 

Btw, I did not know of this toolkit, and I couldn't install it, the palette seems corrupted for me...

0 Kudos
Message 2 of 7
(2,011 Views)

Rapschru,

 

One example of how I would prefer to use this:

 

Say I have 50 registers on the FPGA and I would like to update them individually.  I don't want to have 50 cases or 50 sub vis.  Id prefer to just have a map and select the register to update. 

 

1. Yes the XNode is possibly broken for LV2020, C:\Program Files (x86)\National Instruments\LabVIEW 2020\vi.lib\NI\LVFPGA Adv Session Resources.  You can pull two "functional" vis from there as seen in the snippet. I say functional because they work, but require some further testing.

2. I probably should have worked this all out, but I stopped at the first problem. The OpenByName requires a single value FPGA reference, which can be built manually with the provided reference XNode. The single value is the data type of the register you are reading and that is the reference of interest.  That's the first issue I've encountered with this idea. The second issue is the read/write control XNode, 5 in the snippet.  Not sure how to go about resolving that either.  

 

I don't expect this to be as efficient as the standard method, but I'm curious to benchmark it because it could reduce development time. 

Session_Resource.png



-Matt
0 Kudos
Message 3 of 7
(1,997 Views)

Ok, so you want an FPGA reference with either a single register named "Value" or a single FIFO named "FIFO", with the desired data type, to query the resource using the OpenByName function.

My example "Script Single-Value FPGA Reference.vi" does that.

 

I hardly see the interest of using this toolkit since you still need to script every possible data type to generically access your registers...

In my opinion, scripting the Read/Write for each register with a big case structure would be more runtime-efficient and more robust regarding all the bugs this toolkit seems to have...

0 Kudos
Message 4 of 7
(1,979 Views)

After discovering the second blocker I agree that it would probably be easier to script handler VIs for each case and using the LV native functions.  


But, since the topic is open... This solution works in development, but would it work in runtime? Im assuming user data is "SuperSecretPrivateSpecialStuff"?



-Matt
0 Kudos
Message 5 of 7
(1,949 Views)

What is the second blocker ? As said in the toolkit presentation, the single register must be named "Value" and the single FIFO must be named "FIFO". Your node (5) in your snippet does not need to be scripted as the data type of the reference is automatically propagated to it.

 

The script modifies the code, so yes, development environment only. But it is a developer tool, so that's expected.

 

The "User Data" property is accessible after adding "SuperSecretPrivateSpecialStuff=True" to your LabVIEW.ini.

0 Kudos
Message 6 of 7
(1,936 Views)

Wanted to add a final note to this thread and state that dynamically scripting FPGA references at runtime is not possible in the current LabVIEW version. 



-Matt
0 Kudos
Message 7 of 7
(1,840 Views)