To download NI software, including the products shown below, visit ni.com/downloads.
Overview
This example demonstrates how to calculate the average for 2^N input points on a FPGA.
Description
This VI computes the average of 2^N 64-bit integer (I64) numbers and outputs the result. When the result is computed, Output Valid? is set to 'True'. For example, if N = 5, this VI will average 2^5=32 64-bit integer numbers, return the result and set Output Valid? as 'True'.
A Reset boolean is also provided to reset the FPGA VI. When Reset is set as True, all feedback nodes are set to '0', Average is set to '0' and Output Valid? is kept at 'False'.
The VI is built to accept the largest data representation available on a FPGA (I64). If you want to average numbers which don’t need the largest data representation, like I8, I16 and so on, modify the data representation inside the averager to a smaller data representation. This will save space on the FPGA and speed up the compilation process.
Requirements
Software
Hardware
Steps to Implement or Execute Code
Additional Information or References
Note
Keep in mind, that the averager can roll over without notification if you try to average to many points or if the input values are to big.
**The code for this example has been edited to meet the new Community Example Style Guidelines. The edited copy is marked with the text ‘NIVerified’. Read here for more information about the new Example Guidelines and Community Platform.**
Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.