LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabVIEW FPGA: Initial Value of UnInitialized Shift Register

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)

0 Kudos
Message 1 of 5
(3,094 Views)
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. If you need to be certain of the value on the first iteration, use a Select with the selector input wired to a "First Call" function (or with an Equal to Zero function comparing the loop iteration - but wiring the iterator terminal of a loop can use extra resources).
0 Kudos
Message 2 of 5
(3,052 Views)

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.
shift register example.png

Tanner B.
Systems R&D Engineer - Aerospace, Defense, and Government
National Instruments
0 Kudos
Message 3 of 5
(2,999 Views)

I prefer using feedback registers for this because I believe they have the option to set the initial value statically (at compile time).

0 Kudos
Message 4 of 5
(2,989 Views)

@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!

Message 5 of 5
(2,977 Views)