Shift Arithmetic
Performs a bit shift or a binary point of the signal.
blockType: ArithShift
Path in the library:
|
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) |
|
|
Shifting a binary point to the right by two digits |
|
|
Shifting a binary point to the left by two digits |
|
|
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) |
|
|
Bit shift to the right by two digits |
|
|
Bit shift left by two digits |
|
|
Ports
Output
#
OUT_1
—
result
scalar | vector | the matrix
Details
The result of the operation returned as a scalar, vector, or matrix.
| Data types |
|
| 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 |
|
| 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 |
|
| 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 |
|
| Default value |
|
| Program usage name |
|
| 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 |
|
| Default value |
|
| Program usage name |
|
| 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 |
|
| Program usage name |
|
| 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 |
|
| Program usage name |
|
| 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 |
|
| Default value |
|
| Program usage name |
|
| Tunable |
No |
| Evaluatable |
No |