ECE 353 Introduction to Microprocessor Systems Michael G. Morrow, P.E. Week 5.

Slides:



Advertisements
Similar presentations
Embedded System Design Center Sai Kumar Devulapalli ARM7TDMI Microprocessor Load and store instruction.
Advertisements

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
Apr. 12, 2000Systems Architecture I1 Systems Architecture I (CS ) Lecture 6: Branching and Procedures in MIPS* Jeremy R. Johnson Wed. Apr. 12, 2000.
ECE 353 Introduction to Microprocessor Systems Michael G. Morrow, P.E. Week 6.
EET 2261 Unit 5 Tables; Decision Trees & Logic Instructions
TK 2633 Microprocessor & Interfacing
COMP3221: Microprocessors and Embedded Systems--Lecture 8 1 COMP3221: Microprocessors and Embedded Systems Lecture 8: Program Control Instructions
TK 2633 Microprocessor & Interfacing Lecture 3: Introduction to 8085 Assembly Language Programming (2) 1 Prepared By: Associate Prof. Dr Masri Ayob.
EECC250 - Shaaban #1 Lec # 5 Winter Stacks A stack is a First In Last Out (FILO) buffer containing a number of data items usually implemented.
Room: E-3-31 Phone: Dr Masri Ayob TK 2633 Microprocessor & Interfacing Lecture 1: Introduction to 8085 Assembly Language.
Room: E-3-31 Phone: Dr Masri Ayob TK 2633 Microprocessor & Interfacing Lecture 1: Introduction to 8085 Assembly Language.
COMPUTER ARCHITECTURE & OPERATIONS I Instructor: Hao Ji.
ARM Core Architecture. Common ARM Cortex Core In the case of ARM-based microcontrollers a company named ARM Holdings designs the core and licenses it.
Embedded System Design Center Sai Kumar Devulapalli ARM7TDMI Microprocessor Thumb Instruction Set.
Module 10 Adapted By and Prepared James Tan © 2001.
Subroutines and Stacks 1. Subroutines Separate, independent module of program, performs a specific task shortens code, provide reusable “tools” High-level.
Lecture 4: Advanced Instructions, Control, and Branching cont. EEN 312: Processors: Hardware, Software, and Interfacing Department of Electrical and Computer.
Computer Architecture Lecture 13 – part 2 by Engineer A. Lecturer Aymen Hasan AlAwady 7/4/2014 University of Kufa - Information Technology Research and.
ECE 353 Introduction to Microprocessor Systems Michael G. Morrow, P.E. Week 5.
ECE 265 – LECTURE 8 The M68HC11 Basic Instruction Set The remaining instructions 10/20/ ECE265.
Execution of an instruction
Lecture 8: Control, Procedures, and the Stack CS 2011 Fall 2014, Dr. Rozier.
Today’s Lecture Unconditional branch instruction
Lecture Set 4 Programming the 8051.
ECE 353 Introduction to Microprocessor Systems Michael G. Morrow, P.E. Week 6.
Addressing Modes MTT CPU08 Core Motorola CPU08 ADDRESSING MODES.
1 ECE 372 – Microcontroller Design Assembly Programming HCS12 Assembly Programming Addressing Modes Stack Operations Subroutines.
ECE 353 Introduction to Microprocessor Systems Michael G. Morrow, P.E. Week 7.
Chapter 2 — Instructions: Language of the Computer — 1 Conditional Operations Branch to a labeled instruction if a condition is true – Otherwise, continue.
8086/8088 Instruction Set, Machine Codes and Addressing Modes.
ECE 447: Lecture 11 Introduction to Programming in Assembly Language.
Arrays in MIPS Assembly Computer Organization and Assembly Language: Module 6.
Lecture 6: Branching CS 2011 Fall 2014, Dr. Rozier.
PHY 201 (Blum)1 Stacks Based in part on material from Chapters 4 & 5 in Computer Architecture by Nicholas Carter.
Lecture 8: Loading and Storing to Memory CS 2011 Fall 2014, Dr. Rozier.
Lec. 10 Assembly Programming Dr. Tamer Samy Gaafar Microprocessors.
©2000 Addison Wesley Little- and big-endian memory organizations.
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.
Instruction Set Architectures Continued. Expanding Opcodes & Instructions.
1 Contents: 3.1 Instruction format and Addressing Modes 3.2 Instruction Introduction Chapter 3 Instruction system.
Computer Architecture & Operations I
Instruction sets : Addressing modes and Formats
Addressing Modes in Microprocessors
ECE 3430 – Intro to Microcomputer Systems
Assembly Language Programming of 8085
Microprocessor T. Y. B. Sc..
The Stack.
Introduction to the ARM Instruction Set
Lab 3 - Branching & Subroutines
16.317: Microprocessor System Design I
Microprocessor and Assembly Language
ECE 353 Introduction to Microprocessor Systems
8051 Addressing Modes The way, using which the data source or destination addresses are specified in the instruction mnemonic for moving the data, is.
William Stallings Computer Organization and Architecture 8th Edition
CS 301 Fall 2002 Control Structures
MIPS Instructions.
The University of Adelaide, School of Computer Science
Instruction Set Architectures Continued
ARM Load/Store Instructions
EE6502/MPMC/UNIT II/STACK AND SUBROUTINE/T.THARANKUMAR
ECE 3430 – Intro to Microcomputer Systems
Thumb accessible registers
COMP3221: Microprocessors and Embedded Systems
Some Assembly (Part 2) set.html.
Multiply Instructions
ME 4447/6405 Microprocessor Control of Manufacturing Systems and
ECE511: Digital System & Microprocessor
An Introduction to the ARM CORTEX M0+ Instructions
Presentation transcript:

ECE 353 Introduction to Microprocessor Systems Michael G. Morrow, P.E. Week 5

ARM7TDMI Programming LUTs Branches and Loops Structured Programming Flowcharts Stacks Hardware versus Memory Stacks ARM7TDMI Stack Management Topics

Look-Up Tables In an embedded system, the code area is usually in nonvolatile memory (ROM) Data in the code area will also be placed in ROM – so the data is constant Look-up tables (LUTs) are used to translate a value from one domain to another when… There is no convenient mathematical relationship between the two domains The calculations are too expensive for the application constraints

LUT Examples Exercises: Write code fragments that… 1. Use a lookup table to get a 32-bit mask that will be used to clear individual bytes as directed by a 4-bit value (i.e. 2_1001 means that we want to clear the middle two bytes and preserve the most/least significant bytes) 2. Use a lookup table to get the square root of an unsigned half-word value  Disassembly fragment In both cases,  Assume that the value to convert is in R0, result in R1  Use addressing modes efficiently  Identify how large the complete data table will be

Branches Branches redirect program flow by loading a new PC value In many processors, a branch that does not return is called a jump ARM7TDMI branch instructions B target_address B target_address  Target_address is a label  Instruction encodes a signed 24-bit offset BX  Branch address is in a register  Can be used to jump to Thumb code Jump tables Be sure index is bounds-checked!

Conditional Branches and Looping Conditional branches allow program flow to change in response to conditions Action is based on current state of flags Prior instruction must be used to set flags Can use backwards conditional jumps to create a loop that can be terminated - By a condition After a predetermined number of iterations Or a combination of both Looping examples Incrementing loops Decrementing loops

Implementing Structured Programming Constructs Structured programming basics One entry point, one exit point per subroutine Based on three basic control structures  Sequence  Selection If, If/Else, Switch/Case  Repetition While Do-While Flowchart Basics Programming Exercise

Stack Implementation The stack is a LIFO data structure What is the stack used for? Two basic stack operations PUSH POP (aka PULL) Hardware stacks vs. memory stacks Hardware stack Memory stack  Stack pointer (SP)  Stack topologies and SP operation

ARM7TDMI Stack Operation By convention, the stack pointer is R13 ARM stack terminology Empty versus full Ascending versus descending Allocating stack space SP initialization Stack operations LDR/STR LDM/STM PUSH/POP ARM operating modes and stacks

Wrapping Up Homework #3 is due Wednesday, 3/7 Quiz #1 will be held Thursday, 3/1 at 7:15pm in room 2255EH Coverage will be over modules 1 and 2. Calculators are not permitted. You may have a single 3x5 card with handwritten notes. The instruction set documentation will be provided. If you have a conflict, please send me the details by .

PIC16F84 Hardware Stack

Jump Tables start MOVR0, ???; assume index is in R0 ADRR1, jmptbl; get base address LDRR0, [R1,R0,LSL #2] ; do look-up BXR0; branch to target ; task0 ; stub NOP Bstart ; task1 ; stub NOP Bstart ; jmptbl DCDtask0, task1;...

B Instruction Reference Syntax B{ } RTL if (cond is true)  PC  PC + offset Flags are not affected cond1010signed_immediate_24

BL Instruction Reference Syntax BL{ } RTL if (cond is true)  R14  next instruction address  PC  PC + offset Flags are not affected cond1011signed_immediate_24

BX Instruction Reference Syntax BX{ } RTL if (cond is true)  T flag  Rm[0]  PC  Rm & 0xFFFFFFFE Flags are not affected In ARM v5 and higher, there is also a BLX instruction cond SBO 0001Rm