2.2 Example 2 – Special Cases
This example shows some special cases of the MUL instruction that are
valid.
lds r0,variableA ; Load r0 with SRAM variable A lds r1,variableB ; Load r1 with SRAM variable B mul r1,r0 ; r1:r0 = variable A * variable B lds r0,variableA ; Load r0 with SRAM variable A mul r0,r0 ; r1:r0 = square(variable A)
Even though the operand is put in the result register pair R1:R0, the operation gives the correct result since R1 and R0 are fetched in the first clock cycle and the result is stored back in the second clock cycle.