### IMUL – Integer multiplication

Block SymbolLicensing group: STANDARD Function Description
The IMUL block multiplies two integer input signals $\mathtt{\text{n}}=\mathtt{\text{i1}}\ast \mathtt{\text{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 multiple fits in the range of the given type, the result is the ordinary multiple. In the other cases the result depends on the SAT parameter.

The overflow is not checked for $\mathtt{\text{SAT}}=\mathtt{\text{off}}$, i.e. the output $\mathtt{\text{E}}=\mathtt{\text{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 2000 * 20 = -25536).

For $\mathtt{\text{SAT}}=\mathtt{\text{on}}$ the overflow results in setting the error output to $\mathtt{\text{E}}=\mathtt{\text{on}}$ and the n output to the nearest displayable value. For the above mentioned example we get 2000 * 20 = 32767).

Inputs

 i1 First integer input of the block  $↓$-9.22E+18 $↑$9.22E+18 Long (I32) i2 Second integer input of the block  $↓$-9.22E+18 $↑$9.22E+18 Long (I32)

Parameters

 vtype Numeric type  $\odot$4 Long (I32) –- ... 2 .... Byte (U8) 3 .... Short (I16) 4 .... Long (I32) 5 .... Word (U16) 6 .... DWord (U32) –- ... –- ... –- ... 10 ... Large (I64) SAT Saturation (overflow) checking Bool off .. Overflow is not checked on ... Overflow is checked

Outputs

 n Integer product of the input signals Long (I32) E Error flag Bool off .. No error on ... An error occurred

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