ShiftLeft Icon
Mathematical.ShiftLeft
ShiftLeftA component that performs a left bitwise shift on an integer input signal.
Description
The ShiftLeft block performs a left bitwise shift on integer input u. The number of positions to shift is specified by the parameter shift_amount. The output y is computed as: y = shiftleft(u, shift_amount).
Variables
u(t): Input signal (integer)y(t): Output signal (shifted integer)shift_amount: Parameter - number of bits to shift left
Examples
Positive shifts:
- u = 3, shift_amount = 2 → y = 12 (binary 11 becomes 1100)
- u = -7, shift_amount = 1 → y = -14 (binary -111 becomes -1110)
Zero shift:
- u = 5, shift_amount = 0 → y = 5 (no change)
Negative shifts (right arithmetic shift):
- u = 3, shift_amount = -2 → y = 0 (3 >> 2 = 0, integer division)
- u = -7, shift_amount = -2 → y = -2 (-7 >> 2 = -2, preserves sign)
Usage
PrimitiveComponents.Mathematical.ShiftLeft(shift_amount)
Parameters:
| Name | Description | Units | Default value |
|---|---|---|---|
shift_amount | – |
Connectors
u- This connector represents an integer signal as an input to a component (IntegerInput)y- This connector represents an integer signal as an output from a component (IntegerOutput)
Behavior
\[ \begin{align} y\left( t \right) &= shiftleft\left( u\left( t \right), \mathtt{shift\_amount} \right) \end{align} \]
Source
"""
ShiftLeft
A component that performs a left bitwise shift on an integer input signal.
# Description
The ShiftLeft block performs a left bitwise shift on integer input `u`.
The number of positions to shift is specified by the parameter `shift_amount`.
The output `y` is computed as: y = shiftleft(u, shift_amount).
# Variables
- `u(t)`: Input signal (integer)
- `y(t)`: Output signal (shifted integer)
- `shift_amount`: Parameter - number of bits to shift left
# Examples
Positive shifts:
- u = 3, shift_amount = 2 → y = 12 (binary 11 becomes 1100)
- u = -7, shift_amount = 1 → y = -14 (binary -111 becomes -1110)
Zero shift:
- u = 5, shift_amount = 0 → y = 5 (no change)
Negative shifts (right arithmetic shift):
- u = 3, shift_amount = -2 → y = 0 (3 >> 2 = 0, integer division)
- u = -7, shift_amount = -2 → y = -2 (-7 >> 2 = -2, preserves sign)
"""
component ShiftLeft
u = Dyad.IntegerInput() {
"Dyad": {
"placement": {
"diagram": {"x1": -40, "x2": 0, "y1": 480, "y2": 520, "sh": 1, "sw": 1, "rot": 0},
"icon": {"x1": -40, "x2": 0, "y1": 480, "y2": 520, "sh": 1, "sw": 1, "rot": 0}
}
}
}
y = Dyad.IntegerOutput() {
"Dyad": {
"placement": {
"diagram": {"x1": 1000, "x2": 1040, "y1": 480, "y2": 520, "sh": 1, "sw": 1, "rot": 0},
"icon": {"x1": 1000, "x2": 1040, "y1": 480, "y2": 520, "sh": 1, "sw": 1, "rot": 0}
}
}
}
# Number of bits to shift left (must be ≥ 0)
parameter shift_amount::Integer()
relations
y = shiftleft(u, shift_amount)
metadata {
"Dyad": {
"labels": [
{"label": "$(instance)", "x": 500, "y": 1100, "rot": 0},
{"label": "shift_amount : $(shift_amount)", "x": 500, "y": -150, "rot": 0}
],
"icons": {"default": "dyad://PrimitiveComponents/ShiftLeft.svg"}
}
}
end
Flattened Source
"""
ShiftLeft
A component that performs a left bitwise shift on an integer input signal.
# Description
The ShiftLeft block performs a left bitwise shift on integer input `u`.
The number of positions to shift is specified by the parameter `shift_amount`.
The output `y` is computed as: y = shiftleft(u, shift_amount).
# Variables
- `u(t)`: Input signal (integer)
- `y(t)`: Output signal (shifted integer)
- `shift_amount`: Parameter - number of bits to shift left
# Examples
Positive shifts:
- u = 3, shift_amount = 2 → y = 12 (binary 11 becomes 1100)
- u = -7, shift_amount = 1 → y = -14 (binary -111 becomes -1110)
Zero shift:
- u = 5, shift_amount = 0 → y = 5 (no change)
Negative shifts (right arithmetic shift):
- u = 3, shift_amount = -2 → y = 0 (3 >> 2 = 0, integer division)
- u = -7, shift_amount = -2 → y = -2 (-7 >> 2 = -2, preserves sign)
"""
component ShiftLeft
u = Dyad.IntegerInput() {
"Dyad": {
"placement": {
"diagram": {"x1": -40, "x2": 0, "y1": 480, "y2": 520, "sh": 1, "sw": 1, "rot": 0},
"icon": {"x1": -40, "x2": 0, "y1": 480, "y2": 520, "sh": 1, "sw": 1, "rot": 0}
}
}
}
y = Dyad.IntegerOutput() {
"Dyad": {
"placement": {
"diagram": {"x1": 1000, "x2": 1040, "y1": 480, "y2": 520, "sh": 1, "sw": 1, "rot": 0},
"icon": {"x1": 1000, "x2": 1040, "y1": 480, "y2": 520, "sh": 1, "sw": 1, "rot": 0}
}
}
}
# Number of bits to shift left (must be ≥ 0)
parameter shift_amount::Integer()
relations
y = shiftleft(u, shift_amount)
metadata {
"Dyad": {
"labels": [
{"label": "$(instance)", "x": 500, "y": 1100, "rot": 0},
{"label": "shift_amount : $(shift_amount)", "x": 500, "y": -150, "rot": 0}
],
"icons": {"default": "dyad://PrimitiveComponents/ShiftLeft.svg"}
}
}
endTest Cases
No test cases defined.
Related
- Examples
- Experiments
- Analyses