SPARC Programming Model 24 “window” registers 8 global registers Control registers –Multiply step –PSR (status flags, etc.) –Trap Base register –Window.

Slides:



Advertisements
Similar presentations
Cosc 2150: Computer Organization
Advertisements

Integer Arithmetic: Multiply, Divide, and Bitwise Operations
Control Structures in ARM Implementation of Decisions Similar to accumulator instructions One instruction sets the flags, followed by another instruction.
Pipeline Optimization
SPARC Architecture & Assembly Language
CSE 131B – Compiler Construction II Discussion 5: SPARC Assembly (The Fun Stuff!) 2/14/2007 Happy Valentine’s Day!
1 ICS 51 Introductory Computer Organization Fall 2006 updated: Oct. 2, 2006.
By Tien Phung CS 147 Dr. Sin-Min Lee. High-level Languages Assembly Languages Machine Languages.
Memory - Registers Instruction Sets
Microprocessors Introduction to RISC Mar 19th, 2002.
CPSC355 Week 3 Hoang Dang. Week 3 Assignment 1 Do/while loop Assignment 2 Binary Bitwise operation.
1 CSC 3210 Computer Organization and Programming Chapter 7 SUBROUTINES D.M. Rasanjalee Himali.
Introduction to computer: executes instructions. Overview Topics discussed in this webnote: –Structure and operation of the CPU –Program flow –Types of.
CSC 3210 Computer Organization and Programming Chapter 2 SPARC Architecture Dr. Anu Bourgeois 1.
CSC 3210 Computer Organization and Programming Chapter 2 SPARC Architecture Dr. Anu Bourgeois 1.
Microprocessors Monday, Apr. 13 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.
Richard P. Paul, SPARC Architecture, Assembly Language Programming, and C Chapter 7 – Subroutines These are lecture notes to accompany the book SPARC Architecture,
Natawut NupairojAssembly Language1 Arithmetic Operations.
ITEC 352 Lecture 14 ISA(6). Review Questions? Beginning / End Memory locations Variable / Memory syntax PSR Loops / Branches.
Chapter 10 The Assembly Process. What Assemblers Do Translates assembly language into machine code. Assigns addresses to all symbolic labels (variables.
Arithmetic Flags and Instructions
1 ICS 51 Introductory Computer Organization Fall 2009.
Natawut NupairojAssembly Language1 Control Structure.
IFT 201: Unit 1 Lecture 1.3: Processor Architecture-3
Microprocessors The ia32 User Instruction Set Jan 31st, 2002.
Overview of Super-Harvard Architecture (SHARC) Daniel GlickDaniel Glick – May 15, 2002 for V (Dewar)
Richard P. Paul, SPARC Architecture, Assembly Language Programming, and C Chapter 4 –Binary Arithmetic These are lecture notes to accompany the book SPARC.
by Richard P. Paul, 2nd edition, 2000.
CSC 3210 Computer Organization and Programming Chapter 2 SPARC ARCHITECTURE D.M. Rasanjalee Himali.
Lecture 2: Advanced Instructions, Control, and Branching EEN 312: Processors: Hardware, Software, and Interfacing Department of Electrical and Computer.
Richard P. Paul, SPARC Architecture, Assembly Language Programming, and C Chapter 8 – Machine Instructions These are lecture notes to accompany the book.
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Control Unit.
1 The Instruction Set Architecture September 27 th, 2007 By: Corbin Johnson CS 146.
Natawut NupairojAssembly Language1 Pipelining Processor.
EEL 3801 Part V Conditional Processing. This section explains how to implement conditional processing in Assembly Language for the 8086/8088 processors.
CMPUT Computer Organization and Architecture I1 CMPUT229 - Fall 2003 Topic6: Logic, Multiply and Divide Operations José Nelson Amaral.
Chapter 7 Bit Manipulation. 7.1 Logical Operations.
MICROPROCESSOR DETAILS 1 Updated April 2011 ©Paul R. Godin prgodin gmail.com.
Sun Microsystems’ UltraSPARC-IIi a Stunt-Free Presentation by Christine Munson Amanda Peters Carl Sadler.
CSC 3210 Computer Organization and Programming
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Control Unit.
Computer and Information Sciences College / Computer Science Department CS 206 D Computer Organization and Assembly Language.
Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 251 Introduction to Computer Organization.
Chapter 2 SPARC Architecture Chinua Umoja 1.  SPARC is a load/store architecture  Registers used for all arithmetic and logical operations  32 registers.
ARM Instructions ARM instructions are written as an operation code (opcode), followed by zero or more operands Operands may be constants (8-bit value),
Unit 1 Instruction set M.Brindha AP/EIE
Computer Architecture CST 250
Control Unit Lecture 6.
Gunjeet Kaur Dronacharya Group of institutions
Assembly Language Assembly Language
3.Instruction Set of 8085 Consists of 74 operation codes, e.g. MOV
1. Introduction A microprocessor executes instructions given by the user Instructions should be in a language known to the microprocessor Microprocessor.
Processor Instructions set. Learning Objectives
Chapter 3 Bit Operations
Chapter 7 Subroutines Dr. A.P. Preethy
Chapter 11 © 2011, The McGraw-Hill Companies, Inc.
ARM Control Structures
CS 235 Computer Organization & Assembly Language
CSC 3210 Computer Organization and Programming
Shift & Rotate Instructions)
by Richard P. Paul, 2nd edition, 2000.
Shift & Rotate Instructions)
ARM Control Structures
Branching instructions
MIPS assembly.
Multiply Instructions
CS501 Advanced Computer Architecture
Immediate data Immediate operands : ADD r3, r3, #1 valid ADD r3, #1,#2 invalid ADD #3, r1,r2 invalid ADD r3, r2, #&FF ( to represent hexadecimal immediate.
An Introduction to the ARM CORTEX M0+ Instructions
MIPS instructions.
Presentation transcript:

