Generation System Advanced Seminar on Compilation and Run-time Systems for Object-Oriented Languages. David Bélanger
|
|
- Louise Warren
- 6 years ago
- Views:
Transcription
1 VCODE: A Fast Dynamic Code Generation System Advanced Seminar on Compilation and Run-time Systems for Object-Oriented Languages David Bélanger dbelan2@cs.mcgill.ca McGill University Montreal, QC VCODE: A Fast Dynamic Code Generation System p.1/39
2 References References [D.R. Engler and Kaashoek, 1995] D.R. Engler, W. H. and Kaashoek, M. (1995). C: A language for high-level, efficient, and machine-independent dynamic code generation. In Proceedings of the 22th annual symposium on principles of programming languages. [Engler, 1996a] Engler, D. (1996a). VCODE: A retargetable, extensible, very fast dynamic code generation system. In Proceedings of the SIGPLAN 1996 PLDI. [Engler, 1996b] Engler, D. (1996b). A vcode tutorial. [Engler and Proebsting, 1994] Engler, D. and Proebsting, T. (1994). DCG: An efficient, retargetable dynamic code generation system. In Proceedings of ASPLOS-VI, pages VCODE: A Fast Dynamic Code Generation System p.2/39
3 Overview Introduction System Overview Instruction Set Client/VCODE Interface Code Generation Limitations Results Conclusion and Further Work VCODE: A Fast Dynamic Code Generation System p.3/39
4 Introduction Dynamic Code Generation: generating code at run-time Applications: Speed up in interpreted languages (ex: JIT compilers for Java) Perform optimizations based on values known at run-time Specialized functions (ex: ) Difficult to implement, not much tools available Most code generation systems are either non-portable or language specific VCODE is portable, language independent and efficient. VCODE: A Fast Dynamic Code Generation System p.4/39
5 Previous Work Smalltalk-80 code generation system done by ParcPlace DCG (VCODE is simpler and about 35 times faster) C (tick C): Superset of C for dynamic code generation. Uses DCG as back-end. Method Inst. executed/instr. generated gcc + dynamic linking DCG 350 VCODE 6-10 Table 1: Approximate Code Generation Cost VCODE: A Fast Dynamic Code Generation System p.5/39
6 VCODE System Overview Consists of a set of C macros and functions Dynamic (at run-time) code generation Compilation unit: a function VCODE machine interface: idealized load-store RISC architecture Retargetable: Relatively simple to port to new architectures About 1 to 4 days required to port to a RISC architecture. Currently: MIPS, SPARC, Alpha VCODE: A Fast Dynamic Code Generation System p.6/39
7 VCODE System Overview Very fast: A single pass + patching in-place code generation No intermediate data structures 6 to 10 instructions per instruction High-level language translated can be any. VCODE: A Fast Dynamic Code Generation System p.7/39
8 Instruction Set Similar to RISC instructions Most instructions directly maps to a single assembly instruction. Examples: add, sub, and, j Register or immediate operands Instructions are typed VCODE: A Fast Dynamic Code Generation System p.8/39
9 VCODE Types Type C equivalent v void c signed char uc unsigned char s signed short us unsigned short i int u unsigned p void * l long ul unsigned long f float d double Table 2: VCODE types (from [Engler, 1996a]) VCODE: A Fast Dynamic Code Generation System p.9/39
10 Instruction Types Not all operations have a version for all types. Reg-Reg ops take only the wider types (int, long,...) Reduces number of VCODE instructions Most architectures do not support them Types may not all be distincts on some architectures. Example: i and l are both 32-bit integers on 32-bit architectures. Instructions to convert types: cvx2y Only for types i, u, l, ul, p, f, d Not all combinations available VCODE: A Fast Dynamic Code Generation System p.10/39
11 Instruction Naming Each VCODE instruction has a corresponding C macro/function. The macro/function name is constructed by: Adding the prefix v to the instruction name. Appending the type code (ex: i for integer) Appending i if it is the immediate version. Example: add integer immediate is macro v addii. VCODE: A Fast Dynamic Code Generation System p.11/39
12 Layers Instructions are divided in two groups: Core Layer: Fundamental instructions that must be implemented by each architecture supported. Includes basic instructions such as add, ld (load) and j (jump). Extension Layers: Sets of instructions that are expressed in terms of the core instructions. Ex: lt (less than), ntoh (network-to-host order), floor. Note: For efficiency reasons, instructions from the extension layer should be implemented directly if the hardware supports them. VCODE: A Fast Dynamic Code Generation System p.12/39
13 Core Instructions Standard Binary Operations (rd, rs1, {rs2 or imm a }) Inst. Types Notes add, sub i u l ul p f d mul, div i u l ul f d mod, and, or, i u l ul (rsh: sign bit propagated xor, lsh, rsh for signed types) Standard Unary Operations (rd, rs) Instructions Types Notes com, not i u l ul bit complement, logical not mov i u l ul p f d copy rs to rd neg i u l ul f d negation cvi2, cvu convert types cvl2, etc. a Note: Immediate cannot be of type f or d VCODE: A Fast Dynamic Code Generation System p.13/39
14 Core Instructions Memory Operations (rd, rs, offset a ) Instructions Types Notes ld c uc s us i u l ul p f d load st c uc s us i u l ul p f d store Return to Caller (rs) Instructions Types Notes ret v i u l ul p f d return value Instructions Types Notes Jumps (addr) j v p jump to imm, reg or label jal v p jump and link to imm, reg or label a Note: offset cannot be of type f or d. VCODE: A Fast Dynamic Code Generation System p.14/39
15 Core Instructions Branches (rs1, {rs2 or imm a }, label) Instructions Types Notes blt i u l ul p f d branch if less than ble i u l ul p f d branch if less than equal bgt i u l ul p f d branch if greater than bge i u l ul p f d branch if greater than equal beq i u l ul p f d branch if equal bne i u l ul p f d branch if not equal Nullary Operation Instructions Types Notes nop no operation a Note: imm cannot be of type f or d. VCODE: A Fast Dynamic Code Generation System p.15/39
16 Primary Extensions Binary Operations (rd, rs1, rs2 {or imm a }) lt, le, gt, ge, eq, ne nand, nor, nxor mulhi (high bits of product) Network Extensions (rd, rs) ntoh, hton, bswap (byteswap) Unary Operations (rd, rs) abs, sqrt, ceil, floor Etc. a Note: imm cannot be of type f or d VCODE: A Fast Dynamic Code Generation System p.16/39
17 Example 1 - hello.c #include <stdio.h> #include "vcode.h" /* This header file defines all vcode instr. */ int main(void) { static v_code insn[1000]; /* Memory to hold code in. */ /* Create a function to print standard greeting. */ v_lambda("hello-world", "", 0, V_NLEAF, insn, sizeof insn); /* Generate simple call to printf. */ v_scallv((v_vptr)printf, "%P", "hello, world\n"); v_end(0).v(); /* Compile & call */ return 0; } Example from [Engler, 1996b] VCODE: A Fast Dynamic Code Generation System p.17/39
18 v lambda v_lambda(char *name, char *fmt, v_reg_type *args, int leaf, v_code *ip, int nbytes); Ex: v_lambda("hello-world", "", 0, V_NLEAF, insn, sizeof insn); Initiate a new dynamically generated function. name: Function name. fmt: List of args as a type string. Ex: "%i". Note: VCODE type symbols used. args: Registers for arguments. leaf: V LEAF if a leaf procedure, V NLEAF otherwise. ip: Array where the instructions are stored. nbytes: Size of the instruction array. VCODE: A Fast Dynamic Code Generation System p.18/39
19 v scallv void v_scallv(v_vptr ptr, char *fmt,...); Ex: v_scallv((v_vptr)printf, "%P", "hello, world\n"); ptr: A function pointer to the function to call. (Note: Could be a dynamically generated function) fmt: Specify args types. Note: P used to specify immediate, p would be used to specify a register.... : The arguments. VCODE: A Fast Dynamic Code Generation System p.19/39
20 v end union v_fp v_end(int *nbytes); Ex: v_end(0); v end marks the termination of the function. nbytes: If non-null, the number of bytes used by the function is stored there. Returns a union of function pointers. One member for each VCODE type. v end(0).v(): Calls it. VCODE: A Fast Dynamic Code Generation System p.20/39
21 Example 2 - mkplus1 typedef int (*iptr)(int); iptr mkplus1(v_code *ip, int nbytes) { v_reg arg[1]; v_lambda("plus", "%i", arg, V_LEAF, ip, nbytes); v_addii(arg[0], arg[0], 1); /* ADD Integer Immediate */ v_reti(arg[0]); /* RETurn Integer */ return (iptr)v_end(0); } Example from [Engler, 1996b] Makes int plus1(int x) return x + 1; VCODE: A Fast Dynamic Code Generation System p.21/39
22 Delay Slot Scheduling For MIPS, code generated is: addiu a0, a0, 1 # increment j ra # return move v0, a0 # set return register # with result Note: Last instruction fills the delay slot. Note: Not the the most efficient. Could store result directly in v0. VCODE: A Fast Dynamic Code Generation System p.22/39
23 Client/VCODE Interface Client programs uses VCODE instructions via macro and function calls. Client is basically a compiler front-end. VCODE library is a fast code generation back-end. VCODE does no global optimizations, it is up to the client program to do them. VCODE has a very local view. Goal is to have fast code generation. Code is generated immediately (or almost) by macros/functions. VCODE: A Fast Dynamic Code Generation System p.23/39
24 Register Allocation Client can: Set priority to registers (allocated in that order) Set class of register 2 classes supported temporary perstistent across procedure calls (stored) Error returned if client request a register and none left. Client must take care of keeping variables on the stack. VCODE: A Fast Dynamic Code Generation System p.24/39
25 Example from Tutorial - Power /* Power: raise base to n-th power: n > 0; runtime constant n. */ v_fptr specialize_power(int n) { v_reg_type x, sum; v_lambda("power", "%d", &x, V_LEAF, malloc(512), 512); { int i; /* Allocate accumulator */ v_getreg(&sum, V_D, V_TEMP); v_movf(sum, x); /* initialize sum */ /* Specialize power to xˆn by unrolling the loop to multiply x n times: (x * x *... * x). */ for(i = 0; i < n - 1; i++) v_mulf(sum, sum, x); } v_retf(sum); /* return x ˆ n */ } return v_end(0).f; /* return pointer to result. */ VCODE: A Fast Dynamic Code Generation System p.25/39
26 Example from Tutorial - Branch int main(void) { static v_code insn[1000]; /* Memory to hold code in. */ v_vptr vp; v_reg_type x; v_lambda("branch", "%i", &x, V_NLEAF, insn, sizeof insn); { v_label_type true, end; true = v_genlabel(); /* allocate two labels */ end = v_genlabel(); /* test whether x is equal to 5 */ v_beqii(x, 5, true); v_scallv((v_vptr)printf, "%P", "Arg is not equal to 5\n"); v_jv(end); /* jump over else */ v_label(true); v_scallv((v_vptr)printf, "%P", "Arg is equal to 5\n"); v_label(end); v_retv(); } vp = v_end(0).v; vp(5); vp(6); /* test */ return 0; } VCODE: A Fast Dynamic Code Generation System p.26/39
27 Code Generation 1. Instruction Selection 2. Binary Code Emission 3. Jump Resolution Step 1 and 2 are done where VCODE instruction created for almost all instructions. Step 3 is done in v end. VCODE: A Fast Dynamic Code Generation System p.27/39
28 Challenges of in-place CG in-place : single pass + patching No global knowledge about function Unknown number of locals Unknown amount of space to save registers Unknown number of instructions Don t know if leaf procedure (if it wouldn t be specified) Four challenges VCODE: A Fast Dynamic Code Generation System p.28/39
29 C1 Unknown Activation Record Size Required to compute offsets To save/restore registers For locals on stack Possible Solution 1: Client tells that info at initialization Reduces flexibility (info required at that time) Reduce efficiency in that 2 passes required 1 pass by client to compute number of locals 1 pass to generate VCODE Possible Solution 2 (VCODE solution): Allocate space to save all registers Register offsets will be known Offsets of locals known as they get allocated Typical RISC (32 32-bit int registers and 32 FP registers): 64 words reserved. VCODE: A Fast Dynamic Code Generation System p.29/39
30 Activation Record 64 words reserved to save registers sp Space for locals will be allocated here VCODE: A Fast Dynamic Code Generation System p.30/39
31 C2 Saving Callee-saved Registers Problem: VCODE doesn t know how many registers (and which ones) need to be saved. Solution: Reserve space in the instruction stream to save all registers (function prologue). Done in v lambda. While generating code, put jumps to epilogue (label) on function exit points When done (i.e. in v end) Write epilogue (if needed) Patch forward jumps. Write prologue. Fill unused space with nops. Amount of space used: 64 words (assuming 32 ints, 32 floats) VCODE: A Fast Dynamic Code Generation System p.31/39
32 Instruction Stream Reserved for register save instructions (64 words) Reserved for register save instructions (64 words) add t0, a0, a1 add s0, a0, a0 j EPILOGUE j EPILOGUE After v_lambda During code generation VCODE: A Fast Dynamic Code Generation System p.32/39
33 C3 Leaf Procedure Note: Many optimizations may be done on them. Problem: Don t know for sure if it is a leaf until done generating code. Solution: Specify it at initialization (i.e. in v lambda) Error generated if leaf declared and attempt to do a call VCODE may add function calls internally Software division routine Implementation would simply ignore the hint VCODE: A Fast Dynamic Code Generation System p.33/39
34 C4 Floating Point Immediates Problem: On most architecture, FP instructions do not take immediate operands. Space needs to be allocated and reclaimed for them. Solution: Simply put them at the end of the function VCODE: A Fast Dynamic Code Generation System p.34/39
35 Improving Efficiency / More Control A client can: Dynamically change the register class Callee-saved Caller-saved Unavailable Specify an instruction for a branch delay slot. Correctly handled if underlying architecture has no delay slot. Loads: Macro that takes cycle count before value can be used, nops inserted if necessary VCODE: A Fast Dynamic Code Generation System p.35/39
36 Limitations No symbolic debugger Limited register Virtual registers will be added Usually not a problem to let client manage them No peephole optimizer No instruction scheduler Small issue: hardware scheduling VCODE: A Fast Dynamic Code Generation System p.36/39
37 Results Filter Notes Time (ms) MPF Widely used 35.0 PATHFINDER Was the fastest 19.0 DPF Implemented with VCODE 1.5 Table 3: Average time to filter TCP/IP packets VCODE: A Fast Dynamic Code Generation System p.37/39
38 Results Machine Method copy + checksum copy + checksum + byte swap DEC3100 separate / uncached separate C integrated ASH DEC5000 separate / uncached separate C integrated ASH Table 4: Cost of integrated and non-integrated memory operations. Times are in ms VCODE: A Fast Dynamic Code Generation System p.38/39
39 Conclusion and Further Work Possible to have both portability and efficiency. VCODE is an effective DCG for interpreters and specialized functions. Further Work Add simple optimizations (such as peepholes) Add support for unlimited virtual registers Implement a portable JIT for SableVM VCODE: A Fast Dynamic Code Generation System p.39/39
Lecture 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 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 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 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 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 informationThomas Polzer Institut für Technische Informatik
Thomas Polzer tpolzer@ecs.tuwien.ac.at Institut für Technische Informatik Branch to a labeled instruction if a condition is true Otherwise, continue sequentially beq rs, rt, L1 if (rs == rt) branch to
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 informationChapter 2. Instructions: Language of the Computer. Adapted by Paulo Lopes
Chapter 2 Instructions: Language of the Computer Adapted by Paulo Lopes Instruction Set The repertoire of instructions of a computer Different computers have different instruction sets But with many aspects
More informationCISC 662 Graduate Computer Architecture. Lecture 4 - ISA MIPS ISA. In a CPU. (vonneumann) Processor Organization
CISC 662 Graduate Computer Architecture Lecture 4 - ISA MIPS ISA Michela Taufer http://www.cis.udel.edu/~taufer/courses Powerpoint Lecture Notes from John Hennessy and David Patterson s: Computer Architecture,
More informationCISC 662 Graduate Computer Architecture. Lecture 4 - ISA
CISC 662 Graduate Computer Architecture Lecture 4 - ISA Michela Taufer http://www.cis.udel.edu/~taufer/courses Powerpoint Lecture Notes from John Hennessy and David Patterson s: Computer Architecture,
More informationComputer Organization MIPS ISA
CPE 335 Computer Organization MIPS ISA Dr. Iyad Jafar Adapted from Dr. Gheith Abandah Slides http://www.abandah.com/gheith/courses/cpe335_s08/index.html CPE 232 MIPS ISA 1 (vonneumann) Processor Organization
More informationMIPS R-format Instructions. Representing Instructions. Hexadecimal. R-format Example. MIPS I-format Example. MIPS I-format Instructions
Representing Instructions Instructions are encoded in binary Called machine code MIPS instructions Encoded as 32-bit instruction words Small number of formats encoding operation code (opcode), register
More informationProcedure Call Instructions
Procedure Calling Steps required 1. Place parameters in registers x10 to x17 2. Transfer control to procedure 3. Acquire storage for procedure 4. Perform procedure s operations 5. Place result in register
More informationIntroduction to MIPS Processor
Introduction to MIPS Processor The processor we will be considering in this tutorial is the MIPS processor. The MIPS processor, designed in 1984 by researchers at Stanford University, is a RISC (Reduced
More informationChapter 2. Instructions: Language of the Computer
Chapter 2 Instructions: Language of the Computer Instruction Set The repertoire of instructions of a computer Different computers have different instruction sets But with many aspects in common Early computers
More informationInstruction Set Architecture part 1 (Introduction) Mehran Rezaei
Instruction Set Architecture part 1 (Introduction) Mehran Rezaei Overview Last Lecture s Review Execution Cycle Levels of Computer Languages Stored Program Computer/Instruction Execution Cycle SPIM, a
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 informationCOMPUTER ORGANIZATION AND DESIGN
COMPUTER ORGANIZATION AND DESIGN 5 th The Hardware/Software Interface Edition Chapter 2 Instructions: Language of the Computer 2.1 Introduction Instruction Set The repertoire of instructions of a computer
More informationOverview. Introduction to the MIPS ISA. MIPS ISA Overview. Overview (2)
Introduction to the MIPS ISA Overview Remember that the machine only understands very basic instructions (machine instructions) It is the compiler s job to translate your high-level (e.g. C program) into
More informationInstructions: MIPS ISA. Chapter 2 Instructions: Language of the Computer 1
Instructions: MIPS ISA Chapter 2 Instructions: Language of the Computer 1 PH Chapter 2 Pt A Instructions: MIPS ISA Based on Text: Patterson Henessey Publisher: Morgan Kaufmann Edited by Y.K. Malaiya for
More informationArchitecture II. Computer Systems Laboratory Sungkyunkwan University
MIPS Instruction ti Set Architecture II Jin-Soo Kim (jinsookim@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu Making Decisions (1) Conditional operations Branch to a
More informationComputer Architecture. The Language of the Machine
Computer Architecture The Language of the Machine Instruction Sets Basic ISA Classes, Addressing, Format Administrative Matters Operations, Branching, Calling conventions Break Organization All computers
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 informationWe will study the MIPS assembly language as an exemplar of the concept.
MIPS Assembly Language 1 We will study the MIPS assembly language as an exemplar of the concept. MIPS assembly instructions each consist of a single token specifying the command to be carried out, and
More informationSABLEJIT: A Retargetable Just-In-Time Compiler for a Portable Virtual Machine p. 1
SABLEJIT: A Retargetable Just-In-Time Compiler for a Portable Virtual Machine David Bélanger dbelan2@cs.mcgill.ca Sable Research Group McGill University Montreal, QC January 28, 2004 SABLEJIT: A Retargetable
More informationComputer Organization and Structure. Bing-Yu Chen National Taiwan University
Computer Organization and Structure Bing-Yu Chen National Taiwan University Instructions: Language of the Computer Operations and Operands of the Computer Hardware Signed and Unsigned Numbers Representing
More informationMachine Instructions - II. Hwansoo Han
Machine Instructions - II Hwansoo Han Conditional Operations Instructions for making decisions Alter the control flow - change the next instruction to be executed Branch to a labeled instruction if a condition
More informationThe Assembly Language of the Boz 5
The Assembly Language of the Boz 5 The Boz 5 uses bits 31 27 of the IR as a five bit opcode. Of the possible 32 opcodes, only 26 are implemented. Op-Code Mnemonic Description 00000 HLT Halt the Computer
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 informationMIPS Instruction Set Architecture (2)
MIPS Instruction Set Architecture (2) Jinkyu Jeong (jinkyu@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu EEE3050: Theory on Computer Architectures, Spring 2017, Jinkyu
More informationCode Generation. The Main Idea of Today s Lecture. We can emit stack-machine-style code for expressions via recursion. Lecture Outline.
The Main Idea of Today s Lecture Code Generation We can emit stack-machine-style code for expressions via recursion (We will use MIPS assembly as our target language) 2 Lecture Outline What are stack machines?
More informationWe can emit stack-machine-style code for expressions via recursion
Code Generation The Main Idea of Today s Lecture We can emit stack-machine-style code for expressions via recursion (We will use MIPS assembly as our target language) 2 Lecture Outline What are stack machines?
More informationCSc 520 Principles of Programming Languages
CSc 520 Principles of Programming Languages 44: Interpreters Christian Collberg collberg@cs.arizona.edu Department of Computer Science University of Arizona Copyright c 2005 Christian Collberg [1] Compiler
More informationECE331: Hardware Organization and Design
ECE331: Hardware Organization and Design Lecture 15: Midterm 1 Review Adapted from Computer Organization and Design, Patterson & Hennessy, UCB Basics Midterm to cover Book Sections (inclusive) 1.1 1.5
More informationCENG3420 L03: Instruction Set Architecture
CENG3420 L03: Instruction Set Architecture Bei Yu byu@cse.cuhk.edu.hk (Latest update: January 31, 2018) Spring 2018 1 / 49 Overview Introduction Arithmetic & Logical Instructions Data Transfer Instructions
More informationCSCE 5610: Computer Architecture
HW #1 1.3, 1.5, 1.9, 1.12 Due: Sept 12, 2018 Review: Execution time of a program Arithmetic Average, Weighted Arithmetic Average Geometric Mean Benchmarks, kernels and synthetic benchmarks Computing CPI
More informationECE232: Hardware Organization and Design
ECE232: Hardware Organization and Design Lecture 4: Logic Operations and Introduction to Conditionals Adapted from Computer Organization and Design, Patterson & Hennessy, UCB Overview Previously examined
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 informationSPIM Instruction Set
SPIM Instruction Set This document gives an overview of the more common instructions used in the SPIM simulator. Overview The SPIM simulator implements the full MIPS instruction set, as well as a large
More informationMIPS ISA and MIPS Assembly. CS301 Prof. Szajda
MIPS ISA and MIPS Assembly CS301 Prof. Szajda Administrative HW #2 due Wednesday (9/11) at 5pm Lab #2 due Friday (9/13) 1:30pm Read Appendix B5, B6, B.9 and Chapter 2.5-2.9 (if you have not already done
More informationCOMP 303 Computer Architecture Lecture 3. Comp 303 Computer Architecture
COMP 303 Computer Architecture Lecture 3 Comp 303 Computer Architecture 1 Supporting procedures in computer hardware The execution of a procedure Place parameters in a place where the procedure can access
More informationMIPS Assembly Language Programming
MIPS Assembly Language Programming COE 308 Computer Architecture Prof. Muhamed Mudawar College of Computer Sciences and Engineering King Fahd University of Petroleum and Minerals Presentation Outline Assembly
More informationCSc 453. Compilers and Systems Software. 18 : Interpreters. Department of Computer Science University of Arizona. Kinds of Interpreters
CSc 453 Compiler source Lexer tokens Parser AST Compilers and Systems Software 18 : Interpreters VM Code Gen IR Interm. Code Gen AST Semantic Analyser Department of Computer Science University of Arizona
More informationCompiling Techniques
Lecture 10: An Introduction to MIPS assembly 18 October 2016 Table of contents 1 Overview 2 3 Assembly program template.data Data segment: constant and variable definitions go here (including statically
More informationCS3350B Computer Architecture MIPS Introduction
CS3350B Computer Architecture MIPS Introduction Marc Moreno Maza http://www.csd.uwo.ca/~moreno/cs3350_moreno/index.html Department of Computer Science University of Western Ontario, Canada Thursday January
More informationMIPS Assembly Language Programming
MIPS Assembly Language Programming ICS 233 Computer Architecture and Assembly Language Dr. Aiman El-Maleh College of Computer Sciences and Engineering King Fahd University of Petroleum and Minerals [Adapted
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 informationLecture 5: Procedure Calls
Lecture 5: Procedure Calls Today s topics: Memory layout, numbers, control instructions Procedure calls 1 Memory Organization The space allocated on stack by a procedure is termed the activation record
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 informationCSc 553. Principles of Compilation. 2 : Interpreters. Department of Computer Science University of Arizona
CSc 553 Principles of Compilation 2 : Interpreters Department of Computer Science University of Arizona collberg@gmail.com Copyright c 2011 Christian Collberg Compiler source Lexer tokens Parser AST VM
More informationMachine Language Instructions Introduction. Instructions Words of a language understood by machine. Instruction set Vocabulary of the machine
Machine Language Instructions Introduction Instructions Words of a language understood by machine Instruction set Vocabulary of the machine Current goal: to relate a high level language to instruction
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 informationLecture 4: MIPS Instruction Set
Lecture 4: MIPS Instruction Set No class on Tuesday Today s topic: MIPS instructions Code examples 1 Instruction Set Understanding the language of the hardware is key to understanding the hardware/software
More informationCS3350B Computer Architecture
CS3350B Computer Architecture Winter 2015 Lecture 4.1: MIPS ISA: Introduction Marc Moreno Maza www.csd.uwo.ca/courses/cs3350b [Adapted d from lectures on Computer Organization and Design, Patterson & Hennessy,
More informationWinter Compiler Construction T11 Activation records + Introduction to x86 assembly. Today. Tips for PA4. Today:
Winter 2006-2007 Compiler Construction T11 Activation records + Introduction to x86 assembly Mooly Sagiv and Roman Manevich School of Computer Science Tel-Aviv University Today ic IC Language Lexical Analysis
More informationLecture 7: Examples, MARS, Arithmetic
Lecture 7: Examples, MARS, Arithmetic Today s topics: More examples MARS intro Numerical representations 1 Dealing with Characters Instructions are also provided to deal with byte-sized and half-word quantities:
More informationCourse Administration
Fall 2017 EE 3613: Computer Organization Chapter 2: Instruction Set Architecture 2/4 Avinash Kodi Department of Electrical Engineering & Computer Science Ohio University, Athens, Ohio 45701 E-mail: kodi@ohio.edu
More informationChapter Two MIPS Arithmetic
Chapter Two MIPS Arithmetic Computer Organization Review Binary Representation Used for all data and instructions Fixed size values: 8, 16, 32, 64 Hexadecimal Sign extension Base and virtual machines.
More informationComputer Architecture Instruction Set Architecture part 2. Mehran Rezaei
Computer Architecture Instruction Set Architecture part 2 Mehran Rezaei Review Execution Cycle Levels of Computer Languages Stored Program Computer/Instruction Execution Cycle SPIM, a MIPS Interpreter
More informationLecture 6: Assembly Programs
Lecture 6: Assembly Programs Today s topics: Procedures Examples Large constants The compilation process A full example 1 Procedures Local variables, AR, $fp, $sp Scratchpad and saves/restores, $fp Arguments
More information7 Translation to Intermediate Code
7 Translation to Intermediate Code ( 7. Translation to Intermediate Code, p. 150) This chpater marks the transition from the source program analysis phase to the target program synthesis phase. All static
More informationIncremental Machine Descriptions for GCC
Incremental Machine Descriptions for GCC Sameera Deshpande Uday Khedker. (www.cse.iitb.ac.in/ {sameera,uday}) Department of Computer Science and Engineering, Indian Institute of Technology, Bombay September
More informationComputer Architecture
CS3350B Computer Architecture Winter 2015 Lecture 4.2: MIPS ISA -- Instruction Representation Marc Moreno Maza www.csd.uwo.ca/courses/cs3350b [Adapted from lectures on Computer Organization and Design,
More informationInstructions: Language of the Computer
CS359: Computer Architecture Instructions: Language of the Computer Yanyan Shen Department of Computer Science and Engineering 1 The Language a Computer Understands Word a computer understands: instruction
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 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 informationMIPS%Assembly% E155%
MIPS%Assembly% E155% Outline MIPS Architecture ISA Instruction types Machine codes Procedure call Stack 2 The MIPS Register Set Name Register Number Usage $0 0 the constant value 0 $at 1 assembler temporary
More informationECE468 Computer Organization & Architecture. MIPS Instruction Set Architecture
ECE468 Computer Organization & Architecture MIPS Instruction Set Architecture ECE468 Lec4.1 MIPS R2000 / R3000 Registers 32-bit machine --> Programmable storage 2^32 x bytes 31 x 32-bit GPRs (R0 = 0) 32
More informationMIPS Assembly Programming
COMP 212 Computer Organization & Architecture COMP 212 Fall 2008 Lecture 8 Cache & Disk System Review MIPS Assembly Programming Comp 212 Computer Org & Arch 1 Z. Li, 2008 Comp 212 Computer Org & Arch 2
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 informationECE232: Hardware Organization and Design. Computer Organization - Previously covered
ECE232: Hardware Organization and Design Part 6: MIPS Instructions II http://www.ecs.umass.edu/ece/ece232/ Adapted from Computer Organization and Design, Patterson & Hennessy, UCB Computer Organization
More informationCS 61c: Great Ideas in Computer Architecture
MIPS Instruction Formats July 2, 2014 Review New registers: $a0-$a3, $v0-$v1, $ra, $sp New instructions: slt, la, li, jal, jr Saved registers: $s0-$s7, $sp, $ra Volatile registers: $t0-$t9, $v0-$v1, $a0-$a3
More informationChapter 2. Instructions: Language of the Computer. HW#1: 1.3 all, 1.4 all, 1.6.1, , , , , and Due date: one week.
Chapter 2 Instructions: Language of the Computer HW#1: 1.3 all, 1.4 all, 1.6.1, 1.14.4, 1.14.5, 1.14.6, 1.15.1, and 1.15.4 Due date: one week. Practice: 1.5 all, 1.6 all, 1.10 all, 1.11 all, 1.14 all,
More informationReduced Instruction Set Computer (RISC)
Reduced Instruction Set Computer (RISC) Reduced Instruction Set Computer (RISC) Focuses on reducing the number and complexity of instructions of the machine. Reduced number of cycles needed per instruction.
More informationComputer Organization and Structure. Bing-Yu Chen National Taiwan University
Computer Organization and Structure Bing-Yu Chen National Taiwan University Instructions: Language of the Computer Operations and Operands of the Computer Hardware Signed and Unsigned Numbers Representing
More informationELEC / Computer Architecture and Design Fall 2013 Instruction Set Architecture (Chapter 2)
ELEC 5200-001/6200-001 Computer Architecture and Design Fall 2013 Instruction Set Architecture (Chapter 2) Victor P. Nelson, Professor & Asst. Chair Vishwani D. Agrawal, James J. Danaher Professor Department
More informationCS 61c: Great Ideas in Computer Architecture
MIPS Functions July 1, 2014 Review I RISC Design Principles Smaller is faster: 32 registers, fewer instructions Keep it simple: rigid syntax, fixed instruction length MIPS Registers: $s0-$s7,$t0-$t9, $0
More informationReduced Instruction Set Computer (RISC)
Reduced Instruction Set Computer (RISC) Focuses on reducing the number and complexity of instructions of the ISA. RISC Goals RISC: Simplify ISA Simplify CPU Design Better CPU Performance Motivated by simplifying
More informationCS 110 Computer Architecture MIPS Instruction Formats
CS 110 Computer Architecture MIPS Instruction Formats Instructor: Sören Schwertfeger http://shtech.org/courses/ca/ School of Information Science and Technology SIST ShanghaiTech University Slides based
More informationEN164: Design of Computing Systems Topic 03: Instruction Set Architecture Design
EN164: Design of Computing Systems Topic 03: Instruction Set Architecture Design Professor Sherief Reda http://scale.engin.brown.edu Electrical Sciences and Computer Engineering School of Engineering Brown
More informationCS3350B Computer Architecture MIPS Instruction Representation
CS3350B Computer Architecture MIPS Instruction Representation Marc Moreno Maza http://www.csd.uwo.ca/~moreno/cs3350_moreno/index.html Department of Computer Science University of Western Ontario, Canada
More informationMIPS Datapath. MIPS Registers (and the conventions associated with them) MIPS Instruction Types
1 Lecture 08 Introduction to the MIPS ISA + Procedure Calls in MIPS Longer instructions = more bits to address registers MIPS Datapath 6 bit opcodes... 2 MIPS Instructions are 32 bits More ways to address
More informationMIPS ISA. 1. Data and Address Size 8-, 16-, 32-, 64-bit 2. Which instructions does the processor support
Components of an ISA EE 357 Unit 11 MIPS ISA 1. Data and Address Size 8-, 16-, 32-, 64-bit 2. Which instructions does the processor support SUBtract instruc. vs. NEGate + ADD instrucs. 3. Registers accessible
More informationOrange Coast College. Business Division. Computer Science Department CS 116- Computer Architecture. The Instructions
Orange Coast College Business Division Computer Science Department CS 116- Computer Architecture The Instructions 1 1 Topics: Assembly language, assemblers MIPS R2000 Assembly language Instruction set
More informationECE 30 Introduction to Computer Engineering
ECE 30 Introduction to Computer Engineering Study Problems, Set #3 Spring 2015 Use the MIPS assembly instructions listed below to solve the following problems. arithmetic add add sub subtract addi add
More informationCode Generation. Lecture 19
Code Generation Lecture 19 Lecture Outline Topic 1: Basic Code Generation The MIPS assembly language A simple source language Stack-machine implementation of the simple language Topic 2: Code Generation
More informationECE 15B Computer Organization Spring 2010
ECE 15B Computer Organization Spring 2010 Dmitri Strukov Lecture 7: Procedures I Partially adapted from Computer Organization and Design, 4 th edition, Patterson and Hennessy, and classes taught by and
More informationCode Generation. Lecture 12
Code Generation Lecture 12 1 Lecture Outline Topic 1: Basic Code Generation The MIPS assembly language A simple source language Stack-machine implementation of the simple language Topic 2: Code Generation
More informationComputer Architecture. MIPS Instruction Set Architecture
Computer Architecture MIPS Instruction Set Architecture Instruction Set Architecture An Abstract Data Type Objects Registers & Memory Operations Instructions Goal of Instruction Set Architecture Design
More informationAssembly language Simple, regular instructions building blocks of C, Java & other languages Typically one-to-one mapping to machine language
Assembly Language Readings: 2.1-2.7, 2.9-2.10, 2.14 Green reference card Assembly language Simple, regular instructions building blocks of C, Java & other languages Typically one-to-one mapping to machine
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 informationEE 361 University of Hawaii Fall
C functions Road Map Computation flow Implementation using MIPS instructions Useful new instructions Addressing modes Stack data structure 1 EE 361 University of Hawaii Implementation of C functions and
More informationRun time environment of a MIPS program
Run time environment of a MIPS program Stack pointer Frame pointer Temporary local variables Return address Saved argument registers beyond a0-a3 Low address Growth of stack High address A translation
More information2.7 Supporting Procedures in hardware. Why procedures or functions? Procedure calls
2.7 Supporting Procedures in hardware Why procedures or functions? Procedure calls Caller: Callee: Proc save registers save more registers set up parameters do function call procedure set up results get
More informationNumbers: positional notation. CS61C Machine Structures. Faux Midterm Review Jaein Jeong Cheng Tien Ee. www-inst.eecs.berkeley.
CS 61C Faux Midterm Review (1) CS61C Machine Structures Faux Midterm Review 2002-09-29 Jaein Jeong Cheng Tien Ee www-inst.eecs.berkeley.edu/~cs61c/ Numbers: positional notation Number Base B B symbols
More informationMark Redekopp, All rights reserved. EE 357 Unit 11 MIPS ISA
EE 357 Unit 11 MIPS ISA Components of an ISA 1. Data and Address Size 8-, 16-, 32-, 64-bit 2. Which instructions does the processor support SUBtract instruc. vs. NEGate + ADD instrucs. 3. Registers accessible
More informationCS61C : Machine Structures
inst.eecs.berkeley.edu/~cs61c/su05 CS61C : Machine Structures Lecture #8: MIPS Procedures 2005-06-30 CS 61C L08 MIPS Procedures (1) Andy Carle Topic Outline Functions More Logical Operations CS 61C L08
More informationLecture 03 Bits, Bytes and Data Types
Lecture 03 Bits, Bytes and Data Types Computer Languages A computer language is a language that is used to communicate with a machine. Like all languages, computer languages have syntax (form) and semantics
More informationCS/COE0447: Computer Organization
CS/COE0447: Computer Organization and Assembly Language Chapter 2 Sangyeun Cho Dept. of Computer Science Five classic components I am like a control tower I am like a pack of file folders I am like a conveyor
More information