Computer Organization Rabie A. Ramadan Lecture 3.

Slides:



Advertisements
Similar presentations
Henk Corporaal TUEindhoven 2011
Advertisements

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
1 ECE462/562 ISA and Datapath Review Ali Akoglu. 2 Instruction Set Architecture A very important abstraction –interface between hardware and low-level.
1 ECE369 ECE369 Chapter 2. 2 ECE369 Instruction Set Architecture A very important abstraction –interface between hardware and low-level software –standardizes.
CS1104 – Computer Organization PART 2: Computer Architecture Lecture 5 MIPS ISA & Assembly Language Programming.
ELEN 468 Advanced Logic Design
Chapter 2 Instructions: Language of the Computer
Chapter 2.
Datorteknik DatapathControl bild 1 Designing a Single Cycle Datapath & Datapath Control.
Chapter 2 Instructions: Language of the Computer Part III.
MIPS Architecture CPSC 321 Computer Architecture Andreas Klappenecker.
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.
The Processor 2 Andreas Klappenecker CPSC321 Computer Architecture.
Lecture 5 Sept 14 Goals: Chapter 2 continued MIPS assembly language instruction formats translating c into MIPS - examples.
Computer Architecture - The Instruction Set The Course’s Goals  To be interesting and fun. An interested student learns more.  To answer questions that.
ECE 4436ECE 5367 ISA I. ECE 4436ECE 5367 CPU = Seconds= Instructions x Cycles x Seconds Time Program Program Instruction Cycle CPU = Seconds= Instructions.
ECE 232 L5 Assembl.1 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers ECE 232 Hardware Organization and Design Lecture 5 MIPS Assembly.
CS 300 – Lecture 6 Intro to Computer Architecture / Assembly Language Instructions.
MIPS Instruction Set Advantages
ISA-2 CSCE430/830 MIPS: Case Study of Instruction Set Architecture CSCE430/830 Computer Architecture Instructor: Hong Jiang Courtesy of Prof. Yifeng Zhu.
IT253: Computer Organization Lecture 4: Instruction Set Architecture Tonga Institute of Higher Education.
CSE331 W02.1Irwin Fall 2001 PSU Computer Architecture Discussion Lecture # 2 MIPS Programming.
Memory and Addressing How and Where Information is Stored.
Computer Architecture Instruction Set Architecture Lynn Choi Korea University.
1  1998 Morgan Kaufmann Publishers Machine Instructions: Language of the Machine Lowest level of programming, control directly the hardware Assembly instructions.
6.S078 - Computer Architecture: A Constructive Approach Introduction to SMIPS Li-Shiuan Peh Computer Science & Artificial Intelligence Lab. Massachusetts.
Module : Algorithmic state machines. Machine language Machine language is built up from discrete statements or instructions. On the processing architecture,
Computer Organization and Architecture Instructions: Language of the Machine Hennessy Patterson 2/E chapter 3. Notes are available with photocopier 24.
Computer Architecture CSE 3322 Lecture 2 NO CLASS MON Sept 1 Course WEB SITE crystal.uta.edu/~jpatters.
Computer Architecture (CS 207 D) Instruction Set Architecture ISA.
Computer Organization & Programming Chapter 6 Single Datapath CPU Architecture.
 1998 Morgan Kaufmann Publishers MIPS arithmetic All instructions have 3 operands Operand order is fixed (destination first) Example: C code: A = B +
Computer Architecture CSE 3322 Lecture 3 Assignment: 2.4.1, 2.4.4, 2.6.1, , Due 2/3/09 Read 2.8.
MS108 Computer System I Lecture 3 ISA Prof. Xiaoyao Liang 2015/3/13 1.
CENG 311 Instruction Representation
EE472 – Spring 2007P. Chiang, with Slide Help from C. Kozyrakis (Stanford) ECE472 Computer Architecture Lecture #3—Oct. 2, 2007 Patrick Chiang TA: Kang-Min.
DR. SIMING LIU SPRING 2016 COMPUTER SCIENCE AND ENGINEERING UNIVERSITY OF NEVADA, RENO Session 7, 8 Instruction Set Architecture.
DR. SIMING LIU SPRING 2016 COMPUTER SCIENCE AND ENGINEERING UNIVERSITY OF NEVADA, RENO Session 11 Conditional Operations.
Instruction Set Architecture Chapter 3 – P & H. Introduction Instruction set architecture interface between programmer and CPU Good ISA makes program.
Computer Architecture Instruction Set Architecture
MIPS Instruction Set Advantages
COMPUTER ARCHITECTURE & OPERATIONS I
Instruction Set Architecture
Computer Architecture Instruction Set Architecture
/ Computer Architecture and Design
ELEN 468 Advanced Logic Design
RISC Concepts, MIPS ISA Logic Design Tutorial 8.
Computer Architecture (CS 207 D) Instruction Set Architecture ISA
CS170 Computer Organization and Architecture I
Instructions - Type and Format
Lecture 4: MIPS Instruction Set
Systems Architecture I (CS ) Lecture 5: MIPS Instruction Set*
Henk Corporaal TUEindhoven 2010
MIPS Instruction Encoding
The University of Adelaide, School of Computer Science
ECE232: Hardware Organization and Design
September 24 Test 1 review More programming
Rocky K. C. Chang 6 November 2017
MIPS Instruction Encoding
COMS 361 Computer Organization
COMP541 Datapaths I Montek Singh Mar 18, 2010.
COMS 361 Computer Organization
COMS 361 Computer Organization
Review Fig 4.15 page 320 / Fig page 322
Datapath and Control Exceptions
MIPS Assembly.
Systems Architecture I (CS ) Lecture 5: MIPS Instruction Set*
Presentation transcript:

