Document toolboxDocument toolbox

(8.D.2.7) LogicCompareConst

Overview

Compares the value at the input pin against a stored value

Discussion

This module implements a general purpose logical compare module that is capable of realizing many different logic operations. The behavior of the logic compare is controlled by the compareType parameter. compareType is an integer in the range from 0 to 5 inclusive. The following list discusses the various compare oprations types and which variables are active in each case.

compareType = 0, performs logic equal operation.

compareType = 1, performs logic not equal operation.

compareType = 2, performs logic less than operation.

compareType = 3, performs logic less than equal operation.

compareType = 4, performs logic greater than operation.

compareType = 5, performs logic greater than equal operation.

For example, when compareType == 2, the output pin equals the Boolean value (input < constValue)

Type Definition

typedef struct _ModuleLogicCompareConst { ModuleInstanceDescriptor instance; // Common Audio Weaver module instance structure INT32 compareType; // Selects the type of comparison that is implemented by the module: Equal=0 NotEqual=1 lessThan=2 LessOrEqual=3 greaterThan=4 GreaterOrEqual=5 FLOAT32 constValue; // Selects value against to compare against. In linear units. } ModuleLogicCompareConstClass;

Variables

Properties

Name

Type

Usage

isHidden

Default value

Range

Units

compareType

int

parameter

0

0

0:5

 

constValue

float

parameter

0

0

Unrestricted

 

Pins

Input Pins

Name: in

Description: audio input

Data type: float

Channel range: Unrestricted

Block size range: Unrestricted

Sample rate range: Unrestricted

Complex support: Real

Output Pins

Name: out

Description: audio output

Data type: int

MATLAB Usage

File Name: logic_compare_const_module.m

M=logic_compare_const_module(NAME) Creates a general purpose compare module that implements a number of standard logical operations. The module operates on multiple interleaved channels, with all channels being processed. Arguments: NAME - name of the module. The module has the following variables that control the design: compareType - integer specifying the type of the design (details below). The argument compareType determines what design routine is run, and not all input arguments are used in all cases: 0 = performs logical equal operation 1 = performs logical not equal operation 2 = performs logical less than operation 3 = performs logical less than equal operation 4 = performs logical greater operation 5 = performs logical greater than equal operation

Â