Difference between revisions of "Component: Scale (DSP)"

From Flowcode Help
Jump to navigationJump to search
(XML import)
 
(4 intermediate revisions by 2 users not shown)
Line 4: Line 4:
 
|-
 
|-
 
| width="20%" style="color: gray;" | Author
 
| width="20%" style="color: gray;" | Author
| [http://www.matrixltd.com Matrix Ltd]
+
| Matrix Ltd
 
|-
 
|-
 
| width="20%" style="color: gray;" | Version
 
| width="20%" style="color: gray;" | Version
| 1.1
+
| 1.1 (Release)
 
|-
 
|-
 
| width="20%" style="color: gray;" | Category
 
| width="20%" style="color: gray;" | Category
Line 17: Line 17:
 
==[[File:Component Icon f1af5256_1dee_491c_b43f_fdc8f33279fb.png|Image]] Scale component==
 
==[[File:Component Icon f1af5256_1dee_491c_b43f_fdc8f33279fb.png|Image]] Scale component==
 
Allows the values in a single buffer to be scaled uniformly.
 
Allows the values in a single buffer to be scaled uniformly.
Functions include: AddOffset, Divide, LeftShift, Multiply, RightShift, Subtract
+
Functions include: AddOffset, Divide, LeftShift, Multiply, RightShift, Subtract, ScaleReal
  
 
==Examples==
 
==Examples==
 
 
Here is a basic example showing various aspects of the DSP scale component.
 
Here is a basic example showing various aspects of the DSP scale component.
 
+
{{Fcfile|Scale.fcfx|Scale}}
[[File:Scale.fcfx]]
 
 
 
 
 
 
The RightShift macro is a very efficient means of performing a division but only for values which are a power of 2.
 
The RightShift macro is a very efficient means of performing a division but only for values which are a power of 2.
  
Line 47: Line 43:
 
Note that the maths for the scale function will not take roll overs into account, this is why the multiply and left shift traces wrap back to zero when the input is above the mid point level.
 
Note that the maths for the scale function will not take roll overs into account, this is why the multiply and left shift traces wrap back to zero when the input is above the mid point level.
  
128 x 2 = 256 & 0xFF = 0
+
128 x 2 = 256
 +
 
 +
256 & 0xFF = 0
  
 
==Downloadable macro reference==
 
==Downloadable macro reference==
Line 83: Line 81:
  
 
:[[Variable Types|UINT]] ''Scaler''
 
:[[Variable Types|UINT]] ''Scaler''
 +
 +
 +
'''Return value'''
 +
 +
:''This call does not return a value''
 +
 +
 +
===<span style="font-weight: normal;"><u><tt>ScaleReal</tt></u></span>===
 +
Scales the value based on a floating point number.
 +
 +
'''Parameters'''
 +
 +
:[[Variable Types|FLOAT]] ''Scaler''
 +
::Value to set the floating point scale
 +
 +
 +
'''Return value'''
 +
 +
:''This call does not return a value''
 +
 +
 +
===<span style="font-weight: normal;"><u><tt>ScaleRealTick</tt></u></span>===
 +
Scales the value based on a floating point number.
 +
 +
'''Parameters'''
 +
 +
:[[Variable Types|FLOAT]] ''Scaler''
 +
::Value to set the floating point scale
  
  

Latest revision as of 11:25, 13 February 2015


Author Matrix Ltd
Version 1.1 (Release)
Category DSP


Image Scale component

Allows the values in a single buffer to be scaled uniformly. Functions include: AddOffset, Divide, LeftShift, Multiply, RightShift, Subtract, ScaleReal

Examples

Here is a basic example showing various aspects of the DSP scale component. FC6 Icon.png Scale The RightShift macro is a very efficient means of performing a division but only for values which are a power of 2.

The LeftShift macro is a very efficient means of performing a multiplication but only for values which are a power of 2.


LeftShift(1) = Multiply by 2

LeftShift(2) = Multiply by 4

LeftShift(3) = Multiply by 8

LeftShift(4) = Multiply by 16


Here is an example which demonstrates multiplication and division and then compares to the shift macros.

DSPScale.jpg


Note that the maths for the scale function will not take roll overs into account, this is why the multiply and left shift traces wrap back to zero when the input is above the mid point level.

128 x 2 = 256

256 & 0xFF = 0

Downloadable macro reference

DivideTick

Allows a integer divide to be assigned to the current index position within the buffer.

Parameters

UINT Scaler


Return value

This call does not return a value


LeftShift

Allows a highly efficient multiply to be assigned to every value within the buffer.

Parameters

BYTE Scaler


Return value

This call does not return a value


MultiplyTick

Allows a less efficient but more flexible multiply to be assigned to the current index position within the buffer.

Parameters

UINT Scaler


Return value

This call does not return a value


ScaleReal

Scales the value based on a floating point number.

Parameters

FLOAT Scaler
Value to set the floating point scale


Return value

This call does not return a value


ScaleRealTick

Scales the value based on a floating point number.

Parameters

FLOAT Scaler
Value to set the floating point scale


Return value

This call does not return a value


SubtractOffset

Allows a integer offset to be subtracted from every value within the buffer.

Parameters

UINT Offset


Return value

This call does not return a value


Divide

Allows a integer divide to be assigned to every value within the buffer.

Parameters

UINT Scaler


Return value

This call does not return a value


LeftShiftTick

Allows a highly efficient multiply to be assigned to the current index position within the buffer.

Parameters

BYTE Scaler


Return value

This call does not return a value


Multiply

Allows a less efficient but more flexible multiply to be assigned to every value within the buffer.

Parameters

UINT Scaler


Return value

This call does not return a value


RightShift

Allows a highly efficient divideto be assigned to every value within the buffer.

Parameters

BYTE Scaler


Return value

This call does not return a value


RightShiftTick

Allows a highly efficient divide to be assigned to the current index position within the buffer.

Parameters

BYTE Scaler


Return value

This call does not return a value


AddOffsetTick

Allows a integer offset to be added to the current index position within the buffer.

Parameters

UINT Offset


Return value

This call does not return a value


SubtractOffsetTick

Allows a integer offset to be subtracted from a single index value within the buffer.

Parameters

UINT Offset


Return value

This call does not return a value


AddOffset

Allows a integer offset to be added to every value within the buffer.

Parameters

UINT Offset


Return value

This call does not return a value


Simulation macro reference

This component does not contain any simulation macros


Property reference

Buffer Manager

This property is of type Fixed list of ints and can be referenced with the variable name buffer_manager.

Reference to DSP system buffer manager component.

Input

This property is of type Fixed list of ints and can be referenced with the variable name input_a.

Buffer assigned to input channel

Output

This property is of type Fixed list of ints and can be referenced with the variable name output_c.

Buffer assigned to output channel