Module-5
Module-5
instruction set
MODULE: 5
2TE
12/6/2023 6:56 AM
3TE
12/6/2023 6:56 AM
Introduction
Thumb encodes a subset of the 32-bit ARM instructions into a 16-bit
instruction set space.
Since Thumb has higher performance than ARM on a processor with a
16-bit data bus, but lower performance than ARM on a 32-bit data bus,
use Thumb for memory-constrained systems.
4TE
12/6/2023 6:56 AM
Introduction
Thumb has higher code density—the space taken up in memory by an
executable program—than ARM.
For memory-constrained embedded systems, for example, mobile phones
and PDAs, code density is very important.
Cost pressures also limit memory size, width, and speed.
5TE
12/6/2023 6:56 AM
Introduction
On average, a Thumb implementation of the same code takes up
around 30% less memory than the equivalent ARM implementation.
6TE
12/6/2023 6:56 AM
ARM-Thumb Interworking
ARM-Thumb interworking is the name given to the method of linking
ARM and Thumb code together for both assembly and C/C++.
It handles the transition between the two states.
Extra code, called a veneer, is sometimes needed to carry out the
transition.
ATPCS defines the ARM and Thumb procedure call standards.
8TE
12/6/2023 6:56 AM
ARM-Thumb Interworking
Syntax: BX Rm
BLX Rm | label
9TE
12/6/2023 6:56 AM
Stack Instructions
The Thumb stack operations are different from the equivalent ARM
instructions because they use the more traditional POP and PUSH
concept.
5TE
12/6/2023 6:56 AM
• Three instructions have been removed from the inside loop, saving
three cycles per loop compared to checksum_v3.
Function Argument Types
Below example shows how the compiler treats a loop with incrementing count, i++
and the compiler output for the same.
Data packet checksum routine:
Compiler Output:
Continu
ed...
Data packet checksum routine:Compiler Output:
• The SUBS and BNE instructions implement the loop. Our checksum
example now has the minimum number of four instructions per loop.
This is much better than six for checksum_v1 and eight for
Loops using a variable number of
iterations: