Richard P. Paul, SPARC Architecture, Assembly Language Programming, and C Chapter 8 – Machine Instructions These are lecture notes to accompany the book.

Slides:



Advertisements
Similar presentations
Chapter 6 Data Structures
Advertisements

Machine Instructions Operations
Princess Sumaya Univ. Computer Engineering Dept. Chapter 2: IT Students.
Machine Instructions Operations 1 ITCS 3181 Logic and Computer Systems 2015 B. Wilkinson Slides4-1.ppt Modification date: March 18, 2015.
CONDITION CODE AND ARITHMETIC OPERATIONS – Microprocessor Asst. Prof. Dr. Choopan Rattanapoka and Asst. Prof. Dr. Suphot Chunwiphat.
I/O: SPARC Assembly Department of Computer Science Georgia State University Georgia State University Updated Spring 2014.
ELEN 468 Advanced Logic Design
Instruction Set Architecture & Design
S. Barua – CPSC 240 CHAPTER 5 THE LC-3 Topics Memory organization Registers Instruction set Opcodes.
Lecture 5 Sept 14 Goals: Chapter 2 continued MIPS assembly language instruction formats translating c into MIPS - examples.
Chapters 5 - The LC-3 LC-3 Computer Architecture Memory Map
Dale & Lewis Chapter 5 Computing components. Let’s design a computer Generic CPU with registers −Program counter (PC) – 5 bits (size of addresses) −Instruction.
CS 300 – Lecture 6 Intro to Computer Architecture / Assembly Language Instructions.
ARM Instructions I Prof. Taeweon Suh Computer Science Education Korea University.
Some material taken from Assembly Language for x86 Processors by Kip Irvine © Pearson Education, 2010 Slides revised 2/2/2014 by Patrick Kelley.
CSC 3210 Computer Organization and Programming Chapter 2 SPARC Architecture Dr. Anu Bourgeois 1.
Lecture Objectives: 1)Define the terms least significant bit and most significant bit. 2)Explain how unsigned integer numbers are represented in memory.
CSC 3210 Computer Organization and Programming Chapter 8 MACHINE INSTRUCTIONS D.M. Rasanjalee Himali.
Natawut NupairojAssembly Language1 Memory and Stack.
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.
Chapter 5 The LC Instruction Set Architecture ISA = All of the programmer-visible components and operations of the computer memory organization.
April 23, 2001Systems Architecture I1 Systems Architecture I (CS ) Lecture 9: Assemblers, Linkers, and Loaders * Jeremy R. Johnson Mon. April 23,
Computer Organization and Architecture Instructions: Language of the Machine Hennessy Patterson 2/E chapter 3. Notes are available with photocopier 24.
Richard P. Paul, SPARC Architecture, Assembly Language Programming, and C Chapter 4 –Binary Arithmetic These are lecture notes to accompany the book SPARC.
Computer Organization & Programming Chapter 6 Single Datapath CPU Architecture.
by Richard P. Paul, 2nd edition, 2000.
CPS3340 COMPUTER ARCHITECTURE Fall Semester, /08/2013 Lecture 10: MIPS Instructor: Ashraf Yaseen DEPARTMENT OF MATH & COMPUTER SCIENCE CENTRAL STATE.
Computer Architecture CSE 3322 Lecture 3 Assignment: 2.4.1, 2.4.4, 2.6.1, , Due 2/3/09 Read 2.8.
EET 4250 Instruction Representation & Formats Acknowledgements: Some slides and lecture notes for this course adapted from Prof. Mary Jane Penn.
Chapter 2 — Instructions: Language of the Computer — 1 Memory Operands Main memory used for composite data – Arrays, structures, dynamic data To apply.
Accessing Memory Chapter 5 Lecture notes for SPARC Architecture, Assembly Language Programming and C, Richard P. Paul by Anu G. Bourgeois.
DR. SIMING LIU SPRING 2016 COMPUTER SCIENCE AND ENGINEERING UNIVERSITY OF NEVADA, RENO Session 9 Binary Representation and Logical Operations.
DR. SIMING LIU SPRING 2016 COMPUTER SCIENCE AND ENGINEERING UNIVERSITY OF NEVADA, RENO Session 7, 8 Instruction Set Architecture.
ECE 447: Lecture 11 Introduction to Programming in Assembly Language.
Datapath and Control AddressInstruction Memory Write Data Reg Addr Register File ALU Data Memory Address Write Data Read Data PC Read Data Read Data.
The Stack Chapter 5 Lecture notes for SPARC Architecture, Assembly Language Programming and C, Richard P. Paul by Anu G. Bourgeois, Abinashi Dhungel.
27 October 2015 Birkbeck College, U. London1 Introduction to Computer Systems Lecturer: Steve Maybank Department of Computer Science and Information Systems.
CS Computer Organization Numbers and Instructions Dr. Stephen P. Carl.
COMPUTER ARCHITECTURE & OPERATIONS I Instructor: Yaohang Li.
Lecture 6: Decision and Control CS 2011 Spring 2016, Dr. Rozier.
Chapter 8 – Machine Instructions
MIPS Assembly.
CPU Organisation & Operation
Microprocessor T. Y. B. Sc..
COMPUTER ARCHITECTURE & OPERATIONS I
The Stack Chapter 5 Lecture notes for SPARC Architecture, Assembly Language Programming and C, Richard P. Paul by Anu G. Bourgeois.
Morgan Kaufmann Publishers
3.Instruction Set of 8085 Consists of 74 operation codes, e.g. MOV
ELEN 468 Advanced Logic Design
COMP2121: Microprocessors and Interfacing
Conditional Branches What distinguishes a computer from a simple calculator is its ability to make decisions Decisions are made using the if statement,
The University of Adelaide, School of Computer Science
Chapter 5 The LC-3.
CS170 Computer Organization and Architecture I
CSCI206 - Computer Organization & Programming
MISP Assembly.
The University of Adelaide, School of Computer Science
CSC 3210 Computer Organization and Programming
Computer Architecture & Operations I
MIPS Instruction Encoding
The University of Adelaide, School of Computer Science
MIPS Instruction Encoding
by Richard P. Paul, 2nd edition, 2000.
Architecture Overview
The Processor Lecture 3.2: Building a Datapath with Control
Computer Architecture
Instruction encoding We’ve already seen some important aspects of processor design. A datapath contains an ALU, registers and memory. Programmers and compilers.
Branching instructions
October 29 Review for 2nd Exam Ask Questions! 4/26/2019
Presentation transcript:

