ITEC 352 Lecture 20 JVM Intro. Functions + Assembly Review Questions? Project due today Activation record –How is it used?

Slides:



Advertisements
Similar presentations
ITEC 352 Lecture 13 ISA(4).
Advertisements

Instruction Set Design
Goal: Write Programs in Assembly
ITEC 352 Lecture 14 ISA(5). Review Questions? Exam 1 next Friday Assembly –Assembler –Basic structure –Registers –Memory.
Dr. Ken Hoganson, © August 2014 Programming in R COURSE NOTES 2 Hoganson Language Translation.
Chapter 2 Instructions: Language of the Computer
Chapter 2.
ITCS 3181 Logic and Computer Systems 2015 B. Wilkinson slides3.ppt Modification date: March 16, Addressing Modes The methods used in machine instructions.
1 Registers and MAL - Part I. Motivation So far there are some details that we have ignored instructions can have different formats most computers have.
Instruction Set Architecture & Design
11/11/05ELEC CISC (Complex Instruction Set Computer) Veeraraghavan Ramamurthy ELEC 6200 Computer Architecture and Design Fall 2005.
CS 300 – Lecture 6 Intro to Computer Architecture / Assembly Language Instructions.
ITEC 352 Lecture 11 ISA - CPU. ISA (2) Review Questions? HW 2 due on Friday ISA –Machine language –Buses –Memory.
4-1 Chapter 4 - The Instruction Set Architecture Computer Architecture and Organization by M. Murdocca and V. Heuring © 2007 M. Murdocca and V. Heuring.
Instruction Set Architecture
IT253: Computer Organization Lecture 4: Instruction Set Architecture Tonga Institute of Higher Education.
4-1 Chapter 4 - The Instruction Set Architecture Department of Information Technology, Radford University ITEC 352 Computer Organization Principles of.
ITEC 352 Lecture 12 ISA(3). Review Buses Memory ALU Registers Process of compiling.
5-1 Chapter 5 - Languages and the Machine Department of Information Technology, Radford University ITEC 352 Computer Organization Principles of Computer.
4-1 Chapter 4 - The Instruction Set Architecture Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring Principles.
6-1 Chapter 6 - Languages and the Machine Computer Architecture and Organization by M. Murdocca and V. Heuring © 2007 M. Murdocca and V. Heuring Computer.
5-1 Chapter 5 - Languages and the Machine Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring Principles.
Chapter 2-2 Assembly Instructions Number Systems Number Systems Assembly Instructions Assembly Instructions Branch Branch Next Lecture Next Lecture  Addressing.
5-1 Chapter 5 - Languages and the Machine Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring Principles.
4-1 Chapter 4 - The Instruction Set Architecture Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring Principles.
Computer Architecture and Organization
Lecture 11: 10/1/2002CS170 Fall CS170 Computer Organization and Architecture I Ayman Abdel-Hamid Department of Computer Science Old Dominion University.
Computer Organization
More on MIPS programs n SPIM does not support everything supported by a general MIPS assembler. For example, –.end doesn’t work Use j $ra –.macro doesn’t.
Instruction Sets: Addressing modes and Formats Group #4  Eloy Reyes  Rafael Arevalo  Julio Hernandez  Humood Aljassar Computer Design EEL 4709c Prof:
ITEC 352 Lecture 19 Functions in Assembly. Functions + Assembly Review Questions? Project due on Friday Stacks Function activation / deactivation.
Our programmer needs to do this !
1 The Instruction Set Architecture September 27 th, 2007 By: Corbin Johnson CS 146.
Addressing Modes and Formats
What is a program? A sequence of steps
RISC / CISC Architecture by Derek Ng. Overview CISC Architecture RISC Architecture  Pipelining RISC vs CISC.
Instruction Sets: Characteristics and Functions  Software and Hardware interface Machine Instruction Characteristics Types of Operands Types of Operations.
Representation of Data Binary Representation of Instructions teachwithict.weebly.com.
Computer Architecture & Operations I
Displacement (Indexed) Stack
A Closer Look at Instruction Set Architectures
Alvaro Mauricio Peña Dariusz Niworowski Frank Rodriguez
A Closer Look at Instruction Set Architectures
Computer Architecture and Organization Miles Murdocca and Vincent Heuring Chapter 4 – The Instruction Set Architecture.
William Stallings Computer Organization and Architecture 8th Edition
Instruction Set Architectures
Lecture 4: MIPS Instruction Set
Computer Organization and ASSEMBLY LANGUAGE
Systems Architecture I (CS ) Lecture 5: MIPS Instruction Set*
CSCI206 - Computer Organization & Programming
The University of Adelaide, School of Computer Science
ECEG-3202 Computer Architecture and Organization
ECEG-3202 Computer Architecture and Organization
Classification of instructions
Other ISAs Next, we’ll first we look at a longer example program, starting with some C code and translating it into our assembly language. Then we discuss.
Other ISAs Next, we’ll first we look at a longer example program, starting with some C code and translating it into our assembly language. Then we discuss.
ECEG-3202 Computer Architecture and Organization
COMS 361 Computer Organization
Addressing mode summary
COMS 361 Computer Organization
Instruct Set Architecture Variations
Systems Architecture I (CS ) Lecture 5: MIPS Instruction Set*
Chapter 10 Instruction Sets: Characteristics and Functions
Presentation transcript:

ITEC 352 Lecture 20 JVM Intro

Functions + Assembly Review Questions? Project due today Activation record –How is it used?

Functions + Assembly Outline Functions in assembly Intro to JVM

Functions + Assembly Java Virtual Machine Architecture

Functions + Assembly

A Java Class File

Functions + Assembly A Java Class File (2)

Functions + Assembly A Java Class File (Cont’) Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring 0 bipush: push into stack Istore_1: pop the top of the stack and store the value in local variable at index “1”. Background: local variables are converted into array indices. iload_1: push the value at array index 1 into stack.

Functions + Assembly Byte Code LocationCodeMnemonicMeaning 0x00e30x10bipushPush next byte onto stack 0x00e40x0f15Argument to bipush 0x00e50x3cistore_1Pop stack to local variable 1 0x00e60x10bipushPush next byte onto stack 0x00e70x099Argument to bipush 0x00e80x3distore_2Pop stack to local variable 2 0x00e90x03iconst_0Push 0 onto stack 0x00ea0x3eistore_3Pop stack to local variable 3 0x00eb0x1biload_1Push local variable 1 onto stack 0x00ec0x1ciload_2Push local variable 2 onto stack 0x00ed0x60iaddAdd top two stack elements 0x00ee0x3eistore_3Pop stack to local variable 3 0x00ef0xb1returnReturn

Functions + Assembly Assembly process Translation of Assembly code into Machine language. Recall: –Every assembly instruction is represented as a 32 bit machine instruction. –Since there are different types of assembly instructions (e.g., arithmetic instructions, branch instructions etc.), There are also different way of using the 32 bits to represent machine instructions. –These different ways of packing 32 bits of machine code are called Instruction formats.

Functions + Assembly Examples Consider the following two usages of the load (ld) instruction: ld [x], %r1 Meaning: Load from a memory address specified as a constant value (in this case x) plus the contents of register %r0 into register %r1. ld %r1, %r2, %r3 Meaning: Load from memory address obtained by adding the values of registers %r1 and %r2 into the register %r3 In the first instruction we are using a constant value (memory address x). Whereas in the second we are using registers. Hence, there are two memory instruction formats in Machine code. (on next slide)

Functions + Assembly Memory instruction formats in machine code Instruction ld %r1, %r2, %r3 is represented as follows: rd: Destination register (%r3) ; op3: ld (11), rs1: first source register (%r1), rs2: second source register. Instruction ld [x], %r1 is represented as follows: rd: Destination register (%r1) ; op3: ld (11), rs1: first source register (%r0 ) (Here, %r0 is assumed to be there implicitly) simm13: address “x”. This should fit into 13 bits.

Functions + Assembly Complete ARC Instruction and PSR Formats Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring

Assembly to machine code translation Given an instruction: ld [x], %r1 The assembly process pattern matches this instruction with machine formats to obtain the machine code. E.g., After it sees the instruction, it maps it to the second memory format (the one with simm13). It then converts the instruction as follows: ldop3: 11 (op3 = 11) [x]simm13: Memory address x. If.org 2048, then x = In binary = %r0rs1 ( source register) (address = 00000) 5 bits to address a register. %r1rd (destination register) (address = 00001) Other fields: In the previous slide, notice that there is an “i” field to distinguish between the two memory formats. Here, i = 1.

Functions + Assembly Assembledcod e. ld: opcode: 11 rd: destination register: 000`1 op3: rs1: i: 1 This is the instruction we just looked at. The right side represents machine code. ld [x], %r These are some other assembled instructions. ld [y], %r addcc %r1,%r2,%r st %r3, [z] jmpl %r15+4, %r

Functions + Assembly Next. We just looked at how to convert Assembly into Machine code. Next: We will briefly look at the steps to convert a high level program into assembly.

Functions + Assembly Summary so far … We looked at –Stages of a compiler (briefly) –Assembly instructions –Translating assembly into machine code … Next: speeding up processing …

Functions + Assembly CPU Performanc e E.g., will a 4.1 Ghz CPU be faster than a 2.0 Ghz CPU? –So is the CPU cycle time a measure of performance? How about amount of cache? Anything else? Next: performance due to pipelining.

Functions + Assembly Pipelining Speeding up the computation process Complex and Reduced Instruction Sets: Complex Instruction Set Computer (CISC) Reduced Instruction Set Computer (RISC) Next: the differences?

Functions + Assembly CISC Vs. RISC A long time back when memory costed –The focus of most computer architects (E.g., Intel and Motorola) Support fewer instructions that performed more complicated computations. E.g., addld [a], [b], [c] would be a complex instruction that replaced: ld [a], %r1 ld [b], %r2 addcc %r1, %r2, %r3 st %r3, [c] Why? Complex instructions  Shorter programs  Smaller memory needed. However, memory became cheaper. So architects started thinking about techniques to use more memory that would speed up computations.

Functions + Assembly Review JVM + Bytecode