Engee documentation

Shift Arithmetic

Performs a bit shift or a binary point of the signal.

blockType: ArithShift

Path in the library:

/Basic/Logic and Bit Operations/Shift Arithmetic

Description

Block Shift Arithmetic shifts the bits or the binary point of the input signal, or performs both of these operations.

The table shows an example of a binary point shift for input data of the type Fixed two digits to the right and left.

The shift operation Binary value Decimal value

No shift (original number)

11001.011

−6.625

Shifting a binary point to the right by two digits

1100101.1

−26.5

Shifting a binary point to the left by two digits

110.01011

−1.65625

Block Shift Arithmetic performs an arithmetic bit shift operation on signed numbers. Therefore, the block reuses the highest bit for each bit shift. The table shows an example of bit shifting for input data of the type Fixed two digits to the right and left.

The shift operation Binary value Decimal value

No shift (original number)

11001.011

−6.625

Bit shift to the right by two digits

11110.010

−1.75

Bit shift left by two digits

00101.100

5.5

Ports

Output

# OUT_1 — result
scalar | vector | the matrix

Details

The result of the operation returned as a scalar, vector, or matrix.

Data types

Float32, Float64, Int32, Int64, Fixed

Complex numbers support

Yes

Input

# IN_1 — the number being converted
scalar | vector | the matrix

Details

The number to perform the shift operation on, specified as a scalar, vector, or matrix.

Data types

Float32, Float64, Int32, Int64, Fixed

Complex numbers support

Yes

# s — number of bits to shift
scalar

Details

The number of bits to shift, set as a scalar.

Dependencies

To use this port, set the parameter Source meaning Input port.

Data types

Int32, Int64

Complex numbers support

Yes

Parameters

Bits to shift

# Source — source of the number of bits to shift
Dialog | Input port

Details

Specify whether to enter the number of bits for the shift in the parameter Number or inherit values from the input port s.

Values

Dialog | Input port

Default value

Dialog

Program usage name

BitShiftNumberSource

Tunable

No

Evaluatable

No

# Direction — the direction of the bit shift
Bidirectional | Right | Left

Details

Specify the direction of the bit shift: left, right, or bidirectional.

Values

Bidirectional | Right | Left

Default value

Bidirectional

Program usage name

BitShiftDirection

Tunable

No

Evaluatable

No

# Number — number of bits to shift
Scalar / array of integers

Details

Set the number of bits to shift.

If the parameter Direction it matters Bidirectional, then the positive value is Number It means a shift to the right, and a negative one means a shift to the left.

Dependencies

To use this parameter, set for the parameter Source meaning Dialog.

Default value

8

Program usage name

BitShiftNumber

Tunable

No

Evaluatable

Yes

Main

# Binary points to shift — the number of digits to shift a binary point
Integer

Details

Specify an integer number of digits to shift the binary point of the input signal. A positive number means a shift to the right, and a negative number means a shift to the left.

Default value

0

Program usage name

BinPtShiftNumber

Tunable

No

Evaluatable

Yes

# Diagnostic for out of range shift value — diagnostic action
None | Error

Details

Specify whether to output an error during the simulation when the block contains an out-of-range shift value. Options include:

  • None — the system is not taking any action.

  • Error — the system completes the simulation and displays an error.

Values

None | Error

Default value

None

Program usage name

DiagnosticForOORShift

Tunable

No

Evaluatable

No

Additional options

C code generation: Yes