Syntax
VAR16 * VALUE16 >> N
|
PROD = (VAR16*value16) >> N
|
VAR16 * VALUE16 << N
|
PROD = (VAR16*value16) << N
|
VAR16A * VAR16B >> N
|
PROD = (VAR16A*VAR16B) >> N
|
VAR16A * VAR16B << N
|
PROD = (VAR16A*VAR16B) << N
|
VAR32 * VALUE16 >> N
|
PROD = (VAR32*value16) >> N
|
VAR32 * VALUE16 << N
|
PROD = (VAR32*value16) << N
|
VAR32 * VAR16 >> N
|
PROD = (VAR32*VAR16) >> N
|
VAR32 * VAR16 << N
|
PROD = (VAR32*VAR16) << N
|
Operands | VAR16D: destination integer variable |
VAR16S: source integer variable
VAR32D: destination long/fixed variable
VAR32S: source long/fixed variable
value16: 16-bit immediate integer value
value32: 32-bit immediate long value
N: result shift factor
Binary code
Description | Multiplies 2 operands. The first operand (left one) can be a 16-bit or 32-bit TML variable. The second operand (right one) can be a 16-bit immediate value or another 16-bit TML variable. The result is saved in a dedicated 48-bit product register left or right shifted by 0 to 15 bits. The TML long variables PROD and PRODH show the 32LSB respectively the 32 MSB of the product register. |
Execution | Product register = (first operand * second operand) shifted to left or right with the specified number of bits |
Example1
int Var1;
long var2;
...
Var1 * 0x125;
Var2 = PROD;
Before instruction
|
|
After instruction
|
Var1
|
0x1256
|
|
Var1
|
0x1256
|
Product register
|
x
|
|
Product register
|
0x00000014FC6E
|
Var2
|
x
|
|
Var2
|
0x0014FC6E
|
Example2
int Var1;
long Var2;
...
Var1 * 0x125 << 12;
Var2 = PRODH;
Before instruction
|
|
After instruction
|
Var1
|
0x1256
|
|
Var1
|
0x1256
|
Product register
|
x
|
|
Product register
|
0x00014FC6E000
|
Var2
|
X
|
|
Var2
|
0x00014FC6
|
Example3
int Var2, Var3;
long Var4;
...
Var2 * Var3 >> 4;
Var4 = PROD;
Before instruction
|
|
After instruction
|
Var2
|
0x1256
|
|
Var2
|
0x1256
|
Var3
|
0x125
|
|
Var3
|
0x125
|
Product register
|
x
|
|
Product register
|
0x000000014FC6
|
Var4
|
x
|
|
Var4
|
0x00014FC6
|
Example4
int Var2, Var3;
long Var7;
...
Var2 * Var3 << 8;
Var7 = PROD(H);
Before instruction
|
|
After instruction
|
Var2
|
0x1256
|
|
Var2
|
0x1256
|
Var3
|
0x125
|
|
Var3
|
0x125
|
Product register
|
x
|
|
Product register
|
0x000014FC6E00
|
Var7
|
x
|
|
Var7
|
0x000014FC
|
Example5
long Var1, Var2;
...
Var1 * 0x125;
Var2 = PROD;
Before instruction
|
|
After instruction
|
Var1
|
0x001256AB
|
|
Var1
|
0x1256
|
Product register
|
x
|
|
Product register
|
0x000014FD31B7
|
Var2
|
x
|
|
Var2
|
0x14FD31B7
|
Example6
long Var1, Var2;
...
Var1 * 0x125 << 12;
Var2 = PROD(H);
Before instruction
|
|
After instruction
|
Var1
|
0x001256AB
|
|
Var1
|
0x1256
|
Product register
|
x
|
|
Product register
|
0x014FD31B7000
|
Var2
|
x
|
|
Var2
|
0x014FD31B
|
Example7
long Var2, Var9;
int Var3;
...
Var2 * Var3 >> 4;
Var9 = PROD(H);
Before instruction
|
|
After instruction
|
Var2
|
0x001256AB
|
|
Var2
|
0x001256AB
|
Var3
|
0x125
|
|
Var3
|
0x125
|
Product register
|
x
|
|
Product register
|
0x0000014FD31B
|
Var9
|
x
|
|
Var9
|
0x0000014F
|
Example8
long Var2, Var9;
int Var3;
...
Var2 * Var3 << 8;
Var9 = PROD;
Before instruction
|
|
After instruction
|
Var2
|
0x001256AB
|
|
Var2
|
0x001256AB
|
Var3
|
0x125
|
|
Var3
|
0x125
|
Product register
|
x
|
|
Product register
|
0x0014FD31B700
|
Var9
|
X
|
|
Var9
|
0xFD31B700
|
|