1 TM 1 Embedded Systems Lab./Honam University ARM Microprocessor Programming Model.

Slides:



Advertisements
Similar presentations
Chapter 2: Data Manipulation
Advertisements

Chapter 1. Basic Structure of Computers
COMP3221 lec23-decode.1 Saeid Nooshabadi COMP 3221 Microprocessors and Embedded Systems Lectures 23: Instruction Representation; Assembly and Decoding.
COMP3221 lec05-numbers-I.1 Saeid Nooshabadi COMP 3221 Microprocessors and Embedded Systems Lecture 5: Number Systems – I
Elec2041 lec-11-mem-I.1 Saeid Nooshabadi COMP 3221 Microprocessors and Embedded Systems Lecture 11: Memory Access - I
Midterm Wednesday Chapter 1-3: Number /character representation and conversion Number arithmetic Combinational logic elements and design (DeMorgan’s Law)
CSCE 121, Sec 200, 507, 508 Fall 2010 Prof. Jennifer L. Welch.
COMP3221 lec04--prog-model.1 Saeid Nooshabadi COMP 3221 Microprocessors and Embedded Systems Lecture 4: Programmer’s Model of Microprocessors
Stored Program Concept: The Hardware View
ECE 232 L2 Basics.1 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers ECE 232 Hardware Organization and Design Lecture 2 Computer.
CPEN Digital System Design Chapter 10 – Instruction SET Architecture (ISA) © Logic and Computer Design Fundamentals, 4 rd Ed., Mano Prentice Hall.
Overview The von Neumann Machine - the programmable digital computer Introducing the LC-3 Computer - A “toy” computer for us to learn from Computer machine.
CS / Schlesinger Lec1.1 1/20/99©UCB Spring 1999 Computer Architecture Lecture 1 Introduction and Five Components of a Computer Spring, 1999 Arie Schlesinger.
Computer ArchitectureFall 2007 © Sep 10 th, 2007 Majd F. Sakr CS-447– Computer Architecture.
Overview von Neumann Model Components of a Computer Some Computer Organization Models The Computer Bus An Example Organization: The LC-3.
Group 5 Alain J. Percial Paula A. Ortiz Francis X. Ruiz.
COM181 Computer Hardware Ian McCrumRoom 5B18,
CENG311 Computer Architecture Kayhan Erciyes. CS231 Assembly language and Digital Circuits Instructor:Kayhan Erciyes Office:
1 CS/COE0447 Computer Organization & Assembly Language Pre-Chapter 2.
An Introduction Chapter Chapter 1 Introduction2 Computer Systems  Programmable machines  Hardware + Software (program) HardwareProgram.
Cs 152 L1 Intro.1 Patterson Fall 97 ©UCB What is “Computer Architecture” Computer Architecture = Instruction Set Architecture + Machine Organization.
Instruction Set Architecture
COMP2011 Assembly Language Programming and Introduction to WRAMP.
Computer Systems Organization CS 1428 Foundations of Computer Science.
COMP3221 lec04--prog-model.1 Saeid Nooshabadi COMP 3221 Microprocessors and Embedded Systems Lecture 4: Programmer’s Model of Microprocessors
Introduction to Computing Systems from bits & gates to C & beyond The Von Neumann Model Basic components Instruction processing.
Computer Organization and Design Computer Abstractions and Technology
Computer Architecture Mehran Rezaei
CSCI 211 Intro Computer Organization –Consists of gates for logic And Or Not –Processor –Memory –I/O interface.
Computer Architecture And Organization UNIT-II General System Architecture.
Computer Architecture CPSC 350
1 Computer Architecture Part II-B: CPU Instruction Set.
Computer Architecture Memory, Math and Logic. Basic Building Blocks Seen: – Memory – Logic & Math.
1 Text Reference: Warford. 2 Computer Architecture: The design of those aspects of a computer which are visible to the programmer. Architecture Organization.
A summary of TOY. 4 Main Components Data Processor Control Processor Memory Input/Output Device.
Computer Hardware A computer is made of internal components Central Processor Unit Internal External and external components.
Computer Organization Instructors Course By: Lecturer: Shimaa Ibrahim Hassan TA: Eng: Moufeda Hussien Lecture: 9:45 Address:
1 chapter 1 Computer Architecture and Design ECE4480/5480 Computer Architecture and Design Department of Electrical and Computer Engineering University.
Sahar Mosleh California State University San MarcosPage 1 Assembly language and Digital Circuit By Sahar Mosleh California State University San Marcos.
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Control Unit.
DR. SIMING LIU SPRING 2016 COMPUTER SCIENCE AND ENGINEERING UNIVERSITY OF NEVADA, RENO CS 219 Computer Organization.
Question What technology differentiates the different stages a computer had gone through from generation 1 to present?
DR. SIMING LIU SPRING 2016 COMPUTER SCIENCE AND ENGINEERING UNIVERSITY OF NEVADA, RENO Session 2 Computer Organization.
Simple ALU How to perform this C language integer operation in the computer C=A+B; ? The arithmetic/logic unit (ALU) of a processor performs integer arithmetic.
Lecture 2: Instruction Set Architecture part 1 (Introduction) Mehran Rezaei.
Computer Organization Instructions Language of The Computer (MIPS) 2.
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Control Unit.
Computer Operation. Binary Codes CPU operates in binary codes Representation of values in binary codes Instructions to CPU in binary codes Addresses in.
1 CHAPTER 1 COMPUTER ABSTRACTIONS AND TECHNOLOGY Parts of these notes have been adapter from those of Prof. Professor Mike Schulte, Prof. D. Patterson,
Computer Organization and Architecture Lecture 1 : Introduction
Control Unit Lecture 6.
COMPUTER ORGANIZATION & ASSEMBLY LANGUAGE
March 2006 Saeid Nooshabadi
March 2006 Saeid Nooshabadi
Computer Architecture and Organization Miles Murdocca and Vincent Heuring Chapter 4 – The Instruction Set Architecture.
Computer Architecture
Chapter 4 The Von Neumann Model
Computer Architecture CSCE 350
The Processor and Machine Language
Chapter 4 The Von Neumann Model
CSCE Fall 2013 Prof. Jennifer L. Welch.
The Von Neumann Model Basic components Instruction processing
CS/COE0447 Computer Organization & Assembly Language
CSCE Fall 2012 Prof. Jennifer L. Welch.
Introduction to Microprocessor Programming
CPU Structure CPU must:
Computer Operation 6/22/2019.
Chapter 4 The Von Neumann Model
Presentation transcript:

1 TM 1 Embedded Systems Lab./Honam University ARM Microprocessor Programming Model

2 TM 2 Embedded Systems Lab./Honam University Overview Programmer’s Model of a Microprocessor Address Space Registers Instruction Set Fetch – Decode – Execute Cycle Programmer’s Model of ARM 7TDMI Translation of C to ASM

3 TM 3 Embedded Systems Lab./Honam University Review: What is Subject about? I/O systemProcessor Compiler Operating System (Windows XP) Application (Netscape) Digital Design Circuit Design Instruction Set Architecture Coordination of many levels of abstraction Datapath & Control transistors Memory Hardware Software Assembler

4 TM 4 Embedded Systems Lab./Honam University Review:Programming Levels of Representation High Level Language Program (e.g., C) Assembly Language Program (e.g. ARM) Machine Language Program (ARM) Control Signal Specification Compiler Assembler Machine Interpretation temp = v[k]; v[k] = v[k+1]; v[k+1] = temp; ldr r0, [r2, #0] ldr r1, [r2, #4] str r1, [r2, #0] str r0, [r2, #4] °°°° ALUOP[0:3] <= InstReg[9:11] & MASK COMP3221

5 TM 5 Embedded Systems Lab./Honam University Review: 5 Classic Components of a Computer Control Datapath Memory Processor Input Output Control Datapath Memory Processor Input Output Network/Bus ALU Registers

6 TM 6 Embedded Systems Lab./Honam University An Expanded View of the Memory Systems Control Datapath Hard disk (Virtual Memory) Processor Register Main Memory 2 nd Cache Cache Fastest Slowest Smallest Biggest Highest Lowest Speed: Size: Cost: Cache and Virtual memory are handled by hardware and Operating System Programmer sees only one memory and the registers

7 TM 7 Embedded Systems Lab./Honam University Registers Small and fast memory inside the processor Load data from memory (Hold Data) Store memory addresses (Hold Addresses) Hold computation Operands and Results Store back to memory There are other specialized registers as well which are not visible to the programmer 32-bit ALU Data: 32 bits Register file ARM has 16 Register: r0 - r15, (each 32 bits) From memory Selectors:4 bits In ARM r15 (pc) is the program counter. It points to the instructions in memory

8 TM 8 Embedded Systems Lab./Honam University Fetch Decode Execute Cycle Instruction Fetch Instruction Decode Operand Fetch Execute Result Store Next Instruction Obtain instruction from program storage Determine required actions Locate and obtain operand data Compute result value or status Deposit results in storage for later use Determine successor instruction Control Datapath Memory Processor Input Output ALU Registers

9 TM 9 Embedded Systems Lab./Honam University The Programmer’s Model of a Microcomputer Instruction Set: ldr r0, [r2, #0] add r2, r3, r4 Memory: ldr r0, [r2, #0] add r2, r3, r B AEF0 Memory mapped I/O input output Registers: r0 - r3, pc Programmer’s Model Addressing Modes: ldrr12, [r1,#0] mov r1, r3 How to access data in registers and memory? i.e. how to determine and specify the data address in registers and memory

10 TM 10 Embedded Systems Lab./Honam University Memory Address Space (ARM 7TDMI) E add r2, r3, r4 instruction 0x instruction0x E sub r2, r5, r6 0x E ldr r0, [r2] 0x instruction Data 20 hex = x C Addresses interpretations Binary Contents Same as variable value 2 30 = address space size in words 4 x 2 30 = address space size in bytes = 4GBytes A word (4 bytes in memory) Since 1980 almost every machine uses addresses to level of 8-bits (bytes)

11 TM 11 Embedded Systems Lab./Honam University 16 Visible Registers (ARM 7TDMI) In ARM pc is the program counter. It points to (contains the address of ) the instructions being fetched from memory. They will be covered later

12 TM 12 Embedded Systems Lab./Honam University Instruction Set (ARM 7TDMI) °Set of instruction that a processor can execute °Instruction Categories Data Processing or Computational (Logical and Arithmetic Load/Store (Memory Access: or transferring data between memory and registers) Control Flow (Jump and Branch) Floating Point -coprocessor Memory Management Special Registers

13 TM 13 Embedded Systems Lab./Honam University Data Processing Instructions °Data Processing Instructions: operate ONLY on registers store result ONLY on registers Category: Arithmetic, Logical, Data movement Examples: mov r1, r2 ; r1  r2 add r1, r2, r3; r1  r2 + r3 and r3, r3, r4; r3  r3 AND r4 Registers All covered in details later

14 TM 14 Embedded Systems Lab./Honam University Memory Access Instructions °Memory Access Instructions: Transfer data from a memory address to a register (load instructions) Transfer data from a register to a memory address (store instructions) Examples: ldr r1, [r2] ; r1  mem[r2] Address of memory location is in register r2 str r1, [r3] ; r1  mem[r3] Address of memory location is in register r3 All covered in details later

15 TM 15 Embedded Systems Lab./Honam University Control Flow Instructions °Control Flow Instruction: Generally next Instructions are fetched from Sequential addresses in Mem Some Instructions cause fetch of next instruction from non sequential addresses in Mem (Control flow or branch instructions) Examples: br there All covered in details later 0x x x E add r2, r3, r4 instruction E sub r2, r5, r6 E ldr r0, [r2] EA br 0x instruction 0x C 0x E add r2, r5, r5 instruction

16 TM 16 Embedded Systems Lab./Honam University What’s this stuff good for? GameBoy! Nidendo Executive GameBoy Power by ARM Processor Color LCD240 x 160 pixel ( colors) USD100 IEEE Spectrum Feb 2003

17 TM 17 Embedded Systems Lab./Honam University COMP 3221 Reading Materials Printed Laboratory booklets (Highly Recommended) Buy from the Bookshop for $10 (Available from Week #2 ) Available on-line as well Companion CD-ROM (Highly Recommended) Present your Lab booklet to CSE's store staff (in K17-B08) to be stamped and collect your CD.(Available from Week #2) All Software tools and user manuals used in the lab All relevant documentation relating to hardware development board used in the lab Copies of all relevant data sheets for the processor and other devices on the hardware development board used in the lab Copy of ARM Processor Reference Manual All the Laboratory Exercises documentations Many programming examples And LOT MORE… Available on-line as well

18 TM 18 Embedded Systems Lab./Honam University Laboratory Documentation Written Extensively They Server as: Lecture Notes Tutorials AND Practical exercise Careful Reading Enables you to: Understand the Subject material Do tutorial practice AND get practical experience DO TAKE THEM VERY SERIOUSLY!

19 TM 19 Embedded Systems Lab./Honam University Sample Assembly Program 0x80 0x84 0x88 0x8C 0x90 E3A02094 mov r2, #0x94 Instruction (Data proc.) Instruction (Data proc.) E3A05002 mov r5, #2 E ldr r0, [r2] 0x Instruction (Mem Access) Data 20 hex = Binary Contents E sub r0, r0, r5 E str r0, [r2] Instruction (Data proc) Instruction (Mem Access) 0x94 0x20 0x94 2 0x E C statement: k = k - 2 Location for variable k r2 0x94 r5 2 r2 r0 0x94 0x20 r0 r5 0x2 0x1E - r0 r2 r0 0x94 0x1E

20 TM 20 Embedded Systems Lab./Honam University Compilation How to turn notation programmers prefer into notation computer understands? Program to translate C statements into Assembly Language instructions; called a compiler Example: compile by hand this C code: a = b + c; d = a - e; Easy: add r1, r2, r3 sub r4, r5, r6 Big Idea: compiler translates notation from 1 level of abstraction to lower level

21 TM 21 Embedded Systems Lab./Honam University Conclusion ARM has bit registers Instructions are all 32 bits Instruction Categories Data Processing or Computational (Logical and Arithmetic Load/Store (Memory Access: or transferring data between memory and registers) Control Flow (Jump and Branch) Access to memory is only through ldr and str instructions

22 TM 22 Embedded Systems Lab./Honam University References