SPARC Programming Model 24 “window” registers 8 global registers Control registers –Multiply step –PSR (status flags, etc.) –Trap Base register –Window Invalid Mask –Two program counters ( PC and nPC )

SPARC Program /* This program converts a temperature in Celcius to Fahrenheit. George Wells - 30 May 2003 */ offs = 32 /* Variables c and f are stored in %l0 and %l1 */.global main main: mov 24, %l0 ! Initialize c = 24 mov 9, %o0 ! 9 into %o0 for multiplication mov %l0, %o1 ! c into %o1 for multiplication call.mul ! Result in %o0 nop ! Delay slot mov 5, %o1 ! 5 into %o1 for division call.div ! Result in %o0 nop ! Delay slot

Example (cont.)... add %o0, offs, %l1 ! f = result + offs mov 1, %g1 ! Trap dispatch ta 0 ! Trap to system

Filling Delay Slots Not very efficient mov 9, %o0 ! 9 into %o0 for multiplication mov %l0, %o1 ! c into %o1 for multiplication call.mul ! Result in %o0 nop ! Delay slot mov 9, %o0 ! 9 into %o0 for multiplication call.mul ! Result in %o0 mov %l0, %o1 ! c into %o1 for multiplication Better!

Modified Program main: mov 24, %l0 ! Initialize c = 24 mov 9, %o0 ! 9 into %o0 for multiplication call.mul ! Result in %o0 mov %l0, %o1 ! c into %o1 for multiplication call.div ! Result in %o0 mov 5, %o1 ! 5 into %o1 for division...

3. Control Transfer Instructions Branching –Unconditional: ba bn –Conditional: bicc icc = Integer Condition Codes –Condition flags are set explicitly by arithmetic and logical operations E.g. addcc

Delayed Control Transfer Increases the efficiency of pipelining

Example /* This program converts temperatures between 10 and 20 in Celcius to Fahrenheit. George Wells - 30 May 2003 */ offs = 32 /* Variables c and f are stored in %l0 and %l1 */.global main main: mov 10, %l0 ! Initialize c = 10 loop: mov 9, %o0 ! 9 into %o0 for.mul call.mul ! Result in %o0 mov %l0, %o1 ! c into %o1 for.mul call.div ! Result in %o0 mov 5, %o1 ! 5 into %o1 for.div...

Example (cont.)... add %o0, offs, %l1 ! f = result + offs add %l0, 1, %l0 ! c++ cmp %l0, 21 ! c < 21 ? bl loop nop ! Delay slot mov 1, %g1 ! Trap dispatch ta 0 ! Trap to system

Annulled Branches Delay slot instruction is ignored –Conditional: if branch is not taken –Unconditional: always annulled

An Annulled Branch Java/C Code: while (a <= 17) a = a + b; Unoptimised assembler: ! Assumes a is in %l0 and b is in %l1 b test ! See if loop should execute nop ! Delay slot loop: add %l0, %l1, %l0! a = a + b test: cmp %l0, 17 ! a <= 17 ble loop ! If so branch back to start nop ! Delay slot

Optimised Assembler ! Assumes a is in %l0 and b is in %l1 b test ! See if loop should execute nop ! Delay slot loop: test: cmp %l0, 17 ! a <= 17 ble,a loop ! If so branch back to start add %l0, %l1, %l0 ! a = a + b

4. Logical and Arithmetic Operations Logical Operators –and or xor –xnor andn orn –+ cc to set the condition codes Shift Operators –sra srl sll

Arithmetic Operators Only addition and subtraction –add[x][cc] –sub[x][cc] [x] — with carry [cc] — to set the flags

Multiplication Long multiplication is supported by the “multiply step” instruction: –mulscc

Division Use the standard routines: –.div.rem –.udiv.urem