Richard P. Paul, SPARC Architecture, Assembly Language Programming, and C Chapter 8 – Machine Instructions These are lecture notes to accompany the book SPARC Architecture, Assembly Language Programming, and C, by Richard P. Paul, 2 nd edition, Updated Spring 2014

Richard P. Paul, SPARC Architecture, Assembly Language Programming, and C Decoding Instructions SPARC Instructions are 32 bits long Bits specify the “op” field These first 2 bits indicate how the other bits should be handled. op

Richard P. Paul, SPARC Architecture, Assembly Language Programming, and C Decoding Instructions Instructions are classified according to “op” op opInstruction class 00Branch instructions 01 Call instructions 10Format Three instructions 11Format Three instructions

Richard P. Paul, SPARC Architecture, Assembly Language Programming, and C Format 1 Instructions Call instruction The displacement must be word aligned Address is calculated by right shifting displacement 2 positions 0130 bit displacement

Richard P. Paul, SPARC Architecture, Assembly Language Programming, and C Format 2 Instructions branch 0 0 a cond op2 22 bit immediate sethi 0 0 rd bit immediate

Richard P. Paul, SPARC Architecture, Assembly Language Programming, and C Branch Instructions The branch is (or is not) taken based on the “cond” (condition) field. op2 = 010 means integer condition code condbranch type 1000always 1001if not equal to zero 1010if greater than zero 1011if greater than or equal to zero 1100if greater, unsigned 1101if carry is clear 1110if positive 1111if overflow is clear condbranch type 0000never 0001if equal to zero 0010if less than or equal to zero 0011if less than zero 0100if less or equal, unsigned 0101if carry set 0110if negative 0111if overflow is set

Richard P. Paul, SPARC Architecture, Assembly Language Programming, and C Format 3 Instructions 2 source registers 1 x rd op3 rs1 0 rs Immediate constant 1 x rd op3 rs1 1 signed 13-bit #

Richard P. Paul, SPARC Architecture, Assembly Language Programming, and C Format Three Instructions Not all possible bits patterns are used op = 10 op3Instruction add and or xor sub andn orn xnor addx op3Instruction jumpl rett ticc iflush save restore See page 235 for a complete list

Richard P. Paul, SPARC Architecture, Assembly Language Programming, and C Format Three Instructions Not all possible bits patterns are used op = 11 op3Instruction ld ldub lduh ldd st stb sth std See page 236 for a complete list

Register coding RegisterSynonyms %g0%r0 %g1%r1 %g2%r2 %g3%r3 %g4%r4 %g5%5 %g6%r6 %g7%r7 Richard P. Paul, SPARC Architecture, Assembly Language Programming, and C RegisterSynonyms %o0%r8 %o1%r9 %o2%r10 %o3%r11 %o4%r12 %o5%r13 %o6%r14 %o7%r15 RegisterSynonyms %l0%r16 %l1%r17 %l2%r18 %l3%r19 %l4%r20 %l5%r21 %l6%r22 %l7%r23 RegisterSynonyms %i0%r24 %i1%r25 %i2%r26 %i3%r27 %i4%r28 %i5%r29 %i6%r30 %i7%r31

Load/Store instructions Load and Store instructions have two references – a register and memory location rd field – refers to the register component rs1 field – refers to register for memory address rs2 field/immediate – refers to offset for memory address Richard P. Paul, SPARC Architecture, Assembly Language Programming, and C

Load/Store examples ldub [%o3 + %l2], %o1 stb %l0, [%o1 + %o2] stb %o5, [%o1 + 50] Richard P. Paul, SPARC Architecture, Assembly Language Programming, and C rd rs1 rs2 immediate rs1 rs2 rd

Richard P. Paul, SPARC Architecture, Assembly Language Programming, and C Example Decode the following commands: save %sp, -96, %sp ld [%fp-20], %o0 mov 4, %o1 add %o0, %o1, %o0 st %o0, [%fp-20] ret restore 0x9de3bfa0 0xd007bfec 0x x xd027bfec 0x81c7e008 0x81e80000