Computes the square root of x. The encoding of x must be unsigned.

This function supports only scalar values of the fixed-point data type.


icon

Dialog Box Options

Option Description
Fixed-Point Configuration

Specifies the encodings, word lengths, and integer word lengths of the input and output terminals of this function. The configurations you specify determine the value range of the terminals.

  • x Type

    Specifies the fixed-point configuration of the x input terminal.

    If you wire a fixed-point data type to this terminal and that data type follows the rules for this terminal, LabVIEW dims this section and uses information from the wire. If you wire a fixed-point data type to this terminal that does not follow the rules, LabVIEW breaks the wire.

    • Word length—Specifies the word length of this terminal.
    • Integer word length—Specifies the integer word length of this terminal.
    • Signed—Specifies that this terminal is signed. LabVIEW sets the encoding to Unsigned and dims this option.
    • Unsigned—Specifies that this terminal is unsigned. LabVIEW sets the encoding to Unsigned and dims this option.
  • sqrt(x) Type

    Specifies the fixed-point configuration of the sqrt(x) output terminal.

    • Include overflow status—Specifies whether the output terminal includes the overflow status. LabVIEW propagates this status to downstream nodes. Including this status requires additional FPGA resources. By default, this checkbox does not contain a checkmark.

      If you place a checkmark in this checkbox, the overflow status becomes TRUE in either of the following situations:

      • The overflow status of an input terminal is TRUE.
      • Overflow occurs during the operation of this function.

      If you place a checkmark in the Adapt to source checkbox, LabVIEW sets Include overflow status depending on whether an input terminal includes this status.

    • Word length—Specifies the word length of this terminal.
    • Signed—Specifies that this terminal is signed. sqrt(x) always is greater than or equal to 0, so LabVIEW sets the encoding to Unsigned and dims this option.
    • Unsigned—Specifies that this terminal is unsigned. sqrt(x) always is greater than or equal to 0, so LabVIEW sets the encoding to Unsigned and dims this option.
    • Integer word length—Specifies the integer word length of this terminal. LabVIEW sets this value based on the Integer word length you specify in the x Type section and dims this option.
    • Adapt to source—Specifies whether LabVIEW automatically adjusts the fixed-point configuration of the output data type to avoid overflow. By default, this checkbox contains a checkmark and LabVIEW dims the following options.
      Note Because the precision of the square root might be infinite, rounding errors always occur.
  • Overflow mode

    Specifies how this function handles overflow. You can choose either Wrap (default) or Saturate.

    Note The Saturate option requires more FPGA resources and a longer combinatorial path than the Wrap option does. In this situation, choosing Saturate might decrease the maximum clock rate at which this function can compile.
  • Rounding mode

    Specifies how this function rounds the output data. You can choose Truncate (default), Round Half-Up, or Round Half-Even. The option you choose might affect the amount of resources this function requires.

Execution Mode

Specifies how this function executes.

  • Outside single-cycle Timed Loop

    Configures this Express VI to execute outside a single-cycle Timed Loop.

    If you select this option and place this Express VI inside a single-cycle Timed Loop, the Code Generation Errors window reports an error when you compile the FPGA VI.

  • Inside single-cycle Timed Loop

    Configures this Express VI to execute inside a single-cycle Timed Loop.

    If you select this option and place this Express VI outside a single-cycle Timed Loop, the Code Generation Errors window reports an error when you compile the FPGA VI.

  • Throughput

    Specifies the minimum number of cycles between two successive values of valid input data. Entering a low value in this control results in a high throughput rate. The maximum value of Throughput depends on the Word length of the output terminal. This option is available only if you select Inside single-cycle Timed Loop.

    If you select Outside single-cycle Timed Loop, this function returns a valid result on every call to the function. Therefore, the Throughput control displays 1 call / sample. The Configuration Feedback indicator displays the number of clock cycles this function takes to return a valid result.

Registers

Specifies whether to add internal registers for function inputs and/or outputs. These registers will be placed outside of any embedded resources, such as block multipliers or DSP48E slices. This section is available only if you select Inside single-cycle Timed Loop.

