Documentation

Cosine HDL Optimized

Implement fixed-point cosine wave optimized for HDL code generation

Library

HDL Coder™ / Lookup Tables

Description

The Cosine HDL Optimized block implements a fixed-point cosine wave by using a lookup table method that exploits quarter-wave symmetry.

You define the number of lookup table points in the Number of data points parameter. The block implementation is most efficient for HDL code generation when you specify the lookup table data points to be (2^n), where n is an integer. For information about the behavior of this block in HDL Coder, see Cosine HDL Optimized.

Depending on your selection of the Output formula parameter, the blocks can output these functions of the input signal:

  • sin(2πu)

  • cos(2πu)

  • exp(iu)

  • sin(2πu) and cos(2πu)

Use the Table data type parameter to specify the word length of the fixed-point output data type. The fraction length of the output is the output word length minus 2.

Data Type Support

The Cosine HDL Optimized block accepts signals of these data types:

  • Floating point

  • Built-in integer

  • Fixed point

  • Boolean

The output of the block is a fixed-point data type.

For more information, see Data Types Supported by Simulink in the Simulink® documentation.

Parameters

Output formula

Select the signal(s) to output.

Number of data points

Specify the number of data points to retrieve from the lookup table. The implementation is most efficient when you specify the lookup table data points to be (2^n), where n is an integer.

Table data type

Specify the table data type. You can specify an expression that evaluates to a data type, for example, fixdt(1,16,0).

Click the Show data type assistant button to display the Data Type Assistant, which helps you set the table data type.

Show data type assistant

Select the mode of data type specification. If you select Expression, enter an expression that evaluates to a data type, for example, fixdt(1,16,0).

If you select Fixed point, you can use the options in the Data Type Assistant to specify the fixed-point data type. In the Fixed point mode, you can choose binary point scaling, and specify the signedness, word length, fraction length, and the data type override setting.

Characteristics

Data Types

Double | Single | Boolean | Base Integer | Fixed-Point

Sample Time

Inherited from driving block

Direct Feedthrough

Yes

Multidimensional Signals

No

Variable-Size Signals

No

Zero-Crossing Detection

No

Code Generation

Yes

Introduced in R2016b

Was this topic helpful?