DSP Builder for Intel® FPGAs (Advanced Blockset): Handbook

ID 683337
Date 7/15/2024
Public
Document Table of Contents

14.4.58. Trig

The Trig block applies a trigonometric operation to its floating-point inputs and produces the floating-point result.
Note: Your design may use up to 50% less resources if you use the pi functions.
Table 261.  Functions for the Trig Block
Function Description
acos(a) Arc cosine (inverse cosine) output in radians.
asin(a) Arc sine (inverse sine) output in radians.
atan(a) Arc tangent (inverse tangent) output in radians.
acos(x)/pi Arc cosine (inverse cosine) output as fraction of half circle.
asin(x)/pi Arc sine (inverse sine) output as fraction of half circle.
atan(x)/pi Arc tangent (inverse tangent) output as fraction of half circle.
atan2(y,x) Four quadrant inverse tangent, output angle in interval [-π,+π] radians.
cos(a) Cosine of input in radians.
cos(pi*x) Cosine of input angle specified as fraction of half circle.
cot(a) Cotangent of input in radians.
cot(pi*x) Cotangent of input angle specified as fraction of half circle.
sin(a) Sine of input in radians.
sin(pi*x) Sine of input angle specified as fraction of half circle.
sincos(a) Outputs both sine and cosine of input a in radians.
tan(a) Tangent of input in radians.
tan(pi*x) Tangent of input angle specified as fraction of half circle.

The Function parameter selects one of the 16 trigonometric functions. The number of input ports and output ports on the block change as required by the semantics of the function that you select:

  • One-input and one-output: sin, cos, tan, cot, asin, acos, atan
  • Two-inputs and one-output: atan2
  • One-input and two-outputs: sincos

If you reduce the input range for the sin(x) and cos(x) functions to the interval [-2pi,2pi], and you target devices with floating-point DSP blocks, in Advanced Options set struct('rangeReduction',0). The design then uses the floating-point mode of the DSP blocks to build more efficient architectures.

Table 262.  Port Interface for the Trig Block
Signal Direction Type Description Vector Data Support Complex Data Support
x Input Single or double Operand 1

(Operand 2 of atan2)

Yes No
y Input Single or double Operand 1 of atan2 Yes No
q Output Single or double Result 1 Yes No
r Output Single or double Result 2

(Cosine output of sincos)

Yes No