Branch instructions Branch : B{<cond>} label

Slides:



Advertisements
Similar presentations
ARM versions ARM architecture has been extended over several versions.
Advertisements

Embedded Systems Programming
Appendix D The ARM Processor
Overheads for Computers as Components 2nd ed.
THUMB Instructions: Branching and Data Processing
Branches Two branch instructions:
1 ARM Movement Instructions u MOV Rd, ; updates N, Z, C Rd = u MVN Rd, ; Rd = 0xF..F EOR.
© 2000 Morgan Kaufman Overheads for Computers as Components ARM instruction set zARM versions. zARM assembly language. zARM programming model. zARM memory.
Chapter 2 Instruction Sets 金仲達教授 清華大學資訊工程學系 (Slides are taken from the textbook slides)
ECE 232 L6.Assemb.1 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers ECE 232 Hardware Organization and Design Lecture 6 MIPS Assembly.
The University of Adelaide, School of Computer Science
ECE 353 Introduction to Microprocessor Systems Michael G. Morrow, P.E. Week 6.
F28PL1 Programming Languages Lecture 5: Assembly Language 4.
Lecture 5: Decision and Control CS 2011 Fall 2014, Dr. Rozier.
Memory - Registers Instruction Sets
Topics covered: ARM Instruction Set Architecture CSE 243: Introduction to Computer Architecture and Hardware/Software Interface.
ARM 7 Datapath. Has “BIGEND” input bit, which defines whether the memory is big or little endian Modes: ARM7 supports six modes of operation: (1) User.
ARM Instructions I Prof. Taeweon Suh Computer Science Education Korea University.
Embedded System Design Center Sai Kumar Devulapalli ARM7TDMI Microprocessor Thumb Instruction Set.
Lecture 4: Advanced Instructions, Control, and Branching cont. EEN 312: Processors: Hardware, Software, and Interfacing Department of Electrical and Computer.
ECS642U Embedded Systems ARM CPU and Assembly Code William Marsh.
Lecture 2: Advanced Instructions, Control, and Branching EEN 312: Processors: Hardware, Software, and Interfacing Department of Electrical and Computer.
Lecture 6: Branching CS 2011 Fall 2014, Dr. Rozier.
The Stack. ARMSim memory space: 0x Unused 0x x11400 Stack 0x x09400 Heap 0x?????-0x01400 Data 0x x????? Text 0x x01000.
Ch 5. ARM Instruction Set  Data Type: ARM processors supports six data types  8-bit signed and unsigned bytes  16-bit signed and unsigned half-words.
Lecture 6: Decision and Control CS 2011 Spring 2016, Dr. Rozier.
Writing Functions in Assembly
Addressing Modes in Microprocessors
MIPS Instruction Set Advantages
Example Addiu $t1 $r0 3 Addiu $t1 $t1 5 Addiu $t1 $t1 7.
Chapter 15: Higher Level Constructs
ECE 3430 – Intro to Microcomputer Systems
Introduction to the ARM Instruction Set
The University of Adelaide, School of Computer Science
ARM Registers Register – internal CPU hardware device that stores binary data; can be accessed much more rapidly than a location in RAM ARM has.
EE 319K Introduction to Embedded Systems
The Stack.
Lab 3 - Branching & Subroutines
Chapter 4 Addressing modes
RISC Concepts, MIPS ISA Logic Design Tutorial 8.
Writing Functions in Assembly
CS 301 Fall 2002 Control Structures
CS/COE0447 Computer Organization & Assembly Language
ARM Assembly Programming
CS/COE0447 Computer Organization & Assembly Language
Passing by-value vs. by-reference in ARM
Stack Frame Linkage.
ECE232: Hardware Organization and Design
Fields in the FALCON-A Instruction
Figure 4- 1: Flowchart for Example 4-3
Introduction to Micro Controllers & Embedded System Design
CNET 315 Microprocessor & Assembly Language
Flow of Control -- Conditional branch instructions
Lecture 06 Programming language.
The branch instruction
Overheads for Computers as Components 2nd ed.
MIPS Instruction Set Architecture
Subroutines and the Stack
THUMB INSTRUCTION SET.
COMP3221: Microprocessors and Embedded Systems
Computer Architecture
Multiply Instructions
CS501 Advanced Computer Architecture
Figure 3-1. Flowchart for the DECFSZ Instruction
COMS 361 Computer Organization
Lecture 1: SIC Architecture
An Introduction to the ARM CORTEX M0+ Instructions
CS/COE0447 Computer Organization & Assembly Language
Presentation transcript:

Branch instructions Branch : B{<cond>} label Branch with Link : BL{<cond>} subroutine_label The branch offset must take account of the prefetch operation, which causes the PC to be 2 words (8 bytes) ahead of the current instruction The processor core shifts the offset field left by 2 positions, sign-extends it and adds it to the PC ± 32 Mbyte range How to perform longer branches?

ARM Branches and Subroutines B <label> PC relative. ±32 Mbyte range. BL <subroutine> Stores return address in LR Returning implemented by restoring the PC from LR For non-leaf functions, LR will have to be stacked

ARM subroutine linkage Branch and link instruction: BL foo Copies current PC to r14. To return from subroutine: MOV r15,r14

ARM ADR pseudo-op Cannot refer to an address directly in an instruction. Generate value by performing arithmetic on PC. ADR pseudo-op generates instruction required to calculate address: ADR r1,FOO

Contd…

How ADR works?

Example: C assignments x = (a + b) - c; y = a*(b+c); z = (a << 2) | (b & 15); if (a > b) { x = 5; y = c + d; } else x = c - d; Assembler: ???