Uhasx And Uhsax - ST STM32H7 Series Programming Manual

Hide thumbs Also See for STM32H7 Series:
Table of Contents

Advertisement

PM0214
3.5.19

UHASX and UHSAX

Unsigned Halving Add and Subtract with Exchange and Unsigned Halving Subtract and Add
with Exchange.
Syntax
op{cond} {Rd}, Rn, Rm
Where:
op is one of the following:
UHASX: Add and subtract with exchange and halving.
UHSAX: Subtract and add with exchange and halving.
'cond' is an optional condition code (see
'Rd' is the destination register.
'Rn' 'Rm' are registers holding the first and second operands.
Operation
The UHASX instruction:
1.
Adds the top halfword of the first operand to the bottom halfword of second operand.
2.
Shifts the result by one bit to the right, causing a divide by two, or halving.
3.
Writes the halfword result of the addition to the top halfword of the destination register.
4.
Subtracts top halfword of second operand from bottom highword of the first operand.
5.
Shifts the result by one bit to the right, causing a divide by two, or halving.
6.
Writes halfword result of the division in the bottom halfword of the destination register.
The UHSAX instruction:
1.
Subtracts the bottom halfword of the second operand from the top highword of the first
operand.
2.
Shifts the result by one bit to the right, causing a divide by two, or halving.
3.
Writes halfword result of the subtraction in the top halfword of the destination register.
4.
Adds the bottom halfword of the first operand to the top halfword of the second
operand.
5.
Shifts the result by one bit to the right, causing a divide by two, or halving.
6.
Writes halfword result of the addition to the bottom halfword of the destination register.
Restrictions
Do not use SP and do not use PC.
Condition flags
These instructions do not affect the condition code flags.
Examples
UHASX
R7, R4, R2
; Adds top halfword of R4 with bottom halfword of R2
; and writes halved result to top halfword of R7
; Subtracts top halfword of R2 from bottom halfword of
; R7 and writes halved result to bottom halfword of R7
The STM32 Cortex-M4 instruction set
Conditional execution on page
PM0214 Rev 9
65).
103/262
261

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the STM32H7 Series and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

Table of Contents

Save PDF