Computer Organization Rabie A. Ramadan Lecture 3

2 Instruction Set Architecture (ISA)

MIPS Processor 3

CPU: 64-bit program counter – PC; two 64-bit registers – Hi & Lo, hold results of integer multiply and divide bit general purpose registers – GPRs ( s0 – s31); Floating Point Processor – FPU (Coprocessor 1 – CP1): bit floating point registers – FPRs (f0 – f31); five control registers; Coprocessor 0 – CP0 is incorporated on the MIPS CPU chip and it provides functions necessary to support operating system: exception handling, memory management scheduling and control of critical resources.

MIPS Processor Coprocessor 0 (CP0) registers (partial list): Status register (CP0reg12) – processor status and control; Cause register (CP0reg13) – cause of the most recent exception; EPC register (CP0reg14) – program counter at the last exception; BadVAddr register (CP0reg08) – the address for the most recent address related exception; Count register (CP0reg09) – acts as a timer, incrementing at a constant rate that is a function of the pipeline clock; Compare register (CP0reg11) – used in conjunction with Count register; Performance Counter register ( CP0reg25 );

Registers vs. Memory Arithmetic instruction operands must be registers, — only 32 registers provided Compiler associates variables with registers CPU Memory IO register file

Main Memory Model (Cont.) 7

Main Memory Model 8 Millions of cells Word An entity that can be written to or read from the memory. Each word requires an address.

Word Addressing 9 Given M words, how many bits l are required to address them? Example: to address 64 MB, we need

Memory Organization Viewed as a large, single-dimension array, with an address A memory address is an index into the array "Byte addressing" means that successive addresses are one byte apart bits of data

MIPS Memory Organization Bytes are nice, but most data items use larger "words" For MIPS, a word is 32 bits or 4 bytes bits of data Registers hold 32 bits of data

Main Types of Instructions Arithmetic Integer Floating Point Memory access instructions Load & Store Control flow Jump Conditional Branch Call & Return

MIPS arithmetic Most instructions have 3 operands Operand order is fixed (destination first) Example 1 : Java code: A = B + C MIPS code: add $s0, $s1, $s2 Example 2: Java code: A = B + C + D; E = F - A; MIPS code: add $t0, $s1, $s2 add $s0, $t0, $s3 sub $s4, $s5, $s0

Instructions: load and store Example: Java code:A[8] = h + A[8]; MIPS code:lw $t0, 32($s3) add $t0, $s2, $t0 sw $t0, 32($s3) $s3 is the base register + 32 offset  A[8] Remember arithmetic operands are registers, not memory! bits of data

Instructions Format Instructions, like registers and words of data, are also 32 bits long Example: add $t0, $s1, $s2 Registers have numbers: $t0=9, $s1=17, $s2=18 Instruction Format: 6 bits 5 bits 6 bits5 bits op rs rt rd shamt funct Can you guess what the field names stand for?

Instructions Format R format -- arithmetic and logic instructions op -- operation of the instructions rs -- first source register number rt -- second source register rd -- destination register shamt -- shift amount ( This field is set to 0 in all but the shift instructions. ) funct -- additional specification of operation (add, sub,..) 6 bits 5 bits 6 bits5 bits op rs rt rd shamt funct Why two fields (op and funct)?

Instructions: Control Flow Decision making instructions alter the control flow, i.e., change the "next" instruction to be executed MIPS conditional branch instructions: bne $t0, $t1, Label beq $t0, $t1, Label Example: if (i==j) h = i + j; bne $s0, $s1, Label add $s3, $s0, $s1 Label:....

Instructions Format Consider the load-word and store-word instructions, Introduce a new type of instruction format I-type for register – Load and control Example: lw $t0, 32($s2) op -- operation code rs -- register source rt -- used as destination register in this format address bit constant for addressing instructions in this class use at most two registers this is how to get constants into the registers Only one field for the operation (op). Therefore, All formats are consistent.

Example Mapping is straightforward addi uses the I format (immediate) Generally one to one correspondence Straightforward translation

Instructions: Unconditional Branch MIPS unconditional branch instructions: j label Example: if (i!=j) beq $s4, $s5, Lab1 h=i+j; add $s3, $s4, $s5 else j Lab2 h=i-j;Lab1:sub $s3, $s4, $s5 Lab2:... Is there any Operands in the Jump instructions ? J Instructions Format:

MIPS Instruction Formats Summary Instructions, like registers and words of data, are also 32 bits long R format -- arithmetic and logic instructions I format -- transfer and branch instructions J format -- jump instructions OP rs rt rdsafunct rs rt immediate target 6 bits5 bits 6 bits R format I format J format

23 MIPS addressing modes The operand is constant within the instruction itself Operand is a register The operand is at the memory location whose address is the sum of a register and a constant in the instruction The address is the sum of the Pc and constant in the instruction Jump Address is 26 bits (inst) concatenated with upper PC bits