ENCM 369 Winter 2013: Reference Material for Midterm #2 page 1 of 5

Similar documents
CS 351 Exam 2 Mon. 11/2/2015

MIPS Reference Guide

Reduced Instruction Set Computer (RISC)

Reduced Instruction Set Computer (RISC)

ECE 2035 Programming HW/SW Systems Fall problems, 7 pages Exam Two 23 October 2013

CISC 662 Graduate Computer Architecture. Lecture 4 - ISA

CISC 662 Graduate Computer Architecture. Lecture 4 - ISA MIPS ISA. In a CPU. (vonneumann) Processor Organization

ECE232: Hardware Organization and Design. Computer Organization - Previously covered

MIPS ISA. 1. Data and Address Size 8-, 16-, 32-, 64-bit 2. Which instructions does the processor support

MIPS%Assembly% E155%

SPIM Instruction Set

101 Assembly. ENGR 3410 Computer Architecture Mark L. Chang Fall 2009

ECE 331 Hardware Organization and Design. Professor Jay Taneja UMass ECE - Discussion 5 2/22/2018

Mark Redekopp, All rights reserved. EE 357 Unit 11 MIPS ISA

Chapter 2. Computer Abstractions and Technology. Lesson 4: MIPS (cont )

Computer Architecture. MIPS Instruction Set Architecture

Computer Architecture Instruction Set Architecture part 2. Mehran Rezaei

We will study the MIPS assembly language as an exemplar of the concept.

F. Appendix 6 MIPS Instruction Reference

TSK3000A - Generic Instructions

MIPS Instruction Reference

MIPS Instruction Set

Computer Architecture. The Language of the Machine

ICS 233 COMPUTER ARCHITECTURE. MIPS Processor Design Multicycle Implementation

Instruction Set Architecture part 1 (Introduction) Mehran Rezaei

Instructions: MIPS ISA. Chapter 2 Instructions: Language of the Computer 1

ECE 30 Introduction to Computer Engineering

Introduction to the MIPS. Lecture for CPSC 5155 Edward Bosworth, Ph.D. Computer Science Department Columbus State University

ECE 331 Hardware Organization and Design. Professor Jay Taneja UMass ECE - Discussion 3 2/8/2018

ECE Exam I February 19 th, :00 pm 4:25pm

Lecture 2. Instructions: Language of the Computer (Chapter 2 of the textbook)

CS 61c: Great Ideas in Computer Architecture

Q1: /30 Q2: /25 Q3: /45. Total: /100

ECE 2035 Programming HW/SW Systems Spring problems, 6 pages Exam Two 11 March Your Name (please print) total

COMPSCI 313 S Computer Organization. 7 MIPS Instruction Set

Course Administration

Chapter 2. Instructions:

EEM 486: Computer Architecture. Lecture 2. MIPS Instruction Set Architecture

ECE 2035 Programming HW/SW Systems Spring problems, 6 pages Exam One 4 February Your Name (please print clearly)

CS3350B Computer Architecture MIPS Instruction Representation

COMP MIPS instructions 2 Feb. 8, f = g + h i;

MIPS Hello World. MIPS Assembly 1. # PROGRAM: Hello, World! # Data declaration section. out_string:.asciiz "\nhello, World!\n"

The MIPS Instruction Set Architecture

ECE 2035 Programming HW/SW Systems Fall problems, 6 pages Exam Two 23 October Your Name (please print clearly) Signed.

Branch Addressing. Jump Addressing. Target Addressing Example. The University of Adelaide, School of Computer Science 28 September 2015

Computer Architecture

Question 0. Do not turn this page until you have received the signal to start. (Please fill out the identification section above) Good Luck!

Instructions: Language of the Computer

Chapter 2. Instructions: Language of the Computer. Adapted by Paulo Lopes

Concocting an Instruction Set

Lecture 5: Procedure Calls

A General-Purpose Computer The von Neumann Model. Concocting an Instruction Set. Meaning of an Instruction. Anatomy of an Instruction

