IT253: Computer Organization Lecture 4: Instruction Set Architecture Tonga Institute of Higher Education.

Slides:



Advertisements
Similar presentations
Chapter 2: Data Manipulation
Advertisements

Instruction Set Design
1 Lecture 3: MIPS Instruction Set Today’s topic:  More MIPS instructions  Procedure call/return Reminder: Assignment 1 is on the class web-page (due.
Goal: Write Programs in Assembly
Review of the MIPS Instruction Set Architecture. RISC Instruction Set Basics All operations on data apply to data in registers and typically change the.
Lecture 5: MIPS Instruction Set
ISA Issues; Performance Considerations. Testing / System Verilog: ECE385.
INSTRUCTION SET ARCHITECTURES
1 ECE462/562 ISA and Datapath Review Ali Akoglu. 2 Instruction Set Architecture A very important abstraction –interface between hardware and low-level.
Chapter 10- Instruction set architectures
1 ECE369 ECE369 Chapter 2. 2 ECE369 Instruction Set Architecture A very important abstraction –interface between hardware and low-level software –standardizes.
10/9: Lecture Topics Starting a Program Exercise 3.2 from H+P Review of Assembly Language RISC vs. CISC.
Chapter 2 Instructions: Language of the Computer
Fall EE 333 Lillevik 333f06-l4 University of Portland School of Engineering Computer Organization Lecture 4 Assembly language programming ALU and.
 Suppose for a moment that you were asked to perform a task and were given the following list of instructions to perform:
1 Today’s lecture  Last lecture we started talking about control flow in MIPS (branches)  Finish up control-flow (branches) in MIPS —if/then —loops —case/switch.
IT253: Computer Organization Lecture 6: Assembly Language and MIPS: Programming Tonga Institute of Higher Education.
Instruction Set Architecture
Instruction Set Architecture & Design
Computer Architecture CPSC 321 E. J. Kim. Overview Logical Instructions Shifts.
S. Barua – CPSC 440 CHAPTER 2 INSTRUCTIONS: LANGUAGE OF THE COMPUTER Goals – To get familiar with.
1 Lecture 2: MIPS Instruction Set Today’s topic:  MIPS instructions Reminder: sign up for the mailing list cs3810 Reminder: set up your CADE accounts.
Chapter 4 Processor Technology and Architecture. Chapter goals Describe CPU instruction and execution cycles Explain how primitive CPU instructions are.
Choice for the rest of the semester New Plan –assembler and machine language –Operating systems Process scheduling Memory management File system Optimization.
Lecture 5 Sept 14 Goals: Chapter 2 continued MIPS assembly language instruction formats translating c into MIPS - examples.
Data Transfer & Decisions I (1) Fall 2005 Lecture 3: MIPS Assembly language Decisions I.
Assembly & Machine Languages
IT253: Computer Organization Lecture 5: Assembly Language and an Introduction to MIPS Tonga Institute of Higher Education.
Lecture 4: MIPS Instruction Set Reminders: –Homework #1 posted: due next Wed. –Midterm #1 scheduled Friday September 26 th, 2014 Location: TODD 430 –Midterm.
1 Instruction Set Architecture (ISA) Alexander Titov 10/20/2012.
Module : Algorithmic state machines. Machine language Machine language is built up from discrete statements or instructions. On the processing architecture,
Lecture 4: MIPS Instruction Set
IT253: Computer Organization Lecture 9: Making a Processor: Single-Cycle Processor Design Tonga Institute of Higher Education.
CHAPTER 6 Instruction Set Architecture 12/7/
Computer Architecture CSE 3322 Lecture 3 Assignment: 2.4.1, 2.4.4, 2.6.1, , Due 2/3/09 Read 2.8.
9/29: Lecture Topics Conditional branch instructions
CS2100 Computer Organisation MIPS Part I: Introduction (AY2015/6) Semester 1.
Computer Organization Rabie A. Ramadan Lecture 3.
1 The Instruction Set Architecture September 27 th, 2007 By: Corbin Johnson CS 146.
The Instruction Set Architecture. Hardware – Software boundary Java Program C Program Ada Program Compiler Instruction Set Architecture Microcode Hardware.
Computer Organization Instructions Language of The Computer (MIPS) 2.
Assembly Variables: Registers Unlike HLL like C or Java, assembly cannot use variables – Why not? Keep Hardware Simple Assembly Operands are registers.
CSCI-365 Computer Organization Lecture Note: Some slides and/or pictures in the following are adapted from: Computer Organization and Design, Patterson.
Computer Architecture. Instruction Set “The collection of different instructions that the processor can execute it”. Usually represented by assembly codes,
CS2100 Computer Organisation
Computers’ Basic Organization
Computer Architecture Instruction Set Architecture
A Closer Look at Instruction Set Architectures
Instruction Set Architecture
Microprocessor Systems Design I
Microprocessor Systems Design I
Lecture 4: MIPS Instruction Set
RISC Concepts, MIPS ISA Logic Design Tutorial 8.
Prof. Sirer CS 316 Cornell University
Instructions - Type and Format
Lecture 4: MIPS Instruction Set
The University of Adelaide, School of Computer Science
Instruction encoding We’ve already seen some important aspects of processor design. A datapath contains an ALU, registers and memory. Programmers and compilers.
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.
COMS 361 Computer Organization
Prof. Sirer CS 316 Cornell University
COMS 361 Computer Organization
Instruction encoding We’ve already seen some important aspects of processor design. A datapath contains an ALU, registers and memory. Programmers and compilers.
Instructions in Machine Language
COMS 361 Computer Organization
CPU Structure CPU must:
Lecture 4: Instruction Set Design/Pipelining
Microprocessor Architecture
Instruction Set Architecture
Presentation transcript:

IT253: Computer Organization Lecture 4: Instruction Set Architecture Tonga Institute of Higher Education

Instruction Set Architecture: ISA

Instruction Set Architecture The ISA describes the level of the hardware/software interface. A level which was developed before any other level. It is the way to communicate between hardware and software An ISA describes the instructions that are able to execute simple commands on a processor

ISA When you compile a program, it changes your source code into a list of instructions which work on your processor type There are many types of ISA’s used. Each processor has their own ISA We will learn a type of ISA called MIPS, which is used by many schools to teach, and also by many types of processors in use.

ISA The ISA level is used to go between high level languages and hardware. People who make processors talk to people who make compilers to decide what the ISA should be like. Two important issues to consider in ISA design –Can the set of instructions be implemented efficiently –Will it be easy for chip designers and compiler designers

Thinking about ISAs Requirements for an ISA What operations do we need? What should be made in Hardware? int x = 5; for (int k = 0; k < 15; k++) { System.out.println(k); } if (x > k) { int [] array = new int[5]; } int z = (x | 7) / 56;

Design for an ISA What do we need for a good ISA? –Operations (add, subtract,multiply) –Explicit operands (constants – 1,2,3) –Storage (where the variables live) –Memory Address (how we get to variables) –Type of variable (int, double) This means we need, –Arithmetic and logic instructions –Data transfer instructions (load, store) –Control transfer (getting to different places in the program)

ISA Interface An ISA is a way to define an interface – a way for the software to run on the hardware A good interface will last a long time –Efficient –Used in different ways (versatile) –Easy to use

Typical ISA interface

Efficiency in instructions For a simple command like C = A + B What instructions to we need to go through

A two address ISA A 2 address ISA uses two explicit operands, and one implicit. That means that the commands look like: add tmp1,a -- In ISA tmp1 = tmp1 + a -- in high level

A three address ISA An ISA with three explicit operands.

Using Registers Registers are memory inside the processor that is used to store variables the CPU is currently working with It is where the numbers for operations like add and subtract are stored All computers use registers They are very fast because they exist on the CPU. In fact, there could be no CPU without the registers

Registers A register is a place to hold variables needed for an instruction Like memory, but much smaller. Usually there are 32, 32-bit registers. Each register will use 32 bits to save data Sometimes there are special registers for floating point numbers

3 Address ISA with Registers Just like 3 address ISA, but now we can use registers instead of saying each variable

A Load/Store ISA We have seen an “add” instruction. It is similar for subtracting, multiplying, dividing What if we need to use memory? Load and store commands allow a programmer to move data to and from memory. It is the only way to actually use memory in order to save data for a longer period of time Memory in this case means the cache, RAM or virtual memory

Load/Store ISA Example of Load and Storing ISA commands

Registers Registers can hold data like integers. This means they can also hold addresses of memory (an address is an integer, like a pointer)

Control Operations "Control flow" is the word used to describe the order the instructions are executed in You can change the order with if/else, for loops and functions (methods) int main() { cout << “hello” << endl; int x = GetNumber(); cout << x << endl; } int GetNumber() { return 7; } public static void main(String[] args) { System.out.println(“hello”); int x = GetNumber(); System.out.println(x); } public static int GetNumber() { return 7; }

Control Operations If there is a function, the “control flow” of the program changes. The program jumps out of "int main()" and into "int GetNumber()" You can also change control flow with conditionals (if statements), loops (for and while)

Control Flow: Conditionals It is a very common action to compare two values and take action on the result if (x == 6) { then do this; } else if (x == 7) { do that; } This is called a “branch” statement. It is also known as a conditional. It is also an if statement. Know all those names!

Control Flow: Example C++/: if (a == b) { Java c = 1; } else { c = 2; } MIPS: // we assume $s1 = a, $s2 = b, $s3 = c beq $s1, $s2, then // if a==b goto “then” li $s3,2 // c = 2; j done // jump to done then: li $s3,1 // then c = 1; done: // exit program

ISA Commands we need

ISA We have seen typical 2 and 3 address instruction set architectures. These were only examples of the form of an ISA. A real ISA, like MIPS, will fill in the missing details An ISA needs registers, operands and operations It needs operations like add, load and store It needs control operations like jumps and branching

ISA But all these are only commands written in text. A CPU can only understand binary The key to this problem is that an ISA can be directly translated into binary. This means each instruction has a special binary code. Each register has a special binary code

Making instructions machine readable Programmers are able to read and write commands like the following (in text) –add r1,r2,6 A processor needs a series of bits to work with The goal is to translate an instruction to a 32 bit binary number. It will be like floating point, where certain parts of the instruction are saved in certain parts of the 32 bit integer

Examples of this translation

Machine Codes

Machine Code Let’s look at one example of the machine code translation Op: This is where we tell whether it is a add, subtract, load, store, and so on. There is a special binary code for each operation Since it is a 6 bit field, we have 6 bits to save the code. For example: Add = Rs1 = the address of the first register (choose 1 out of 32) Rd = the address of the register of the destination Immediate = a constant integer value

Summary for ISA ISA is the language that computers use to allow software to communicate with hardware We need certain types of instructions to make a complete ISA These instructions will perform operations, load memory, execute conditionals Once we have an ISA, the computer must convert each instruction to a machine readable format (it has to be binary!) This is our introduction for the MIPS ISA