LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

FPGA: passing global varible to FPGA VI

Hi,

 

I have refered to http://zone.ni.com/devzone/cda/tut/p/id/9117, an IP to run SPI protocol by using FPGA. The IP built into a subVI and user can easily add number of SPI port by adding the subVI. (the subVI is perfect !)

 

I have noticed that the config parameters are actually assigned to global variable. And these global variables will be used in the SPI subVI. My doubt is, 

 

1. Will this affect the FPGA performance ? If the FPGA is solely programmed to support SPI, maybe will running well.. how if the FPGA has to support other function ?

 

2. If I use a cluster to feed-in the variable (then assign to a local variable if the variable used inside a while loop) to subVI instead of using global variable, will it perform better ? (if consider the FPGA will load other quite-complex function)

 

Please advise. Thanks..

 

 

0 Kudos
Message 1 of 3
(2,785 Views)

Hi engwei,

 

1) The usage of variables on the FPGA VI will take up a certain amount of FPGA resources, e.g. flip-flops and LUTs. Thus, excessive use of variables (especially to hold large data items like big arrays) will use up significant amount of FPGA resources, leaving lesser amounts for your other functions on the FPGA VI. But variables used in moderation on small data types (like the SPI example) should be fine. 

 

2) As long as the FPGA has enough resources to handle the variables and the other functions, the performance of the FPGA would not be affected. This is indicated by a successful compile report (At the end of each compile, there will be a Compile Report dialog box showing FPGA resource usage amounts).

 

3) Although variables are a convenient way of passing data, it is important to note that they are easily subjected to race conditions (e.g. having two subVIs writing to the same global variable at the same time), so the final value of the global variable might not be correct. Care must be taken in your programming to avoid this situation.

 

4) I do not quite understand the usage that you have explained in point (2) of your post, but local variables and global variables both take up FPGA resources, so I think performance wise there should be not much difference between using the two. 

 

Hope the information helps,

 

Best regards,

Victor

NI ASEAN

0 Kudos
Message 2 of 3
(2,753 Views)

Hi Victor,

 

Thanks for your reply. 

 

BR,

engwei

0 Kudos
Message 3 of 3
(2,747 Views)