MIPS Assembly Language. Today s Lecture

Today s Lecture. MIPS Assembly Language. Review: What Must be Specified? Review: A Program. Review: MIPS Instruction Formats

CS/COE1541: Introduction to Computer Architecture

ECE 2035 Programming HW/SW Systems Fall problems, 6 pages Exam One 19 September 2012

ECE 2035 Programming HW/SW Systems Fall problems, 6 pages Exam Two 21 October 2016

ECE 15B Computer Organization Spring 2010

MIPS R-format Instructions. Representing Instructions. Hexadecimal. R-format Example. MIPS I-format Example. MIPS I-format Instructions

Character Is a byte quantity (00~FF or 0~255) ASCII (American Standard Code for Information Interchange) Page 91, Fig. 2.21

Concocting an Instruction Set

5/17/2012. Recap from Last Time. CSE 2021: Computer Organization. The RISC Philosophy. Levels of Programming. Stored Program Computers

Chapter 2: Instructions:

Recap from Last Time. CSE 2021: Computer Organization. Levels of Programming. The RISC Philosophy 5/19/2011

Computer Architecture Experiment

Review. Lecture #9 MIPS Logical & Shift Ops, and Instruction Representation I Logical Operators (1/3) Bitwise Operations

Mips Code Examples Peter Rounce

Computer Science 324 Computer Architecture Mount Holyoke College Fall Topic Notes: MIPS Instruction Set Architecture

Chapter 2. Instructions: Language of the Computer. HW#1: 1.3 all, 1.4 all, 1.6.1, , , , , and Due date: one week.

EE108B Lecture 3. MIPS Assembly Language II

ECE260: Fundamentals of Computer Engineering

Lecture 7: Procedures

Overview. Introduction to the MIPS ISA. MIPS ISA Overview. Overview (2)

CS3350B Computer Architecture MIPS Introduction

comp 180 Lecture 10 Outline of Lecture Procedure calls Saving and restoring registers Summary of MIPS instructions

ECE 2035 A Programming Hw/Sw Systems Fall problems, 8 pages Final Exam 8 December 2014

MIPS ISA and MIPS Assembly. CS301 Prof. Szajda

COMPUTER ORGANIZATION AND DESIGN

M2 Instruction Set Architecture

Procedure Calling. Procedure Calling. Register Usage. 25 September CSE2021 Computer Organization

Lecture 4: MIPS Instruction Set

CS3350B Computer Architecture

ece4750-tinyrv-isa.txt

Winter 2002 FINAL EXAMINATION

Laboratory Exercise 6 Pipelined Processors 0.0

Chapter 3. Instructions:

Inequalities in MIPS (2/4) Inequalities in MIPS (1/4) Inequalities in MIPS (4/4) Inequalities in MIPS (3/4) UCB CS61C : Machine Structures

CS222: MIPS Instruction Set

MIPS Instruction Format

ECE 2035 Programming HW/SW Systems Fall problems, 6 pages Exam One 22 September Your Name (please print clearly) Signed.

CS61C Machine Structures. Lecture 12 - MIPS Procedures II & Logical Ops. 2/13/2006 John Wawrzynek. www-inst.eecs.berkeley.

