EasyManua.ls Logo

Atmel AVR - 83 MULSU - Multiply Signed with Unsigned; Description; Status Register (SREG) and Boolean Formula

Atmel AVR
191 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
83. MULSU – Multiply Signed with Unsigned
83.1. Description
This instruction performs 8-bit × 8-bit → 16-bit multiplication of a signed and an unsigned number.
Rd Rr R1 R0
Multiplicand Multiplier
Product High Product Low
8 8 16
The multiplicand Rd and the multiplier Rr are two registers. The multiplicand Rd is a signed number, and
the multiplier Rr is unsigned. The 16-bit signed product is placed in R1 (high byte) and R0 (low byte).
This instruction is not available in all devices. Refer to the device specific instruction set summary.
Operation:
(i) R1:R0 ← Rd × Rr (signed ← signed × unsigned)
Syntax: Operands: Program Counter:
(i) MULSU Rd,Rr 16 ≤ d ≤ 23, 16 ≤ r ≤ 23 PC ← PC + 1
16-bit Opcode:
0000 0011 0ddd 0rrr
83.2. Status Register (SREG) and Boolean Formula
I T H S V N Z C
C R15
Z R15 • R14 • R13 • R12 • R11 • R10 • R9 • R8R7 • R6 • R5 • R4 • R3 • R2 • R1 • R0
Set if the result is $0000; cleared otherwise.
R (Result) equals R1,R0 after the operation.
Example:
;******************************************************************************
;* DESCRIPTION
;* Signed multiply of two 16-bit numbers with 32-bit result.
;* USAGE
;* r19:r18:r17:r16 = r23:r22 * r21:r20
;******************************************************************************
muls16x16_32:
clr r2
muls r23, r21 ; (signed)ah * (signed)bh
movw r19:r18, r1:r0
mul r22, r20 ; al * bl
movw r17:r16, r1:r0
mulsu r23, r20 ; (signed)ah * bl
Atmel AVR Instruction Set Manual [OTHER]
Atmel-0856L-AVR-Instruction-Set-Manual_Other-11/2016
127

Table of Contents

Related product manuals