ARM Instruction Set(Part 2): Types,Operands and Addressing Modes


Types,Operands and  Addressing Modes


After a brief introduction of ISA, here in this part of the series we'll look at:

Content:


 

  • Types of Operands 

  • Instruction set design

  • Types of Instructions

  • Types of Addressing modes







Types of Operands:


Operands basically refer to the type of parameter which is passed on to, along with an instruction. It might be a :


  • Register/Memory address

  • Constant/Immediate


Consider the following examples:

ADD r1,r2,r3;      will add r2 and r3 and store it's value in r1

Here, Operands is r1,r2 and r3. ALL of which are registers.
ARM has in general 16 general purpose registers out of which last register is Program counter, second last is stack pointer and third last is link register.

ADD r1,r2,#3;      will add the value in register r2 and 3 and store it's value in r1

Here, one of the operand is '3' which is a constant. This comes under immediate operands.

Some of the instructions even don't have any operand, such type of instructions are generally found in accumulator type ISA, where accumulator(AC) is implicit.

Data Types


There are particularly two data types namely Signed and Unsigned. Signed numbers contains both positive and negative numbers while Unsigned number contains only positive numbers. For example:


ldrsh - will load(ld) signed(s) half-word(h)

ldrb - will load(ld) a byte(b)



str - will store a word

Instruction set design:


ARM usually implements these three types of Instruction set designs:

  • ARM Instruction set: 32 bit instruction set with 3 address format. For example: ADD R1,R2,#6.

  • Thumb Instruction set: 16 bit instruction set with 2 address format. For example: ADD R1,#1.

  • Jazelle Instruction Set: 8 bit instruction set usually for hardware implementation of Java Byte code.



Types of Instructions:


ARM supports a wide variety of instructions. Main criteria of difference between all of these is the structure of these instructions, in ARM all these instructions are of same length,usually 32 bits.

Also, apart from these ARM supports 16 bit condensed instructions called Thumb instructions, but that's another wide topic we might include in next section.


  1. Data processing instruction

  2. Data transfer instruction / Load-store instructions

  3. Branch instruction

  4. Software interrupt instruction


Apart from these, there are other less frequently used misc. instructions also.

Data Processing Instructions 


These instructions are used for data manipulation such as adding, subtracting, multiply, logical shifts, comparing  etc.











An excerpt from ARM reference manual here

Load/Store Instructions


These instructions are used to access memory. For example: LDR, STR, PLD etc.



 









An excerpt from ARM reference manual here

Branch Instructions


Branch instructions are used to jump program execution from one program segment to another. Usually used during Procedure call, goto etc;


Software interrupt instruction


Used for enabling software interrupts. For ex:- SWI


 




Now, After having some background knowledge of ARM instruction set, let's get our hands dirty with TIVA C series TM4C123GPM ,ARM Cortex M4.





Comments

Popular posts from this blog

Understanding SD, SDIO and MMC Interface

Software licensing : Introduction and it's types

Implementing a MMC/SD/SDIO stack using CAM framework(Part 2)