IADD – Integer addition

Block SymbolLicensing group: STANDARD
PIC

Function Description
The IADD block sums two integer input signals n= i1 + i2. The range of integer numbers in a computer is always restricted by the variable type. This block uses the vtype parameter to specify the type. If the sum fits in the range of the given type, the result is the ordinary sum. In the other cases the result depends on the SAT parameter.

The overflow is not checked for SAT = off, i.e. the output E = off and the output value n corresponds with the arithmetics of the processor. E.g. for the Short type, which has the range of -32768..+32767, we obtain 30000 + 2770 = -32766).

For SAT = on the overflow results in setting the error output to E = on and the n output to the nearest displayable value. For the above mentioned example we get 30000 + 2770 = 32767).

Inputs

i1

First integer input of the block   -9,22E+18  9,22E+18

long

i2

Second integer input of the block   -9,22E+18  9,22E+18

long

Outputs

n

Integer sum of the input signals

long

E

Error flag

bool

off ..

No error

on ...

An error occurred

Parameters

vtype

Numeric type  4

long

2 ....

Byte (range 0 ... 255)

3 ....

Short (range -32768 ... 32767)

4 ....

Long (range -2147483648 ... 2147483647)

5 ....

Word (range 0 ... 65536)

6 ....

DWord (range 0 ... 4294967295)

10 ...

Large (range -9223372036854775808...9223372036854775807)

SAT

Saturation (overflow) checking

bool

off ..

Overflow is not checked

on ...

Overflow is checked

2019 © REX Controls s.r.o., www.rexygen.com