shift-count

nazarijtipusak080/shift-4-bytes/shift-count

A counter that is counting forward shifts to the left by the number of bits specified by "SHIFT" before adding a new step. "STEP" and "SHIFT" must be >=0. (Counts unsigned integers)
shift-count
@/shift-count
A counter that is counting forward shifts to the left by the number of bits specified by "SHIFT" before adding a new step. "STEP" and "SHIFT" must be >=0. (Counts unsigned integers)
SHIFTnumber
step shift
STEPnumber
Value to add on each increment. Use a negative value (e.g. -1) to make decrements.
INCpulse
Triggers a single increment.
RSTpulse
Resets the accumulated value to zero.
shift-count
OUT
SHIFT
STEP
INC
RST
DONE
DONEpulse
OUTxod/core/micros
To use the node in your project you should have the nazarijtipusak080/shift-4-bytes library installed. Use the “File → Add Library” menu item in XOD IDE if you don’t have it yet. See Using libraries for more info.

C++ implementation

node {
    void evaluate(Context ctx) {
        uint32_t count = getValue<output_OUT>(ctx);

        if (isInputDirty<input_RST>(ctx))
            count = 0;
        else if (isInputDirty<input_INC>(ctx))
            { uint8_t x = getValue<input_SHIFT>(ctx);
            count <<= x;
             uint8_t step = getValue<input_STEP>(ctx);
           count  += step;
            emitValue<output_DONE>(ctx, 1);}

        emitValue<output_OUT>(ctx, count);
    }
}