R031 Logic Extract Production
Outline
Logic Extract lets you extract ,swap and invert bits from logic type signals.
Platforms: |
|
|||
Requirements: |
|
|||
Known limitations: |
|
|||
Status: |
|
|||
Input signals: |
|
|||
Output signal: |
|
|||
Parameters: |
|
Input Signal Configuration
The production accepts 1 Logic signal.
- Primary Source
- The primary source is the first source signal of the production.
Output Signal Configuration
Productions are executed on the fly, as soon as the signal data is required for further processing, and re-executed when settings or input signal have been changed. Before executing a production, the system needs to know the source signals, the type and the domain of the signal. All these informations need to be entered into the plot configuration dialog. If you leave the configuration fields empty, impulse tries to extract the information from the sources. The fields will display this information in light gray <e.g. Derived(Time)>.
- Process type
- You may select between discrete and continuous process type.
- Signal descriptor
- The signal descriptor describes the signal type in more details (e.g the bit width of a logic vector (default<bits=16>)). See below for more details. But in most case, you will use the standard settings (default<>) - Press CTRL-Space to view content proposals.
- Domain Class/Base
- The domain base is just required if your output signal has a different domain than the source signals. If not, just don't touch these settings.
- Domain Range
- Use this field to set the domain range, so the minimum and maximum value of the domain (e.g. 0 .. 1000 Hz)
Production Configuration
- Extract: Check to extract bits.
- Bit pos: Bit pos (0..N) of the first bit to extract.
- Count: No of bits to extract.
- Swap: Check to swap bits.
- Invert:Check to invert bits.
To extract bits, check the "Extract" flag and enter the start bit pos and the number of bits to extract ("Count"). Additionally you may check the "Swap" flag to swap the extracted bits (left-to-right) and/or the "Invert" flag to invert all bits.
Signal Handling
- Keep tags: The output samples shall keep the tag information of each input sample.
- Ignore 'None': Ignore 'None' samples of the input signals.
- Hide identical: Check to hide sequence of identical samples (will only write to output signal in case of changed sample value/tag, may not have any effect in case of 'Continuous' process type).
The signal handling flags give the user more control over the output signal generation. If the "Keep tags" is checked, the output samples will get the tag information of each input samples. The "Ignore None" flag let the production ignore 'None' input samples. The "Hide identical" hides the production from generating sequences of identical samples.
Operation
Below you find the operation code for the production.
// iterate while (iter.hasNext() && !isCanceled()) { // value long current = iter.next(); Logic value = input.logicValue(); // none samples boolean isNone = input.isNone(); if (ignoreNone && isNone) continue; if (!isNone && value == null) continue; // tag boolean tag = keepTags && input.isTagged(); // modify value if (value != null) { if (extract) value = value.extract(bit, count); if (invert) value = value.invert(); if (swap) value = value.swap(); } // check identical if (!hideIdentical || !Utils.equals(value, previousValue) || previousTag != tag) { // write if (isNone) targetWriter.writeNone(current, tag); else targetWriter.writeSample(current, tag, value); // remember previousTag = tag; previousValue = value; } }