Download Help (Windows Only) |

After you obtain the appropriate filter length, step size, and filter coefficients range by simulating the reference floating-point adaptive filter, you can use the AFT Simulate Fixed-Point FIR LMS Express VI to simulate the fixed-point adaptive filter. You can use the fixed-point simulation results to analyze the performance of the fixed-point adaptive filter.

Note You can simulate fixed-point adaptive filters that use only the standard least mean squares (LMS) algorithm. |

Different fixed-point settings require different amounts of computational resources, such as FPGA resources. By simulating a fixed-point adaptive filter, you can determine the fixed-point settings that not only meet the application requirements, but also require the fewest computational resources.

In the configuration dialog box of the AFT Simulate Fixed-Point FIR LMS Express VI, you can specify the fixed-point settings for the adaptive filter. The fixed-point settings include the filter length, step size, word length and integer word length for *x*(*n*), *d*(*n*), *w*(*n*), and so on. After you determine these fixed-point settings, you can use these settings to generate LabVIEW FPGA code for the fixed-point adaptive filter. You also can save these settings to an XML file.

The word length is the number of bits to use in representing a fixed-point number. The integer word length is the number of bits, including the sign bit, to use in representing the integer part of a fixed-point number.

If *wl* and *iwl* are the word length and integer word length, respectively, of a signed fixed-point number, the value range of the fixed-point number is [–2^{(}^{iwl}^{–1)}, 2^{(}^{iwl}^{–1)}). The maximum value of this variable is less than 2^{(}^{iwl}^{–1)}, and the minimum value is –2^{(}^{iwl}^{–1)}.

The difference in bits between the word length and the integer word length determines the number of digits of precision. The least significant bit (LSB) of a fixed-point number, which equals 2^{(}^{iwl}^{–}^{wl}^{)}, represents the number of digits of precision. For example, if a fixed-point variable has a word length of 16 and an integer word length of 1, the range of this fixed-point variable is [–2^{(1–1)}, 2^{(1–1)}), or [–1, 1), and the LSB is 2^{(1–16)}. If you want to increase or reduce the value of the variable, the smallest step size is 2^{–15}.

When you simulate a fixed-point adaptive filter, you must specify appropriate word length and integer word length values for the input and output signals, step size, and filter coefficients.

Specify the word length and integer word length of the input signals *x*(*n*) and *d*(*n*) according to the data source. For example, if you acquire an input signal *x*(*n*) with a word length of 24, you can use that value for the **x(n) word length** option in the configuration dialog box of the AFT Simulate Fixed-Point FIR LMS Express VI.

A large word length value requires more computational resources. To save computational resources on an FPGA target, truncate the input signal to reduce the word length and integer word length values. In the previous example, you can acquire the 16 high bits of the input signal *x*(*n*) and send the signal to the AFT Simulate Fixed-Point FIR LMS Express VI. You then can use the value 16 for the **x(n) word length** option.

When you reduce the word length value to save computational resources, you also reduce the precision of the input signal values. Reducing the precision of the input signal values might degrade the performance of the resulting fixed-point adaptive filter. For example, the fixed-point adaptive filter might not track slight changes in the input signals. Therefore, you must consider both computational resources and adaptive filter performance when determining the word length and integer word length of *x*(*n*) and *d*(*n*).

Specify the word length and integer word length of the filter coefficients *w*(*n*) according to the results of the floating-point adaptive filter simulation. An appropriate **w(n) integer word length** value prevents filter coefficients overflows. For example, if the value range of the filter coefficients that you obtain from floating-point simulation is [–0.8, 1.1], the value 2 might be appropriate for the integer word length of the filter coefficients. If you set the integer word length of the filter coefficients to 2, the value range of the filter coefficients is [–2^{(2–1)}, 2^{(2–1)}), or [–2, 2). This value range covers the value range that you obtain from floating-point simulation.

The word length of the filter coefficients affects the digits of precision. You usually adjust the word length of the filter coefficients after you determine the integer word length. Increase the **w(n) word length** value to obtain a high degree of precision.

A large word length value requires more computational resources on an FPGA target. You must consider both the required degree of precision and the computational resources when determining the word length and integer word length of *w*(*n*).

Specify the step size value for the fixed-point adaptive filter according to the results of the floating-point adaptive filter simulation. Floating-point simulation provides an initial value for the step size of the fixed-point adaptive filter. However, you might need to adjust the initial value after converting the floating-point adaptive filter to fixed-point implementation.

For example, in a floating-point simulation, a small step size can ensure a small steady state error. However, the same step size might be too small for the corresponding fixed-point adaptive filter. If you apply the small step size value to a fixed-point simulation, adaptation stalling might occur. You can increase the step size value to avoid adaptation stalling. You can adjust the step size value in the following two places:

- The
**Step size**text box in the configuration dialog box of the AFT Simulate Fixed-Point FIR LMS Express VI - The
**step size**block diagram input of this Express VI

The word length of the step size is a fixed value, 16. Enter a value in the **step size integer word length** text box in the configuration dialog box of the AFT Simulate Fixed-Point FIR LMS Express VI to specify the integer word length of the step size. A minimal integer word length that satisfies the application requirements can return the maximum degree of precision while using the least amount of computational resources.

After you determine the fixed-point adaptive filter settings, you can save those settings to a file in either of the following two ways:

- Clicking the
**Save FXP Settings**button in the configuration dialog box of the AFT Simulate Fixed-Point FIR LMS Express VI. - Wiring the
**fixed-point settings**output of this Express VI to the**fixed-point settings**input of the AFT Save Fixed-Point Settings VI.

When you generate LabVIEW FPGA code for the fixed-point adaptive filter, you can load the fixed-point adaptive filter settings by clicking the **Load FXP Settings** button in the Generate LabVIEW FPGA Code for LMS Adaptive Filter dialog box.