Note Adding registers can reduce the length of the combinatorial path, which can prevent compilation errors that result from a long combinatorial path. However, adding registers also increases the latency of this function, which means this function takes additional clock cycles to return a valid result.
  • Register inputs—Adds internal registers after the inputs to this function. Selecting this option increases the latency of the function by one cycle.
  • Register outputs—Adds internal registers before the outputs of this function. Selecting this option increases the latency of the function by one cycle.
Optional Terminal

Specifies a setting for displaying an optional block diagram terminal.

  • Operation overflow—Specifies that this function displays the operation overflow output terminal on the block diagram. This terminal indicates whether overflow occurred during the operation of this function.
Configuration Feedback

Displays information about how this function executes. This information is based on the configuration options you specify.

Inputs/Outputs

  • cunkn.png x

    Specifies the input to this function. x must be unsigned.

  • input valid

    Specifies whether the next data point has arrived for processing. Wire output valid of an upstream node to input valid to transfer data from the upstream node to this Express VI.

    To display this handshaking terminal, select Inside single-cycle Timed Loop in the configuration dialog box.

  • ready for output

    Specifies whether downstream nodes are ready for this Express VI to return a new value. The default is TRUE. Use a Feedback Node to wire ready for input of a downstream node to ready for output of the current node.

    Note If ready for output is FALSE during a given cycle, output valid returns FALSE during that cycle.

    To display ready for output, select Inside single-cycle Timed Loop in the configuration dialog box.

  • iunkn.png sqrt(x)

    Returns the square root of x.

  • operation overflow

    Returns TRUE if the theoretical computed value exceeds the valid range of the output data type. If operation overflow returns TRUE, the Overflow mode option determines the value this function returns.

    LabVIEW displays the operation overflow terminal only if you place a checkmark in the Operation overflow checkbox. This checkbox is located in the Optional Terminal section of the configuration dialog box.

  • output valid

    Returns TRUE if this Express VI has computed a result that downstream nodes can use. Use output valid for handshaking with other FPGA VIs and functions.

    To display output valid, select Inside single-cycle Timed Loop in the configuration dialog box.

  • ready for input

    Returns TRUE if this Express VI is ready to accept new input data. Use a Feedback Node to wire ready for input to ready for output of an upstream node.

    Note If ready for input returns FALSE during a given cycle, LabVIEW discards any data that other nodes send to this Express VI during the following cycle. LabVIEW discards this data even if input valid is TRUE during the following cycle.

    To display ready for input, select Inside single-cycle Timed Loop in the configuration dialog box.

  • If you place a checkmark in the Adapt to source checkbox, overflow still can occur in the sqrt(x) output terminal if all of the following conditions are true:

    • The Rounding mode is Round Half-Up or Round Half-Even.
    • The Integer word length of x is an even number.
    • The following relationship is true:

      , where fwl refers to the fractional word length of a terminal and iwl refers to the integer word length of a terminal.

    Complete the following steps to avoid overflow in this situation:

    1. Remove the checkmark from the Adapt to source checkbox.
    2. Increase the Word length of the sqrt(x) terminal.

    After you complete these steps, LabVIEW does not adjust the fixed-point configuration of the sqrt(x) terminal automatically. If you change the fixed-point configuration of the x terminal and still want to avoid overflow, place a checkmark in the Adapt to source checkbox again. LabVIEW adjusts the fixed-point configuration of the sqrt(x) terminal automatically. Then, complete steps 1–2 above to ensure that no overflow occurs with the updated fixed-point configuration.

    Examples

    Refer to the following example files included with LabVIEW FPGA Module.

    • labview\examples\CompactRIO\FPGA Fundamentals\FPGA Math and Analysis\High-Throughput Math\Vector Normalization\Vector Normalization.lvproj
    • labview\examples\R Series\FPGA Fundamentals\FPGA Math and Analysis\High-Throughput Math\Vector Normalization\Vector Normalization.lvproj