ECE251: Tuesday September 12
|
|
- Cuthbert Young
- 6 years ago
- Views:
Transcription
1 ECE251: Tuesday September 12 Finish Branch related instructions Stack Subroutines Note: Lab 3 is a 2 week lab, starting this week and covers the Stack and Subroutines. Labs: Lab #2 is due this week. Lab #3 this week and next. Note: Lab 3 has prework! Homework: #2 Due Thursday, 4:30 pm Mid-Term Exam: October 5 Review on October 3 Lecture #7 1
2 Comparison Instructions Instruction Operands Operation Flags CMP Rn, Op2 Compare N,Z,C,V CMN Rn, Op2 Compare Negative N,Z,C,V TEQ Rn, Op2 Test Equivalence N,Z,C TST Rn, Op2 Test N,Z,C The only effect of the comparisons is to update the N, Z, C and V flags. There is no destination register Rd. Operations are: - CMP operand1 - operand2, but result not written - CMN operand1 OR operand2, but result not written - TST operand1 AND operand2, but result not written - TEQ operand1 EXOR operand2, but result not written Examples: CMP r0, r1 ;Performs r0 - r1 and updates N,Z,C,V appropriately TST r2, #5 ;Performs r2 AND 5 and updates N,Z,C appropriately Lecture #7 2
3 Number Interpretation Which is greater? 0xFFFFFFFF or 0x If they represent signed numbers, the latter is greater. (1 > -1) If they represent unsigned numbers, the former is greater. (4billion+ > 1) Lecture #7 3
4 So What? It s software s responsibility to tell computer how to interpret data. Use signed vs unsigned branch instructions: MOVS r6, #0xFFFFFFFF MOVS r5, #0x CMP r5, r6 BLE Then_Clause... BLE: Branch if less than or equal, signed MOVS r6, #0xFFFFFFFF MOVS r5, #0x CMP r5, r6 BLS Then_Clause... BLS: Branch if lower or same, unsigned Lecture #7 4
5 If-then Statement If a<0 then a = -a x = x + 1 Implementation 1: ; r1 = a, r2 = x CMP r1, #0 ; Compare a with 0 BGE endif ; Go to endif if a 0 then RSB r1, r1, #0 ; a = - a endif ADD r2, r2, #1 ; x = x + 1 Lecture #7 5
6 Compound Boolean Expression x > 20 AND x < 25 x 20 OR x 25 x == 20 OR x == 25 NOT(x == 20 OR x == 25) What condition above does the program below test? What happens if condition is met (i.e. then )? Assembly Program ; r0 = x CMP r0, #20 ; compare x and 20 BLE then ; go to then if x 20 CMP r0, #25 ; compare x and 25 BLT endif ; go to endif if x < 25 then MOV r1, #1 ; a = 1 endif Lecture #7 6
7 If a=1 then b = 3 else b=4 If-then-else ; r1 = a, r2 = b CMP r1, #1 ; compare a and 1 BNE else ; go to else if a 1 then MOV r2, #3 ; b = 3 B endif ; go to endif else MOV r2, #4 ; b = 4 endif What are then, else and endif in the program above? Lecture #7 7
8 Big New Topic: The Stack Breaking large programming problems down into smaller subcomponents (subroutines) is an excellent practice. The stack is useful to store parameters passed between these subcomponents and temporary data used only by the subroutine. In addition, storage space is required for the return address of each (possibly nested) subroutine call. These storage requirements are even more obvious if a recursive algorithm is used (subroutine calls itself, like a factorial computation might be done). So, we need to allocate this temporary storage space as we go. This space is called a stack because the last stored data is the first accessed, like a stack of plates. Lecture #7 8
9 Stack A Last-In-First-Out (LIFO) data structure Allows easy access to the most recently added item(s) Also called the top of the stack Key operations: push (add item(s) to stack) pop (remove top item(s) from stack) Lecture #7 9
10 Stack Growth Convention: Ascending vs Descending Descending stack: Stack grows towards low memory address Ascending stack: Stack grows towards high memory address Lecture #7 10
11 Stack Growth Convention: Full vs Empty Full stack: SP points to the last item pushed onto the stack Empty stack: SP points to the next free space on the stack Lecture #7 11
12 ARM Cortex-M4 Stack: Full Descending Cortex-M4 uses full descending stack! Memory Address 0xFFFFFFFF Stack always operates on 32-bit data Stack base Stack Pointer (SP) = R13 Stack Pointer is Pre-decremented on PUSH Stack Pointer (SP) Stack top Post-incremented on POP This must be, given Full Descending definition PUSH stack grow downwards POP 0x Lecture #7 12
13 Stack Manipulation PUSH {Rd} ;n registers in list SP = SP-4*n descending stack [[SP]] = Rd full stack Push multiple registers PUSH {r6, r7, r8} Examples below are all equivalent. PUSH {r8, r7, r6} PUSH {r8} PUSH {r7} PUSH {r6} The order in which registers listed in the register list does not matter. When pushing multiple registers, these registers are automatically sorted by name and the lowest-numbered register is stored to the lowest memory address (stored last). Lecture #7 13
14 Stack Manipulation POP {Rd} Rd = [[SP]] SP = SP + 4*n Stack shrinks. So why +? Pop multiple registers Examples below are all equivalent. POP {r6, r7, r8} POP {r8, r7, r6} POP {r6} POP {r7} POP {r8} The order in which registers listed in the register list does not matter. When popping multiple registers, these registers are automatically sorted by name and the lowest-numbered register is loaded from the lowest memory address, (loaded first). Lecture #7 14
15 Stack Examples PUSH {r3, r1, r7, r2} POP {r3, r1, r7, r2} Lecture #7 15
16 Stack Examples PUSH {r3, r1, r7, r2} POP {r3, r1, r7, r2} Lecture #7 16
17 Stack Examples PUSH {r3, r1, r7, r2} POP {r3, r1, r7, r2} Lecture #7 17
18 Example: Swap R1 & R2 R1 0x R2 0x PUSH {R1} PUSH {R2} POP {R1} POP {R2} R13 (SP) 0x xxxxxxxx xxxxxxxx xxxxxxxx Address 0x x200001FC 0x200001F8 memory Lecture #7 18
19 Example: Swap R1 & R2 R1 0x R2 0x PC PUSH {R1} PUSH {R2} POP {R1} POP {R2} R13 (SP) 0x200001FC xxxxxxxx 0x xxxxxxxx Address 0x x200001FC 0x200001F8 memory Lecture #7 19
20 Example: Swap R1 & R2 R1 0x R2 0x PC PUSH {R1} PUSH {R2} POP {R1} POP {R2} R13 (SP) 0x200001F8 xxxxxxxx 0x x Address 0x x200001FC 0x200001F8 memory Lecture #7 20
21 Example: Swap R1 & R2 R1 0x R2 0x PC PUSH {R1} PUSH {R2} POP {R1} POP {R2} R13 (SP) 0x200001FC xxxxxxxx 0x xxxxxxxx Address 0x x200001FC 0x200001F8 memory Lecture #7 21
22 Example: Swap R1 & R2 R1 0x R2 0x PC PUSH {R1} PUSH {R2} POP {R1} POP {R2} R13 (SP) 0x xxxxxxxx xxxxxxxx xxxxxxxx Address 0x x200001FC 0x200001F8 Could you do this with one PUSH and One POP instruction? memory Lecture #7 22
23 Subroutine A subroutine, also called a function or a procedure, single-entry, single-exit Return to caller after it exits When a subroutine is called, the Link Register (LR), R14, holds the memory address of the next instruction to be executed after the subroutine exits (the instruction physically beyond the instruction that calls the subroutine). That is how it knows to get back to where it came from. Lecture #7 23
24 Subroutines Separate, independent module of program, performs a specific task shortens code modules (not necessarily total code) often provide reusable tools Good subroutine: independence: does not depend on other code, and calling code isn t affected by it (e.g. register values) registers: stores/restores key registers upon entrance/exit using PUSH and POP instructions as needed data and code independent: local variables, limited use of direct memory addressing, unless it accesses global (program-wide) data structures. Lecture #7 24
25 Link Register 32 bits Low Registers R0 R1 R2 R3 R4 R5 R6 R7 General Purpose Register Link Register (LR) holds the return address of the current subroutine call I.e. how to get back to where you were (the following instruction) when the subroutine was called R8 High Registers R9 R10 R11 32 bits xpsr R12 R13 (SP) R14 (LR) R13 (MSP) R13 (PSP) BASEPRI PRIMASK FAULTMASK Special Purpose Register R15 (PC) CONTROL Lecture #7 25
26 Call a Subroutine BL <Subroutine Name> to go to subroutine BX LR to return from subroutine Subroutine itself enclosed with PROC and ENDP Directives Caller Program MOV r4, # BL foo;call subroutine foo... ADD r4, r4, #1 ; r4 =? Subroutine/Callee foo PROC... MOV r4, #10 ; foo changes r4... BX LR ; return to caller ENDP Lecture #7 26
27 Preserve Runtime Environment using the Stack Subroutine must not change caller s r4 value Save it on the stack! Can this be idea be generalized? Yes! Caller Program MOV r4, # BL foo... ADD r4, r4, #1 ; r4 = 101, not 11 Subroutine/Callee foo PROC PUSH {r4} ; preserve r4... MOV r4, #10 ; foo changes r4... POP {r4} ; Recover r4 BX LR ENDP Lecture #7 27
28 Summary The Stack Subroutines Next Lecture: Subroutines and passing info Read Chapter 8 of text. Lab #3, starting this week is about Subroutines. Two week lab not a trivial lab Prework on this lab! 3 deliverables to TA Pre-read the entire lab to be better prepared Lecture #7 28
ECE251: Tuesday September 11
ECE251: Tuesday September 11 Finish Branch related instructions Stack Subroutines Note: Lab 3 is a 2 week lab, starting this week and covers the Stack and Subroutines. Labs: Lab #2 is due this week. Lab
More informationStacks and Subroutines
Chapters 8 Stacks and Subroutines Embedded Systems with ARM Cortext-M Updated: Tuesday, March 6, 2018 Basic Idea llarge programs are hard to handle lwe can break them to smaller programs lthey are called
More informationECE251: Thursday September 13
ECE251: Thursday September 13 Lab 9: Some Details Stack and Subroutines, continued--chapter 8 Stack Example SUBROUTINES More Details Initializing the Stack/Pointer Passing Parameters to Subroutines via
More informationECE251: Tuesday September 18
ECE251: Tuesday September 18 Subroutine Parameter Passing (Important) Allocating Memory in Subroutines (Important) Recursive Subroutines (Good to know) Debugging Hints Programming Hints Preview of I/O
More informationFlow Control In Assembly
Chapters 6 Flow Control In Assembly Embedded Systems with ARM Cortext-M Updated: Monday, February 19, 2018 Overview: Flow Control Basics of Flowcharting If-then-else While loop For loop 2 Flowcharting
More informationCprE 288 Introduction to Embedded Systems Course Review for Exam 3. Instructors: Dr. Phillip Jones
CprE 288 Introduction to Embedded Systems Course Review for Exam 3 Instructors: Dr. Phillip Jones 1 Announcements Exam 3: See course website for day/time. Exam 3 location: Our regular classroom Allowed
More informationECE251: Thursday September 27
ECE251: Thursday September 27 Exceptions: Interrupts and Resets Chapter in text and Lab #6. READ ALL this material! This will NOT be on the mid-term exam. Lab Practical Exam #1 Homework # due today at
More informationARM Cortex-M4 Architecture and Instruction Set 4: The Stack and subroutines
ARM Cortex-M4 Architecture and Instruction Set 4: The Stack and subroutines M J Brockway February 13, 2016 The Cortex-M4 Stack SP The subroutine stack is full, descending It grows downwards from higher
More informationCprE 288 Introduction to Embedded Systems ARM Assembly Programming: Translating C Control Statements and Function Calls
CprE 288 Introduction to Embedded Systems ARM Assembly Programming: Translating C Control Statements and Function Calls Instructors: Dr. Phillip Jones 1 Announcements Final Projects Projects: Mandatory
More informationSystems Architecture The Stack and Subroutines
Systems Architecture The Stack and Subroutines The Stack p. 1/9 The Subroutine Allow re-use of code Write (and debug) code once, use it many times A subroutine is called Subroutine will return on completion
More informationControl Flow. September 2, Indiana University. Geoffrey Brown, Bryce Himebaugh 2015 September 2, / 21
Control Flow Geoffrey Brown Bryce Himebaugh Indiana University September 2, 2016 Geoffrey Brown, Bryce Himebaugh 2015 September 2, 2016 1 / 21 Outline Condition Codes C Relational Operations C Logical
More informationARM Instruction Set Architecture. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University
ARM Instruction Set Architecture Jin-Soo Kim (jinsookim@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu Condition Field (1) Most ARM instructions can be conditionally
More informationARM Assembly Language. Programming
Outline: ARM Assembly Language the ARM instruction set writing simple programs examples Programming hands-on: writing simple ARM assembly programs 2005 PEVE IT Unit ARM System Design ARM assembly language
More informationControl Instructions. Computer Organization Architectures for Embedded Computing. Thursday, 26 September Summary
Control Instructions Computer Organization Architectures for Embedded Computing Thursday, 26 September 2013 Many slides adapted from: Computer Organization and Design, Patterson & Hennessy 4th Edition,
More informationControl Instructions
Control Instructions Tuesday 22 September 15 Many slides adapted from: and Design, Patterson & Hennessy 5th Edition, 2014, MK and from Prof. Mary Jane Irwin, PSU Summary Previous Class Instruction Set
More informationStack Frames. September 2, Indiana University. Geoffrey Brown, Bryce Himebaugh 2015 September 2, / 15
Stack Frames Geoffrey Brown Bryce Himebaugh Indiana University September 2, 2016 Geoffrey Brown, Bryce Himebaugh 2015 September 2, 2016 1 / 15 Outline Preserving Registers Saving and Restoring Registers
More informationECE 471 Embedded Systems Lecture 5
ECE 471 Embedded Systems Lecture 5 Vince Weaver http://www.eece.maine.edu/ vweaver vincent.weaver@maine.edu 17 September 2013 HW#1 is due Thursday Announcements For next class, at least skim book Chapter
More informationSubroutines and the Stack
3 31 Objectives: A subroutine is a reusable program module A main program can call or jump to the subroutine one or more times The stack is used in several ways when subroutines are called In this lab
More informationProcessor Status Register(PSR)
ARM Registers Register internal CPU hardware device that stores binary data; can be accessed much more rapidly than a location in RAM ARM has 13 general-purpose registers R0-R12 1 Stack Pointer (SP) R13
More informationIslamic University Gaza Engineering Faculty Department of Computer Engineering ECOM 2125: Assembly Language LAB. Lab # 7. Procedures and the Stack
Islamic University Gaza Engineering Faculty Department of Computer Engineering ECOM 2125: Assembly Language LAB Lab # 7 Procedures and the Stack April, 2014 1 Assembly Language LAB Runtime Stack and Stack
More informationEE251: Tuesday September 5
EE251: Tuesday September 5 Shift/Rotate Instructions Bitwise logic and Saturating Instructions A Few Math Programming Examples ARM Assembly Language and Assembler Assembly Process Assembly Structure Assembler
More informationNET3001. Advanced Assembly
NET3001 Advanced Assembly Arrays and Indexing supposed we have an array of 16 bytes at 0x0800.0100 write a program that determines if the array contains the byte '0x12' set r0=1 if the byte is found plan:
More informationARM Architecture and Instruction Set
AM Architecture and Instruction Set Ingo Sander ingo@imit.kth.se AM Microprocessor Core AM is a family of ISC architectures, which share the same design principles and a common instruction set AM does
More informationThe Stack. Lecture 15: The Stack. The Stack. Adding Elements. What is it? What is it used for?
Lecture 15: The Stack The Stack What is it? What is it used for? A special memory buffer (outside the CPU) used as a temporary holding area for addresses and data The stack is in the stack segment. The
More informationPractical 1 Review. ECE Rick
Practical 1 Review ECE 362 https://engineering.purdue.edu/ee362/ Rick Lab TA Survey We do a midterm review of lab TAs. Survey link is at the bottom of the "Lab Experiments" page. Complements? Criticism?
More informationEE319K Spring 2015 Exam 1 Page 1. Exam 1. Date: Feb 26, 2015
EE319K Spring 2015 Exam 1 Page 1 Exam 1 Date: Feb 26, 2015 UT EID: Printed Name: Last, First Your signature is your promise that you have not cheated and will not cheat on this exam, nor will you help
More informationIntroduction to C. Write a main() function that swaps the contents of two integer variables x and y.
Introduction to C Write a main() function that swaps the contents of two integer variables x and y. void main(void){ int a = 10; int b = 20; a = b; b = a; } 1 Introduction to C Write a main() function
More informationExam 1. Date: Oct 4, 2018
Exam 1 Date: Oct 4, 2018 UT EID: Professor: Valvano Printed Name: Last, First Your signature is your promise that you have not cheated and will not cheat on this exam, nor will you help others to cheat
More informationCSE Lecture In Class Example Handout
CSE 30321 Lecture 07-09 In Class Example Handout Part A: A Simple, MIPS-based Procedure: Swap Procedure Example: Let s write the MIPS code for the following statement (and function call): if (A[i] > A
More informationECE 372 Microcontroller Design Assembly Programming. ECE 372 Microcontroller Design Assembly Programming
Assembly Programming HCS12 Assembly Programming Basic Assembly Programming Top Assembly Instructions (Instruction You Should Know!) Assembly Programming Concepts Assembly Programming HCS12 Assembly Instructions
More informationAn Introduction to Assembly Programming with the ARM 32-bit Processor Family
An Introduction to Assembly Programming with the ARM 32-bit Processor Family G. Agosta Politecnico di Milano December 3, 2011 Contents 1 Introduction 1 1.1 Prerequisites............................. 2
More informationARM Cortex M3 Instruction Set Architecture. Gary J. Minden March 29, 2016
ARM Cortex M3 Instruction Set Architecture Gary J. Minden March 29, 2016 1 Calculator Exercise Calculate: X = (45 * 32 + 7) / (65 2 * 18) G. J. Minden 2014 2 Instruction Set Architecture (ISA) ISAs define
More informationSystems I. Machine-Level Programming V: Procedures
Systems I Machine-Level Programming V: Procedures Topics abstraction and implementation IA32 stack discipline Procedural Memory Usage void swap(int *xp, int *yp) int t0 = *xp; int t1 = *yp; *xp = t1; *yp
More information(2) Part a) Registers (e.g., R0, R1, themselves). other Registers do not exists at any address in the memory map
(14) Question 1. For each of the following components, decide where to place it within the memory map of the microcontroller. Multiple choice select: RAM, ROM, or other. Select other if the component is
More informationExam 1 Fun Times. EE319K Fall 2012 Exam 1A Modified Page 1. Date: October 5, Printed Name:
EE319K Fall 2012 Exam 1A Modified Page 1 Exam 1 Fun Times Date: October 5, 2012 Printed Name: Last, First Your signature is your promise that you have not cheated and will not cheat on this exam, nor will
More informationVE7104/INTRODUCTION TO EMBEDDED CONTROLLERS UNIT III ARM BASED MICROCONTROLLERS
VE7104/INTRODUCTION TO EMBEDDED CONTROLLERS UNIT III ARM BASED MICROCONTROLLERS Introduction to 32 bit Processors, ARM Architecture, ARM cortex M3, 32 bit ARM Instruction set, Thumb Instruction set, Exception
More informationExam 1. Date: February 23, 2016
Exam 1 Date: February 23, 2016 UT EID: Printed Name: Last, First Your signature is your promise that you have not cheated and will not cheat on this exam, nor will you help others to cheat on this exam:
More informationMIPS Programming. A basic rule is: try to be mechanical (that is, don't be "tricky") when you translate high-level code into assembler code.
MIPS Programming This is your crash course in assembler programming; you will teach yourself how to program in assembler for the MIPS processor. You will learn how to use the instruction set summary to
More informationAND SOLUTION FIRST INTERNAL TEST
Faculty: Dr. Bajarangbali P.E.S. Institute of Technology( Bangalore South Campus) Hosur Road, ( 1Km Before Electronic City), Bangalore 560100. Department of Electronics and Communication SCHEME AND SOLUTION
More informationCompiling Code, Procedures and Stacks
Compiling Code, Procedures and Stacks L03-1 RISC-V Recap Computational Instructions executed by ALU Register-Register: op dest, src1, src2 Register-Immediate: op dest, src1, const Control flow instructions
More informationChapter 2 Instructions Sets. Hsung-Pin Chang Department of Computer Science National ChungHsing University
Chapter 2 Instructions Sets Hsung-Pin Chang Department of Computer Science National ChungHsing University Outline Instruction Preliminaries ARM Processor SHARC Processor 2.1 Instructions Instructions sets
More informationBranch Instructions. R type: Cond
Branch Instructions Standard branch instructions, B and BL, change the PC based on the PCR. The next instruction s address is found by adding a 24-bit signed 2 s complement immediate value
More informationARM Assembly Programming
Introduction ARM Assembly Programming The ARM processor is very easy to program at the assembly level. (It is a RISC) We will learn ARM assembly programming at the user level and run it on a GBA emulator.
More informationEE319K Exam 1 Summer 2014 Page 1. Exam 1. Date: July 9, Printed Name:
EE319K Exam 1 Summer 2014 Page 1 Exam 1 Date: July 9, 2014 UT EID: Printed Name: Last, First Your signature is your promise that you have not cheated and will not cheat on this exam, nor will you help
More informationCSCI 402: Computer Architectures. Instructions: Language of the Computer (3) Fengguang Song Department of Computer & Information Science IUPUI.
CSCI 402: Computer Architectures Instructions: Language of the Computer (3) Fengguang Song Department of Computer & Information Science IUPUI Recall Big endian, little endian Memory alignment Unsigned
More informationECE 3610 MICROPROCESSING SYSTEMS
24.361 Lab. 4 31 ECE 3610 MICROPROCESSING SYSTEMS Laboratory 4 LAB 4: ASSEMBLER DIRECTIVES, THE STACK, SUBROUTINES, AND BUBBLE SORTING 1 INTRODUCTION This lab deals with the use of the stack and subroutines
More informationChapter 2. Computer Abstractions and Technology. Lesson 4: MIPS (cont )
Chapter 2 Computer Abstractions and Technology Lesson 4: MIPS (cont ) Logical Operations Instructions for bitwise manipulation Operation C Java MIPS Shift left >>> srl Bitwise
More informationCENG3420 Lecture 03 Review
CENG3420 Lecture 03 Review Bei Yu byu@cse.cuhk.edu.hk 2017 Spring 1 / 38 CISC vs. RISC Complex Instruction Set Computer (CISC) Lots of instructions of variable size, very memory optimal, typically less
More informationMIPS Functions and the Runtime Stack
MIPS Functions and the Runtime Stack COE 301 Computer Organization Prof. Muhamed Mudawar College of Computer Sciences and Engineering King Fahd University of Petroleum and Minerals Presentation Outline
More informationEE319K Fall 2013 Exam 1B Modified Page 1. Exam 1. Date: October 3, 2013
EE319K Fall 2013 Exam 1B Modified Page 1 Exam 1 Date: October 3, 2013 UT EID: Printed Name: Last, First Your signature is your promise that you have not cheated and will not cheat on this exam, nor will
More informationMNEMONIC OPERATION ADDRESS / OPERAND MODES FLAGS SET WITH S suffix ADC
ECE425 MNEMONIC TABLE MNEMONIC OPERATION ADDRESS / OPERAND MODES FLAGS SET WITH S suffix ADC Adds operands and Carry flag and places value in destination register ADD Adds operands and places value in
More informationSummer 2003 Lecture 14 07/02/03
Summer 2003 Lecture 14 07/02/03 LAB 6 Lab 6 involves interfacing to the IBM PC parallel port Use the material on wwwbeyondlogicorg for reference This lab requires the use of a Digilab board Everyone should
More informationSubroutines. int main() { int i, j; i = 5; j = celtokel(i); i = j; return 0;}
Subroutines Also called procedures or functions Example C code: int main() { int i, j; i = 5; j = celtokel(i); i = j; return 0;} // subroutine converts Celsius to kelvin int celtokel(int i) { return (i
More informationARM Cortex-M4 Programming Model Flow Control Instructions
ARM Cortex-M4 Programming Model Flow Control Instructions Textbook: Chapter 4, Section 4.9 (CMP, TEQ,TST) Chapter 6 ARM Cortex-M Users Manual, Chapter 3 1 CPU instruction types Data movement operations
More informationChapters 3. ARM Assembly. Embedded Systems with ARM Cortext-M. Updated: Wednesday, February 7, 2018
Chapters 3 ARM Assembly Embedded Systems with ARM Cortext-M Updated: Wednesday, February 7, 2018 Programming languages - Categories Interpreted based on the machine Less complex, not as efficient Efficient,
More informationARM Cortex-M4 Architecture and Instruction Set 2: General Data Processing Instructions
ARM Cortex-M4 Architecture and Instruction Set 2: General Data Processing Instructions M J Brockway January 31, 2016 Cortex-M4 Machine Instructions - simple example... main FUNCTION ; initialize registers
More informationARM Cortex-M4 Architecture and Instruction Set 3: Branching; Data definition and memory access instructions
ARM Cortex-M4 Architecture and Instruction Set 3: Branching; Data definition and memory access instructions M J Brockway February 17, 2016 Branching To do anything other than run a fixed sequence of instructions,
More informationECE 3210 Lab 4: Calculator
ECE 3210 Lab 4: Calculator Fall 2017 1 Objective In this lab, you will develop an complete assembly program that takes an user input, performs data operations, and produces the expected output. After finishing
More informationARM Architecture and Assembly Programming Intro
ARM Architecture and Assembly Programming Intro Instructors: Dr. Phillip Jones http://class.ece.iastate.edu/cpre288 1 Announcements HW9: Due Sunday 11/5 (midnight) Lab 9: object detection lab Give TAs
More informationBranch Addressing. Jump Addressing. Target Addressing Example. The University of Adelaide, School of Computer Science 28 September 2015
Branch Addressing Branch instructions specify Opcode, two registers, target address Most branch targets are near branch Forward or backward op rs rt constant or address 6 bits 5 bits 5 bits 16 bits PC-relative
More informationSupport for high-level languages
Outline: Support for high-level languages memory organization ARM data types conditional statements & loop structures the ARM Procedure Call Standard hands-on: writing & debugging C programs 2005 PEVE
More informationCS356: Discussion #6 Assembly Procedures and Arrays. Marco Paolieri
CS356: Discussion #6 Assembly Procedures and Arrays Marco Paolieri (paolieri@usc.edu) Procedures Functions are a key abstraction in software They break down a problem into subproblems. Reusable functionality:
More informationCourse Administration
Fall 2018 EE 3613: Computer Organization Chapter 2: Instruction Set Architecture Introduction 4/4 Avinash Karanth Department of Electrical Engineering & Computer Science Ohio University, Athens, Ohio 45701
More informationChapter 2A Instructions: Language of the Computer
Chapter 2A Instructions: Language of the Computer Copyright 2009 Elsevier, Inc. All rights reserved. Instruction Set The repertoire of instructions of a computer Different computers have different instruction
More informationECE 498 Linux Assembly Language Lecture 5
ECE 498 Linux Assembly Language Lecture 5 Vince Weaver http://www.eece.maine.edu/ vweaver vincent.weaver@maine.edu 29 November 2012 Clarifications from Lecture 4 What is the Q saturate status bit? Some
More informationProgramming the ARM. Computer Design 2002, Lecture 4. Robert Mullins
Programming the ARM Computer Design 2002, Lecture 4 Robert Mullins 2 Quick Recap The Control Flow Model Ordered list of instructions, fetch/execute, PC Instruction Set Architectures Types of internal storage
More informationComputer Organization Laboratory. Class Notes. Instructor: Ken Q. Yang Dept. of ECE, URI
Computer Organization Laboratory Class Notes Instructor: Ken Q. Yang Dept. of ECE, URI Section 0 Course Objectives, Plans, and Lab Tools Course Objectives: What to learn? Computer Architecture Concepts
More informationComputer Architecture and System Software Lecture 07: Assembly Language Programming
Computer Architecture and System Software Lecture 07: Assembly Language Programming Instructor: Rob Bergen Applied Computer Science University of Winnipeg Announcements New assembly examples uploaded to
More informationComparison InstruCtions
Status Flags Now it is time to discuss what status flags are available. These five status flags are kept in a special register called the Program Status Register (PSR). The PSR also contains other important
More informationArchitecture. Digital Computer Design
Architecture Digital Computer Design Architecture The architecture is the programmer s view of a computer. It is defined by the instruction set (language) and operand locations (registers and memory).
More informationComputer Architecture and System Software Lecture 06: Assembly Language Programming
Computer Architecture and System Software Lecture 06: Assembly Language Programming Instructor: Rob Bergen Applied Computer Science University of Winnipeg Announcements Assignment 3 due thursday Midterm
More informationENGN1640: Design of Computing Systems Topic 03: Instruction Set Architecture Design
ENGN1640: Design of Computing Systems Topic 03: Instruction Set Architecture Design Professor Sherief Reda http://scale.engin.brown.edu School of Engineering Brown University Spring 2016 1 ISA is the HW/SW
More informationCortex M3 Programming
Cortex M3 Programming EE8205: Embedded Computer Systems http://www.ee.ryerson.ca/~courses/ee8205/ Dr. Gul N. Khan http://www.ee.ryerson.ca/~gnkhan Electrical and Computer Engineering Ryerson University
More informationEE319K Spring 2016 Exam 1 Solution Page 1. Exam 1. Date: Feb 25, UT EID: Solution Professor (circle): Janapa Reddi, Tiwari, Valvano, Yerraballi
EE319K Spring 2016 Exam 1 Solution Page 1 Exam 1 Date: Feb 25, 2016 UT EID: Solution Professor (circle): Janapa Reddi, Tiwari, Valvano, Yerraballi Printed Name: Last, First Your signature is your promise
More informationENGN1640: Design of Computing Systems Topic 03: Instruction Set Architecture Design
ENGN1640: Design of Computing Systems Topic 03: Instruction Set Architecture Design Professor Sherief Reda http://scale.engin.brown.edu School of Engineering Brown University Spring 2014 Sources: Computer
More informationARM Assembly Programming
ARM Assembly Programming Computer Organization and Assembly Languages g Yung-Yu Chuang 2007/12/1 with slides by Peng-Sheng Chen GNU compiler and binutils HAM uses GNU compiler and binutils gcc: GNU C compiler
More informationCOMPSCI 313 S Computer Organization. 7 MIPS Instruction Set
COMPSCI 313 S2 2018 Computer Organization 7 MIPS Instruction Set Agenda & Reading MIPS instruction set MIPS I-format instructions MIPS R-format instructions 2 7.1 MIPS Instruction Set MIPS Instruction
More informationEE4144: ARM Cortex-M Processor
EE4144: ARM Cortex-M Processor EE4144 Fall 2014 EE4144 EE4144: ARM Cortex-M Processor Fall 2014 1 / 10 ARM Cortex-M 32-bit RISC processor Cortex-M4F Cortex-M3 + DSP instructions + floating point unit (FPU)
More informationSTEVEN R. BAGLEY ARM: PROCESSING DATA
STEVEN R. BAGLEY ARM: PROCESSING DATA INTRODUCTION CPU gets instructions from the computer s memory Each instruction is encoded as a binary pattern (an opcode) Assembly language developed as a human readable
More informationPractical Malware Analysis
Practical Malware Analysis Ch 4: A Crash Course in x86 Disassembly Revised 1-16-7 Basic Techniques Basic static analysis Looks at malware from the outside Basic dynamic analysis Only shows you how the
More informationWriting ARM Assembly. Steven R. Bagley
Writing ARM Assembly Steven R. Bagley Hello World B main hello DEFB Hello World\n\0 goodbye DEFB Goodbye Universe\n\0 ALIGN main ADR R0, hello ; put address of hello string in R0 SWI 3 ; print it out ADR
More informationMIPS Functions and Instruction Formats
MIPS Functions and Instruction Formats 1 The Contract: The MIPS Calling Convention You write functions, your compiler writes functions, other compilers write functions And all your functions call other
More informationLecture 8: Control Structures. Comparing Values. Flags Set by CMP. Example. What can we compare? CMP Examples
Lecture 8: Control Structures CMP Instruction Conditional High Level Logic Structures Comparing Values The CMP instruction performs a comparison between two numbers using an implied subtraction. This means
More informationRui Wang, Assistant professor Dept. of Information and Communication Tongji University.
Instructions: ti Language of the Computer Rui Wang, Assistant professor Dept. of Information and Communication Tongji University it Email: ruiwang@tongji.edu.cn Computer Hierarchy Levels Language understood
More informationCSE Lecture In Class Example Handout
CSE 30321 Lecture 07-08 In Class Example Handout Part A: J-Type Example: If you look in your book at the syntax for j (an unconditional jump instruction), you see something like: e.g. j addr would seemingly
More informationCompiler Design. Homework 1. Due Date: Thursday, January 19, 2006, 2:00
Homework 1 Due Date: Thursday, January 19, 2006, 2:00 Your Name: Question 1 Is SPARC big- or little- Endian? When a word of data is stored in memory, which byte is stored in the first byte (i.e., in the
More informationCPE 323 MSP430 INSTRUCTION SET ARCHITECTURE (ISA)
CPE 323 MSP430 INSTRUCTION SET ARCHITECTURE (ISA) Aleksandar Milenković Email: milenka@uah.edu Web: http://www.ece.uah.edu/~milenka Objective Introduce MSP430 Instruction Set Architecture (Class of ISA,
More informationARM Assembly Programming
ARM Assembly Programming Computer Organization and Assembly Languages g Yung-Yu Chuang with slides by Peng-Sheng Chen GNU compiler and binutils HAM uses GNU compiler and binutils gcc: GNU C compiler as:
More informationF28HS2 Hardware-Software Interface. Lecture 7: ARM Assembly Language 2
F28HS2 Hardware-Software Interface Lecture 7: ARM Assembly Language 2 Structured programming assembly language requires intricate use of labels & branches easy to produce spaghetti code design assembly
More informationComputer System Architecture
CSC 203 1.5 Computer System Architecture Department of Statistics and Computer Science University of Sri Jayewardenepura Addressing 2 Addressing Subject of specifying where the operands (addresses) are
More informationProcedures and Stacks
Procedures and Stacks Daniel Sanchez Computer Science & Artificial Intelligence Lab M.I.T. March 15, 2018 L10-1 Announcements Schedule has shifted due to snow day Quiz 2 is now on Thu 4/12 (one week later)
More informationHi Hsiao-Lung Chan, Ph.D. Dept Electrical Engineering Chang Gung University, Taiwan
ARM Programmers Model Hi Hsiao-Lung Chan, Ph.D. Dept Electrical Engineering Chang Gung University, Taiwan chanhl@maili.cgu.edu.twcgu Current program status register (CPSR) Prog Model 2 Data processing
More informationUnsigned and signed integer numbers
Unsigned and signed integer numbers Binary Unsigned Signed 0000 0 0 0001 1 1 0010 2 2 0011 3 3 0100 4 4 Subtraction sets C flag opposite of carry (ARM specialty)! - if (carry = 0) then C=1 - if (carry
More informationComputer Science 2500 Computer Organization Rensselaer Polytechnic Institute Spring Topic Notes: MIPS Programming
Computer Science 2500 Computer Organization Rensselaer Polytechnic Institute Spring 2009 Topic Notes: MIPS Programming We spent some time looking at the MIPS Instruction Set Architecture. We will now consider
More informationEECE.3170: Microprocessor Systems Design I Summer 2017 Homework 4 Solution
1. (40 points) Write the following subroutine in x86 assembly: Recall that: int f(int v1, int v2, int v3) { int x = v1 + v2; urn (x + v3) * (x v3); Subroutine arguments are passed on the stack, and can
More informationChapter 15. ARM Architecture, Programming and Development Tools
Chapter 15 ARM Architecture, Programming and Development Tools Lesson 5 ARM 16-bit Thumb Instruction Set 2 - Thumb 16 bit subset Better code density than 32-bit architecture instruction set 3 Basic Programming
More informationCS24: INTRODUCTION TO COMPUTING SYSTEMS. Spring 2018 Lecture 4
CS24: INTRODUCTION TO COMPUTING SYSTEMS Spring 2018 Lecture 4 LAST TIME Enhanced our processor design in several ways Added branching support Allows programs where work is proportional to the input values
More informationLecture 2. Instructions: Language of the Computer (Chapter 2 of the textbook)
Lecture 2 Instructions: Language of the Computer (Chapter 2 of the textbook) Instructions: tell computers what to do Chapter 2 Instructions: Language of the Computer 2 Introduction Chapter 2.1 Chapter
More informationARM Cortex-M4 Programming Model
ARM Cortex-M4 Programming Model ARM = Advanced RISC Machines, Ltd. ARM licenses IP to other companies (ARM does not fabricate chips) 2005: ARM had 75% of embedded RISC market, with 2.5 billion processors
More informationReview Session 1 Fri. Jan 19, 2:15 pm 3:05 pm Thornton 102
Review Session 1 Fri. Jan 19, 2:15 pm 3:05 pm Thornton 102 1. Agenda Announcements Homework hints MIPS instruction set Some PA1 thoughts MIPS procedure call convention and example 1 2. Announcements Homework
More information