Fall 2006 1 EE 333 Lillevik 333f06-l5 University of Portland School of Engineering Computer Organization Lecture 5 MIPS Instructions Loops Machine Instructions.

Slides:



Advertisements
Similar presentations
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.
Advertisements

Goal: Write Programs in Assembly
Lecture 5: MIPS Instruction Set
CS/COE0447 Computer Organization & Assembly Language
1 ECE462/562 ISA and Datapath Review Ali Akoglu. 2 Instruction Set Architecture A very important abstraction –interface between hardware and low-level.
10/9: Lecture Topics Starting a Program Exercise 3.2 from H+P Review of Assembly Language RISC vs. CISC.
CIS 314 Fall 2005 MIPS Datapath (Single Cycle and Multi-Cycle)
CS1104 – Computer Organization PART 2: Computer Architecture Lecture 5 MIPS ISA & Assembly Language Programming.
ELEN 468 Advanced Logic Design
Fall EE 333 Lillevik 333f06-l4 University of Portland School of Engineering Computer Organization Lecture 4 Assembly language programming ALU and.
Fall EE 333 Lillevik333f06-a1 University of Portland School of Engineering EE 333 Exam 1 September 28, 2006 Instructions 1.Print your name, student.
Datorteknik DatapathControl bild 1 Designing a Single Cycle Datapath & Datapath Control.
Chapter 2 Instructions: Language of the Computer Part III.
Comp Sci instruction encoding 1 Instruction Encoding MIPS machine language Binary encoding of instructions MIPS instruction = 32 bits Three instruction.
MIPS Architecture CPSC 321 Computer Architecture Andreas Klappenecker.
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.
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.
Instruction Representation I (1) Fall 2005 Lecture 05: INSTRUCTION REPRESENTATION.
Processor I CPSC 321 Andreas Klappenecker. Midterm 1 Thursday, October 7, during the regular class time Covers all material up to that point History MIPS.
CS 300 – Lecture 6 Intro to Computer Architecture / Assembly Language Instructions.
MIPS Instruction Set Advantages
CMPT 334 Computer Organization
1 CS/COE0447 Computer Organization & Assembly Language Chapter 2 Part 1 In-Class Lab Session (Lab 2)
Fall EE 333 Lillevik 333f06-l7 University of Portland School of Engineering Computer Organization Lecture 7 ALU design MIPS data path.
Fall EE 333 Lillevik 333f06-l8 University of Portland School of Engineering Computer Organization Lecture 8 Detailed MIPS datapath Timing overview.
Lecture 4: MIPS Instruction Set
Computer Architecture CSE 3322 Lecture 2 NO CLASS MON Sept 1 Course WEB SITE crystal.uta.edu/~jpatters.
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
Chapter 2 CSF 2009 The MIPS Assembly Language. Stored Program Computers Instructions represented in binary, just like data Instructions and data stored.
Computer Organization Rabie A. Ramadan Lecture 3.
CENG 311 Instruction Representation
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.
DR. SIMING LIU SPRING 2016 COMPUTER SCIENCE AND ENGINEERING UNIVERSITY OF NEVADA, RENO Session 9 Binary Representation and Logical Operations.
Computer Organization Instructions Language of The Computer (MIPS) 2.
CS Computer Organization Numbers and Instructions Dr. Stephen P. Carl.
COMPUTER ARCHITECTURE & OPERATIONS I Instructor: Yaohang Li.
MIPS Instruction Set Advantages
COMPUTER ARCHITECTURE & OPERATIONS I
EE 333 Exam 1 September 29, 2005 Answers Instructions Name Student ID
Morgan Kaufmann Publishers
Introduction CPU performance factors
MIPS Coding Continued.
Lecture 4: MIPS Instruction Set
ELEN 468 Advanced Logic Design
RISC Concepts, MIPS ISA Logic Design Tutorial 8.
CS170 Computer Organization and Architecture I
Lecture 4: MIPS Instruction Set
CS/COE0447 Computer Organization & Assembly Language
The University of Adelaide, School of Computer Science
Computer Architecture & Operations I
MIPS Instruction Encoding
The University of Adelaide, School of Computer Science
ECE232: Hardware Organization and Design
MIPS Instruction Encoding
Instruction encoding The ISA defines Format = Encoding
COMS 361 Computer Organization
Computer Instructions
Instruction encoding The ISA defines Format = Encoding
COMP541 Datapaths I Montek Singh Mar 18, 2010.
COMS 361 Computer Organization
COMS 361 Computer Organization
Instruction encoding The ISA defines Format = Encoding
Instruction encoding The ISA defines Format = Encoding
MIPS Coding Continued.
COMS 361 Computer Organization
Presentation transcript:

Fall EE 333 Lillevik 333f06-l5 University of Portland School of Engineering Computer Organization Lecture 5 MIPS Instructions Loops Machine Instructions

Fall EE 333 Lillevik 333f06-l5 University of Portland School of Engineering Last time MIPS assembly language Arithmetic and logic instructions Load and store instructions

Fall EE 333 Lillevik 333f06-l5 University of Portland School of Engineering Write the program?

Fall EE 333 Lillevik 333f06-l5 University of Portland School of Engineering Lets run the program

