COMP3221 lec04--prog-model.1 Saeid Nooshabadi COMP 3221 Microprocessors and Embedded Systems Lecture 4: Programmer’s Model of Microprocessors

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)
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.
State Machines Used to Design Sequential Circuits.
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:
The von Neumann Model – Chapter 4 COMP 2620 Dr. James Money COMP
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.
Chapter 4 The Von Neumann Model
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.
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.
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Control Unit.
1 TM 1 Embedded Systems Lab./Honam University ARM Microprocessor Programming Model.
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.
Lecture 5: Computer systems architecture
COMPUTER ORGANIZATION & ASSEMBLY LANGUAGE
March 2006 Saeid Nooshabadi
Introduction of microprocessor
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
T Computer Architecture, Autumn 2005
The Von Neumann Model Basic components Instruction processing
Today’s agenda Hardware architecture and runtime system
CS/COE0447 Computer Organization & Assembly Language
Introduction to Microprocessor Programming
Computer Operation 6/22/2019.
Chapter 4 The Von Neumann Model
Presentation transcript:

COMP3221 lec04--prog-model.1 Saeid Nooshabadi COMP 3221 Microprocessors and Embedded Systems Lecture 4: Programmer’s Model of Microprocessors March, 2004 Modified from Slides by Saeid Nooshabadi

COMP3221 lec04--prog-model.2 Saeid Nooshabadi 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

COMP3221 lec04--prog-model.3 Saeid Nooshabadi 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 COMP 3221

COMP3221 lec04--prog-model.4 Saeid Nooshabadi 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

COMP3221 lec04--prog-model.5 Saeid Nooshabadi Review: 5 Classic Components of a Computer Control Datapath Memory Processor Input Output Control Datapath Memory Processor Input Output Network/Bus ALU Registers

COMP3221 lec04--prog-model.6 Saeid Nooshabadi 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

COMP3221 lec04--prog-model.7 Saeid Nooshabadi 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

COMP3221 lec04--prog-model.8 Saeid Nooshabadi 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 ALURegisters

COMP3221 lec04--prog-model.9 Saeid Nooshabadi 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

COMP3221 lec04--prog-model.10 Saeid Nooshabadi 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)

COMP3221 lec04--prog-model.11 Saeid Nooshabadi 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

COMP3221 lec04--prog-model.12 Saeid Nooshabadi 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

COMP3221 lec04--prog-model.13 Saeid Nooshabadi 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

COMP3221 lec04--prog-model.14 Saeid Nooshabadi 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

COMP3221 lec04--prog-model.15 Saeid Nooshabadi 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

COMP3221 lec04--prog-model.16 Saeid Nooshabadi 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

COMP3221 lec04--prog-model.17 Saeid Nooshabadi 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

COMP3221 lec04--prog-model.18 Saeid Nooshabadi 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!

COMP3221 lec04--prog-model.19 Saeid Nooshabadi 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

COMP3221 lec04--prog-model.20 Saeid Nooshabadi 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

COMP3221 lec04--prog-model.21 Saeid Nooshabadi 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