LogicBinaryOp
Overview
Performs logical operations on binary signals
Discussion
This modules performs binary operations on integer input signals. The module has a variable number of input pins and a single output pin. In all cases, all inputs must have the same block size and this equals the block size of the output pin.
The module operates in two fundamentally different modes depending upon the value of the variable oneChannelOutput. If oneChannelOutput==0, then all of the input pins must have the same number of channels. The output pin will then have the same number of channels as the input pins and be formed by applying the binary operation to all the inputs. When this is used, there must be at least 2 input channels If oneChannelOutput==1, then the input pins can each have a different number of channels. The output is then a one channel integer signal that is formed as the binary operation applied over all input channels.
The variable .opType determines the type of binary operation implemented. Possible values are: 0 = AND, 1 = OR, 2 = XOR. The binary operation is applied on a bit-by-bit basis to the 32-bit signals.
When the module is byassed it outputs 0x1 on all samples.
Type Definition
typedef struct _ModuleLogicBinaryOp
{
ModuleInstanceDescriptor instance; // Common Audio Weaver module instance structure
INT32 opType; // AND=0, OR=1, XOR=2. Selects the type of binary operations that is performed.
INT32 oneChannelOutput; // Boolean value that determines whether all channels are operated on to form a single output.
} ModuleLogicBinaryOpClass;
Variables
Properties
Name | Type | Usage | isHidden | Default value | Range | Units |
opType | int | parameter | 0 | 0 | 0:2 | |
oneChannelOutput | int | const | 0 | 0 | 0:1:1 |
Pins
Input Pins
Name: in1
Description: Audio input
Data type: int
Channel range: Unrestricted
Block size range: Unrestricted
Sample rate range: Unrestricted
Complex support: Real
Name: in2
Description: Audio input
Data type: int
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_binary_op_module.m
M=logic_binary_op_module(NAME, NUMIN, ONECHANNELOUTPUT)
Audio Weaver that performs Boolean binary operations (AND, OR, XOR)
on one or more integer input pins. Arguments:
NAME - name of the module.
NUMIN - number of input pins
ONECHANNELOUTPUT - boolean value which determines if multi-channel
input signals are collapsed to a single output channel.