LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Export list of names of FPGA Controls as plain text?

Solved!
Go to solution

I'm working on a Labview 2014 project that uses a compactRIO device with Zynq FPGA. When I open the file "FPGA--Reference.ctl Strict Type Def on Real_Time.lvproj" and right-click on "FPGA Refnum" and then select "Configure FPGA VI Reference..." I see a list of the controls with name and type description (Boolean, U32, I16, Fixed Point etc.)  There are quite a few of them, around 200 in all and they don't fit on one screen, I have to scroll through using the somewhat small non-resizable window provided, and I can't select and copy the names as if they were plain text.

 

Is there a way to export this list of control names and types to a plain text file, for external reference and documentation purposes?  Or does such a file get created "behind the scenes" somewhere during the FPGA compilation step, that I can locate?

0 Kudos
Message 1 of 4
(2,843 Views)

To answer my own question- I didn't realize the bitfile (FPGA.lvbitx) is actually a text-based XML format file, so you can parse out the <Register><Name>  and <Datatype> elements to get the list I wanted.

0 Kudos
Message 2 of 4
(2,836 Views)

Yep, you can use standard XML utilities to read the Register section of the bitfile to get the information you want.

 

Alternatively, and not officially supported, you can try the Bitfile utilities in vi.lib\rvi\Bitfile\Public. For instance, niFpgaBitfileGet_ViInfo.vi will return a structure of information including the register descriptions in the bitfile.

Message 3 of 4
(2,828 Views)
Solution
Accepted by topic author jbeale1

In case anyone else wants to do this, I used the unix XML tool "xmlstarlet" (also available for cygwin) to get the names and bit widths of all FPGA registers from the bitfile.  This gives you two text files, but the order is preserved so you can copy and paste them as separate columns into Excel and so you have the (name, bitwidth) pairs aligned.

 

xmlstarlet sel -t -m "/Bitfile/VI/RegisterList/Register/Name/text()" -c . -n FPGA/bitfiles/FPGA.lvbitx > RegisterList.txt

xmlstarlet sel -t -m "/Bitfile/VI/RegisterList/Register/SizeInBits/text()" -c . -n FPGA/bitfiles/FPGA.lvbitx > SizeList.txt

0 Kudos
Message 4 of 4
(2,779 Views)