operators¶
Adds two or more Number -s. The add() gear is automatically instantiated when a “+” operator is used on two interfaces.
-
add(a: Number, b: Number)¶
-
add(din: Tuple[Number, Number]) Add two
Number-s together:a = drv(t=Uint[4], seq=[0, 1, 2]) b = drv(t=Uint[4], seq=[0, 1, 2]) (a + b) | check(ref=[0, 2, 4])
Divide Number -s . The div() gear is automatically instantiated when a “//” operator is used on two interfaces.
-
div(a: Number, b: Number)¶
-
div(din: Tuple[Number, Number]) Divide a
Numberby a constant:a = drv(t=Uint[4], seq=[2, 5, 9]) (a // 3) | check(ref=[0, 1, 3])
Test whether the data from two interfaces is equal. The eq() gear is automatically instantiated when a “==” operator is used on two interfaces.
-
eq(a, b) → Bool¶
-
eq(din: Tuple[Any, Any]) → Bool Compare if two values are equal:
a = drv(t=Uint[4], seq=[1, 2, 3, 4, 5]) b = drv(t=Uint[4], seq=[4, 4, 4, 4, 4]) (a == b) | check(ref=[False, False, False, True, False])
Test whether a Number from one interface is greater then a Number from the other. The gt() gear is automatically instantiated when a “>” operator is used on two interfaces.
-
gt(a: Number, b: Number)¶
-
gt(din: Tuple[Number, Number]) Compare if one value is greater than the other:
a = drv(t=Uint[4], seq=[1, 2, 3, 4, 5]) b = drv(t=Uint[4], seq=[4, 4, 4, 4, 4]) (a > b) | check(ref=[False, False, False, False, True])
Test whether a Number from one interface is greater or equal to the Number from the other. The ge() gear is automatically instantiated when a “>=” operator is used on two interfaces.
-
ge(a: Number, b: Number)¶
-
ge(din: Tuple[Number, Number]) Compare if one value is greater or equal to the other:
a = drv(t=Uint[4], seq=[1, 2, 3, 4, 5]) b = drv(t=Uint[4], seq=[4, 4, 4, 4, 4]) (a >= b) | check(ref=[False, False, False, True, True])
Bitwise inverts data. The invert() gear is automatically instantiated when a “~” operator is used on an interface.
-
invert(a)¶ Bitwise inverts a number:
a = drv(t=Uint[8], seq=[0x01, 0x0f, 0xff]) (~a) | check(ref=[0xfe, 0xf0, 0x00])
Test whether a Number from one interface is less then a Number from the other. The lt() gear is automatically instantiated when a “<” operator is used on two interfaces.
-
lt(a: Number, b: Number)¶
-
lt(din: Tuple[Number, Number]) Compare if one value is greater than the other:
a = drv(t=Uint[4], seq=[1, 2, 3, 4, 5]) b = drv(t=Uint[4], seq=[4, 4, 4, 4, 4]) (a < b) | check(ref=[True, True, True, False, False])
Test whether a Number from one interface is less than or equal to a Number from the other. The le() lear is automatically instantiated when a “<=” operator is used on two interfaces.
-
le(a: Number, b: Number)¶
-
le(din: Tuple[Number, Number]) Compare if one value is less than or equal to the other:
a = drv(t=Uint[4], seq=[1, 2, 3, 4, 5]) b = drv(t=Uint[4], seq=[4, 4, 4, 4, 4]) (a <= b) | check(ref=[True, True, True, True, False])
Performs integer modulo operation. The mod() gear is automatically instantiated when a “%” operator is used on two interfaces.
-
mod(a: Integer, b: Integer)¶
-
mod(din: Tuple[Integer, Integer]) Performs integer modulo operation:
a = drv(t=Uint[4], seq=[0, 2, 4, 6, 8]) (a % 3) | check(ref=[0, 2, 1, 0, 2])
Multiplies two Number data received from the input interfaces and outputs the result. The mul() gear is automatically instantiated when a “*” operator is used on two interfaces.
-
mul(a: Number, b: Number)¶
-
mul(din: Tuple[Number, Number]) Adds two numbers together:
a = drv(t=Uint[4], seq=[0, 1, 2]) b = drv(t=Uint[4], seq=[0, 1, 2]) (a * b) | check(ref=[0, 1, 4])
Test whether the data from two interfaces is not equal. The ne() gear is automatically instantiated when a “!=” operator is used on two interfaces.
-
ne(a, b) → Bool¶
-
ne(din: Tuple[Any, Any]) → Bool Compare if two values are not equal:
a = drv(t=Uint[4], seq=[1, 2, 3, 4, 5]) b = drv(t=Uint[4], seq=[4, 4, 4, 4, 4]) (a != b) | check(ref=[True, True, True, False, True])
Negates data. The neg() gear is automatically instantiated when unary “-” operator is used on an interface.
-
neg(a: Number)¶ Negates a number:
a = drv(t=Uint[4], seq=[0, 7, 15]) (-a) | check(ref=[0, -7, -15])