Fall EE 333 Lillevik 333f06-l5 University of Portland School of Engineering Instruction Classes Arithmetic and logic (some more) Load: li, la, lbu, lw Store: sb, sw Comparison Branch and jump Data Movement Floating Point √ √

Fall EE 333 Lillevik 333f06-l5 University of Portland School of Engineering Arithmetic and Logic InstructionExampleMeaning Andand $s1, $s2, $s3$s1 = $s2 & $s3 And immediateandi $s1, $s2, 100$s1 = $s2 & 100 Oror $s1, $s2, $s3$s1 = $s2 | $s3 Or immediateori $s1, $s2, 100$s1 = $s2 | 100 Shift left logicalsll $s1, $s2, 10$s1 = $s2 << 10 Shift right logicalsrl $s1, $s2, 10$s1 = $s2 >> 10 Only registers used for operands

Fall EE 333 Lillevik 333f06-l5 University of Portland School of Engineering Instruction Classes Arithmetic and logic: add, sub, and, or Load: li, la, lbu, lw Store: sb, sw Comparison Branch and jump Data Movement Floating Point √ √ √

Fall EE 333 Lillevik 333f06-l5 University of Portland School of Engineering Branch and Jump InstructionExampleMeaning Branch on equalbeq $s1, $s2, 100If ($s1 = = $s2 ) go to (PC +4 )+ 100 Branch on not equalbne $s1, $s2, 100If ($s1 ! = $s2 ) go to (PC +4 )+ 100 Jumpj loopGo to loop: Jump and linkjal subroutine$ra = PC + 4, go to subroutine Jump Registerjr $raPC = $ra

Fall EE 333 Lillevik 333f06-l5 University of Portland School of Engineering Loops in assembly Initialize loop counter Modify counter (decrement, increment) Check if counter = = end condition –True, leave loop –False, continue with loop Body of loop Continue with next pass in loop

Fall EE 333 Lillevik 333f06-l5 University of Portland School of Engineering Flowchart of loop count = 5 count -- count = = 0 ? Body of loop no yes Body could go ahead of test

Fall EE 333 Lillevik 333f06-l5 University of Portland School of Engineering Loops NOTE: you may place the check after the body How many times is “body” executed? (4 or 5?

Fall EE 333 Lillevik 333f06-l5 University of Portland School of Engineering Lets run the program

Fall EE 333 Lillevik 333f06-l5 University of Portland School of Engineering Write the program? Write a loop that adds 4 to $t2, six times

Fall EE 333 Lillevik 333f06-l5 University of Portland School of Engineering Machine Instructions Definition: numeric (hex) versions of instruction Memory: contains binary number or machine instruction, it’s what the hardware executes Formats –R, register –I, immediate –J, jump NOTE: Result of assembly is a machine instruction

Fall EE 333 Lillevik 333f06-l5 University of Portland School of Engineering Instruction Formats NameFields Size 6 bits5 bits 6 bits R typeoprsrtrdshamtfunct I typeoprsrtaddress/immediate J typeoptarget address All instructions are 32-bits long 32-bits

Fall EE 333 Lillevik 333f06-l5 University of Portland School of Engineering R-format Operation (op) code All 0x00; exception mfc0 = 0x10, Funct determines specific instruction add = 0x20, sub = 0x22, mult = 0x18, div = 0x1a Operands –rd = destination register –rs = first argument –rt = second argument Shamt = shift amount

Fall EE 333 Lillevik 333f06-l5 University of Portland School of Engineering R-format example R typeFields Size 6 bits5 bits 6 bits R typeoprsrtrdshamtfunct add$2, $3, $4 addrd, rs, rt x

Fall EE 333 Lillevik 333f06-l5 University of Portland School of Engineering Find machine instruction? 0x00d05022 R typeFields Size 6 bits5 bits 6 bits R typeoprsrtrdshamtfunct sub$10, $6, $16 sub rd, rs, rt

Fall EE 333 Lillevik 333f06-l5 University of Portland School of Engineering I-format Op code examples lw = 0x23, sw = 0x2b, beq = 0x04 Operands –rs = first argument –rt = second argument Immediate = sign extended bits [15 – 0]

Fall EE 333 Lillevik 333f06-l5 University of Portland School of Engineering I-format example lw$2, 100($3) lwrt, adr (rs) x 8c NameFields Size 6 bits5 bits 16 bits I typeoprsrtaddress/immediate

Fall EE 333 Lillevik 333f06-l5 University of Portland School of Engineering Find machine instruction? NameFields Size 6 bits5 bits 16 bits I typeoprsrtaddress/immediate sw$20, 64($8) swrt, adr (rs) 0xad

Fall EE 333 Lillevik 333f06-l5 University of Portland School of Engineering

Fall EE 333 Lillevik 333f06-l5 University of Portland School of Engineering Write the program? Write a loop that adds 4 to $t2, six times

Fall EE 333 Lillevik 333f06-l5 University of Portland School of Engineering Find machine instruction? 0x 00d R typeFields Size 6 bits5 bits 6 bits R typeoprsrtrdshamtfunct sub$10, $6, $16 sub rd, rs, rt

Fall EE 333 Lillevik 333f06-l5 University of Portland School of Engineering Find machine instruction? NameFields Size 6 bits5 bits 16 bits I typeoprsrtaddress/immediate sw$20, 64($8) swrt, adr (rs) 0x ad