Do-While Example. In C++ In assembly language. do { z--; while (a == b); z = b; loop: addi $s2, $s2, -1 beq $s0, $s1, loop or $s2, $s1, $zero

CSCI 402: Computer Architectures. Instructions: Language of the Computer (3) Fengguang Song Department of Computer & Information Science IUPUI.


Topic Notes: MIPS Instruction Set Architecture

ECE260: Fundamentals of Computer Engineering

ECE 473 Computer Architecture and Organization Project: Design of a Five Stage Pipelined MIPS-like Processor Project Team TWO Objectives

CS3350B Computer Architecture Quiz 3 March 15, 2018

ECE 2035 A Programming Hw/Sw Systems Spring problems, 8 pages Final Exam 29 April 2015

CS 61c: Great Ideas in Computer Architecture

Transcription:

ENCM 369 Winter 2013: Reference Material for Midterm #2 page 1 of 5 MIPS/SPIM General Purpose Registers Powers of Two 0 $zero all bits are zero 16 $s0 local variable 1 $at assembler temporary 17 $s1 local variable 2 $v0 return value 18 $s2 local variable 3 $v1 return value 19 $s3 local variable 4 $a0 argument 20 $s4 local variable 5 $a1 argument 21 $s5 local variable 6 $a2 argument 22 $s6 local variable 7 $a3 argument 23 $s7 local variable 8 $t0 temporary 24 $t8 temporary 9 $t1 temporary 25 $t9 temporary 10 $t2 temporary 26 $k0 used by O/S kernel 11 $t3 temporary 27 $k1 used by O/S kernel 12 $t4 temporary 28 $gp global pointer 13 $t5 temporary 29 $sp stack pointer 14 $t6 temporary 30 $fp frame pointer 15 $t7 temporary $ra return address n 2 n n 2 n n 2 n n 2 n 0 1 8 256 16 65,536 24 16,777,216 1 2 9 512 17 1,072 25 33,554,4 2 4 10 1,024 18 262,144 26 67,108,864 3 8 11 2,048 19 524,288 27 134,217,728 4 16 12 4,096 20 1,048,576 28 268,435,456 5 13 8,192 21 2,097,152 29 536,870,912 6 64 14 16,384 22 4,194,304 30 1,073,741,824 7 128 15,768 23 8,388,608 2,147,483,648 4,294,967,296 Midterm #2 Instruction Subset Zero-extending a 16-bit constant means generating a -bit value by copying the 16-bit constant to bits 15 0 of the -bit value and making bits 16 equal to 0. Sign-extending a 16-bit constant means generating a -bit value by copying the 16-bit constant to bits 15 0 of the -bit value and making bits 16 equal to bit 15 of the 16-bit constant. Real MIPS/MARS instructions add rdest, rsrc1, rsrc2 add register rsrc1 and register rsrc2 ; cause an exception on signed overflow, otherwise put result in register addu rdest, rsrc1, rsrc2 add register rsrc1 and register rsrc2, put result in register addi rdest, rsrc1, imm add register rsrc1 and sign-extended constant imm; cause an exception on signed overflow, otherwise put result in register

ENCM 369 Winter 2013: Reference Material for Midterm #2 page 2 of 5 addiu rdest, rsrc1, imm add register rsrc1 and sign-extended constant imm, put result in register sub rdest, rsrc1, rsrc2 subtract register rsrc2 from register rsrc1 ; cause an exception on signed overflow, otherwise put result in register subu rdest, rsrc1, rsrc2 subtract register rsrc2 from register rsrc1, put result in register slt rdest, rsrc1, rsrc2 put 1 in register rdest if register rsrc1 is less than rsrc2 using signed arithmetic, otherwise put 0 in register sltu rdest, rsrc1, rsrc2 put 1 in register rdest if register rsrc1 is less than rsrc2 using unsigned arithmetic, otherwise put 0 in register slti rdest, rsrc1, imm put 1 in register rdest if register rsrc1 is less than sign-extended constant imm using signed arithmetic, otherwise put 0 in register sltiu rdest, rsrc1, imm put 1 in register rdest if register rsrc1 is less than sign-extended constant imm using unsigned arithmetic, otherwise put 0 in register (It s a bit weird that the constant is sign-extended even though an unsigned comparison is done.) lw rdest, address copy word from memory at address to register sw rsrc, address copy word from register rsrc to memory at address. lb rdest, address copy byte from memory at address to bits 7 0 of register rdest, make bits 8 of rdest equal to bit 7 of that byte. lbu rdest, address copy byte from memory at address to bits 7 0 of register rdest, make bits 8 of rdest equal to 0. sb rsrc, address copy byte from bits 7 0 of register rsrc to memory at address. sll rdest, rsrc1, count shift value of register rsrc1 left by count bits, filling with 0 s from the right; put result in register srl rdest, rsrc1, count shift value of register rsrc1 right by count bits, filling with 0 s from the left; put result in register and rdest, rsrc1, rsrc2 do a bitwise and of register rsrc1 and register rsrc2, put result in register andi rdest, rsrc1, imm do a bitwise and of register rsrc1 and zero-extended constant imm, put result in register or rdest, rsrc1, rsrc2 do a bitwise or of register rsrc1 and register rsrc2, put result in register ori rdest, rsrc1, imm do a bitwise or of register rsrc1 and zero-extended constant imm, put result in register lui rdest, imm copy constant imm to bits 16 of register rdest, make bits 15 0 of rdest 0. nor rdest, rsrc1, rsrc2 do a bitwise nor of register rsrc1 and register rsrc2, put result in register

ENCM 369 Winter 2013: Reference Material for Midterm #2 page 3 of 5 beq rsrc1, rsrc2, label branch to instruction at label if value of register rsrc1 equals value of register rsrc2. bne rsrc1, rsrc2, label branch to instruction at label if value of register rsrc1 does not equal value of register rsrc2. j label jump to instruction at label. jal label copy the address of the instruction following the jal instruction to $ra, and jump to the instruction at label. jr reg jump to the instruction at the address in register reg. Two Pseudoinstructions la rdest, label copy address corresponding to label to register li rdest, imm copy constant imm to register Instruction formats for Chapter 4 MIPS subset R-type (ADD, SUB, AND, OR, SLT) 26 25 21 20 16 15 11 10 6 5 0 source source dest. 0 0 0 0 0 0 0 0 0 0 0 1 2 funct field LW and SW LW 1 0 0 0 1 1 pointer dest. SW 1 0 1 0 1 1 pointer source Note: lb and lbu are like lw, but have opcodes 100000 for lb and 100100 for lbu; sb is like sw, but has opcode 101000. BEQ source source 0 0 0 1 0 0 1 2 J 26 25 0 0 0 0 0 1 0 bits 27 2 of jump target address

ENCM 369 Winter 2013: Reference Material for Midterm #2 page 4 of 5 ALU specification for Chapter 4 computers A B operation 4 ALU Zero Overflow Result operation Result ( bits) Overflow (1 bit) 0000 bitwise AND of A and B always 0 0001 bitwise OR of A and B always 0 0010 -bit sum of A and B 1 on signed overflow, 0 otherwise 0110 -bit subtraction result for A B 1 on signed overflow, 0 otherwise 0111 SLT result for signed comparison always 0 A < B 1100 bitwise NOR of A and B always 0 The 1-bit signal called Zero is 1 if all bits of Result are 0, and is 0 if one or more bits of Result are 1.

ENCM 369 Winter 2013: Reference Material for Midterm #2 page 5 of 5 Figure 4.51 from the course textbook [Figure deleted from Web posting of this Reference Material booklet.] Names for some pipeline register fields in Figure 4.51 register field width description IF/ID IF/ID.PCPlus4 bits output of adder in IF stage IF/ID.Instruction bits instruction obtained in IF stage ID/EX ID/EX.PCPlus4 bits copied from IF/ID.PCPlus4 ID/EX.A bits output of Read data 1 from Registers ID/EX.B bits output of Read data 2 from Registers ID/EX.Immed bits output of Sign-extend unit ID/EX.RegisterRt 5 bits bits 20 16 copied from IF/ID.Instruction ID/EX.RegisterRd 5 bits bits 15 11 copied from IF/ID.Instruction EX/MEM EX/MEM.BranchTarget bits branch target from adder in EX stage EX/MEM.Zero 1 bit Zero output from ALU EX/MEM.Result bits Result output from ALU EX/MEM.B bits copied from ID/EX.B EX/MEM.RegisterRd 5 bits output of mux controlled by RegDst MEM/WB MEM/WB.MemData bits output of Read data from Data Memory MEM/WB.Result bits copied from EX/MEM.Result MEM/WB.RegisterRd 5 bits copied from EX/MEM.RegisterRd