04-10-2015 08:20 PM
Current Versions of Software:
LabVIEW 2014 SP1
LabVIEW FPGA 2014
Xilinx Vivado
Hi all,
I was wondering what guidlines or best practices there are for using shift registers in SCTL's with LUT's in their path.
I cannot initialze the shift regiater value in the beginning of the SCTL because the LUT is in the path, so I was curious:
Is the default value of an unitialized shift register 0 (or all 0's) or should I add an initialization case to my loop as it could be random?
On the attached image, it illustrates my case (would these all be initially zero's or would they be random and therefore require a case to initialze them to zeros)
04-10-2015 11:39 PM
04-13-2015 07:59 AM - edited 04-13-2015 07:59 AM
This is partially true. An initialized shift register is the default for the datatype on the first run, but on every subsequent run it retains the value that was in the shift register at termination. If the attached snippet is run, Numeric is 0 the first time it's called and 5 every other time.
04-13-2015 08:08 AM
I prefer using feedback registers for this because I believe they have the option to set the initial value statically (at compile time).
04-13-2015 09:15 AM
@nathand wrote:
Normally, the value of an uninitializeduninitialized shift register is the default value for that data type (0 for a number, false for a boolean, an empty string, etc). However, on an FPGA, I would not rely on this.
LabVIEW FPGA should, unless documented otherwise, follow LabVIEW G semantics. In this case, the first time the loop executes on each run the shift register will be initialized to the default value for the data type which is zeros for numeric values and false for booleans. If that is not the case, there is a bug in the compiler so please let NI know about it!