Memory Organization in ARM7: Von Neumann Architecture Harvard Architecture
Memory Organization in ARM7: Von Neumann Architecture Harvard Architecture
• The ARM7 processor uses a 32-bit address bus, which allows access to a 4GB addressable memory space.
• Memory regions within this address space can be allocated for different types of storage (RAM, ROM, Flash)
or peripherals.
• ARM7 supports both von Neumann architecture and Harvard architecture.
CMP <Rn>, <operand2> : (Rn - operand2) and sets the flags based on the
result
LDR R0, [R1] ; Load the value from the memory address stored in R1
into R0
STR R2, [R3] ; Stores the value found in R2 to the memory address
found in R3.
Register Indirect with Offset addressing mode in ARM is an extension of register indirect
addressing. In this mode, the effective memory address is calculated by adding or subtracting an
immediate value (offset) or the value of another register to/from the base register.
LDR R0, [R1, #4] ; Load the value from the memory address (R1 + 4) into R0
STR R2, [R3, #-8] ; Store the value in R2 into the memory address (R3 - 8)
Auto-indexing in ARM refers to an addressing mode where the address used for loading or
storing data is automatically updated after the operation, without requiring extra instructions
Pre-indexing:
LDR R1, [R2, #4]! : Here, R2 is first incremented by 4, then the value from the memory address
is loaded into R1.
Post-indexing:
LDR R1, [R2], #4 Here, the value at the memory address pointed to by R2 is first loaded into R1,
and then R2 is incremented by 4 after the operation.
****Try for STR also
DR instruction can load data in different sizes: word, half-word, or byte.
(Word): This loads a 32-bit word (4 bytes).
LDR R1, [R2, #4]!: Loads a full 32-bit word from the memory address [R2 + 4] into R1.
SH (Signed Half-Word): This loads a signed 16-bit half-word and extends it to 32 bits.
LDRSH R1, [R2, #4]!: Loads a signed 16-bit half-word from [R2 + 4] and sign-extends it to 32 bits in R1
LDMIB R0, {R1, R2, R3}: Stands for Load Multiple Increment
Before.
• R0 is incremented by 4 before each load.
• The value at the memory address R0 + 4 is loaded into R1.
• The value at the memory address R0 + 8 is loaded into R2.
• The value at the memory address R0 + 12 is loaded into
LDMIB
R3. R0!, {R1, R2, R3}
• The ! after R0 means that the updated value of R0 will be written back to the
register after the instruction finishes.
• After the instruction is executed, R0 will hold the address R0 + 12
Control flow instructions
Control flow instructions in ARM assembly are used to change the flow of execution in a
program, typically by branching or jumping to different parts of the code based on certain
conditions.
Instructions:
B (Branch): Unconditional branch to a target address or label.
BL (Branch with Link): Branches to a subroutine, saving the return address in the LR
(Link Register).
Conditional branches: