Question 5 (SP07 Final M1): Do You Remember?
|
|
- Beryl Henderson
- 5 years ago
- Views:
Transcription
1 Question 5 (SP07 Final M1): Do You Remember? Decode the binary numbers into MIPS instructions with proper register names ( $s0, $t0, etc.).if there are any memory addresses, represent them in hex. Address 32 bit Binary Instruction Type (R, I, J) MIPS Instruction w/args 0xAFFFFFF xAFFFFFFC xB xB whatever... whatever ori $v0, $0, 0x61C 0xB whatever... whatever jr $ra You can replace the first instruction with a new instruction and save 2 clock cycles on a single cycle non delayed branch MIPS machine. What is it (in MIPS)? Careful!
2 Q5: MIPS Sleuth (15 points) SID: mystery, a mysterious MIPS function outlined below, is written without proper calling conventions. mystery calls a correctly written function, random, that takes an integer i as its only argument, and returns a random integer in the range [0, i - 1] inclusive. 1 mystery: addiu $sp $sp addu $s0 $0 $0 8 move $s1 $a0 9 move $s2 $a1 10 loop: srl $t0 $s beq $t0 $s2 exit 12 subu $a0 $s2 $t0 13 jal random 14 sll $v0 $v addu $v0 $v0 $s0 16 addu $t0 $s1 $s0 17 addu $t1 $s1 $v0 18 lw $t2 0($t0) 19 lw $t3 0($t1) 20 sw $t2 0($t1) 21 sw $t3 0($t0) 22 addiu $s0 $s j loop 24 exit: ) Fill in the prologue and the epilogue of this MIPS function. Assume that random follows proper calling conventions, and that it may make its own function calls. You may not need all of the lines. 2) What operation does this function perform on an integer array? Assume that both the integer array and the length of the array are passed into the function. 3) Would this function work as expected if a string was passed into the function instead? Write down the line numbers of all lines of MIPS code that must be changed (if any at all), so that the function works correctly on strings. Do not write down any extraneous line numbers. 7/8
3 Question 4: Solve this MIPStery in C! (Sp14 MT1) mipstery: Convert the above MIPS function, mipstery, into a C function using as few lines as possible. The ischarinstr function returns 1 if the string ($a0) contains the character ($a1), and 0 otherwise. mipstery(, ) { int count = 0; return count; }
4 Q4: beargit redux (15 points) SID: From project 1, you may remember the function is_commit_msg_ok() that you needed to implement in C. Here is a simpler rendition where commit messages are deemed okay if and only if those nullterminated commit messages exactly match go_bears. Using the fewest number of empty lines possible, finish writing the code below. You are only allowed to use the registers already provided and registers $t0-3, and $s0-s2 (but you will not need all of them). Assume these registers are initialized to 0 before the call to ISCOMMITOK. const char* go_bears = "THIS IS BEAR TERRITORY!"; int is_commit_msg_ok(const char* msg, const char* go_bears) { for (int i = 0; msg[i] && go_bears[i]; i++) { if (go_bears[i]!= msg[i]) return 0; } if (!msg[i] &&!go_bears[i]) return 1; return 0; } ISCOMMITOK: $t0 ($a0) $t1 ($a1) COND: and addiu $a0 $a0 1 addiu $a1 $a1 1 EXIT: $t2 $t0 $t1 90 li $v0 1 FAILED: li $v0 0 END: 6/8
5 Question 3 : free at last, thank gosh we are free at last We wish to free a linked list of strings (example below) whose nodes are made up of this struct. Complete the code below; we have started you off with some filled in. You may use fewer lines, but do not add any. FreeLL:beq,, NULL_CASE jal FreeLL lw $a0 0($sp) jal free NULL_CASE:jr $ra
6 Question 4 (su13 q2) : MIPStifying (9 points, 20 minutes) Answer the questions below about the following MIPS function. Answer each part separately, assuming each time that mystery() has not been called yet. A. Which instruction (number) gets modified in the above function? B. Write an equivalent arithmetic (not logical) C expression to instruction 1. a0 = C. Which instruction field gets modified when mystery is called with $a0 = 3? D. How many times can mystery(2) be called before the behavior of mystery() changes? E. How many times can mystery(0) be called before the behavior of mystery() changes? F. A program calls mystery with the following sequence of arguments: 0, 1, 2, 3, 4, 5. What MIPS instruction gets stored in memory?
7 MIPS Reference Data Card ( Green Card ) 1. Pull along perforation to separate card 2. Fold bottom side (columns 3 and 4) together M I P S Reference Data CORE INSTRUCTION SET OPCODE FOR- / FUNCT NAME, MNEMONIC MAT OPERATION (in Verilog) (Hex) Add add R R[rd] = R[rs] + R[rt] (1) 0 / 20 hex Add Immediate addi I R[rt] = R[rs] + SignExtImm (1,2) 8 hex Add Imm. Unsigned addiu I R[rt] = R[rs] + SignExtImm (2) 9 hex Add Unsigned addu R R[rd] = R[rs] + R[rt] 0 / 21 hex And and R R[rd] = R[rs] & R[rt] 0 / 24 hex And Immediate andi I R[rt] = R[rs] & ZeroExtImm (3) c hex if(r[rs]==r[rt]) Branch On Equal beq I 4 PC=PC+4+BranchAddr (4) hex if(r[rs]!=r[rt]) Branch On Not Equal bne I 5 PC=PC+4+BranchAddr (4) hex Jump j J PC=JumpAddr (5) 2 hex Jump And Link jal J R[31]=PC+8;PC=JumpAddr (5) 3 hex Jump Register jr R PC=R[rs] 0 / 08 hex R[rt]={24 b0,m[r[rs] Load Byte Unsigned lbu I 24 +SignExtImm](7:0)} (2) hex Load Halfword R[rt]={16 b0,m[r[rs] lhu I 25 Unsigned +SignExtImm](15:0)} (2) hex Load Linked ll I R[rt] = M[R[rs]+SignExtImm] (2,7) 30 hex Load Upper Imm. lui I R[rt] = {imm, 16 b0} f hex Load Word lw I R[rt] = M[R[rs]+SignExtImm] (2) 23 hex Nor nor R R[rd] = ~ (R[rs] R[rt]) 0 / 27 hex Or or R R[rd] = R[rs] R[rt] 0 / 25 hex Or Immediate ori I R[rt] = R[rs] ZeroExtImm (3) d hex Set Less Than slt R R[rd] = (R[rs] < R[rt])? 1 : 0 0 / 2a hex Set Less Than Imm. slti I R[rt] = (R[rs] < SignExtImm)? 1 : 0 (2) a hex Set Less Than Imm. R[rt] = (R[rs] < SignExtImm) sltiu I b Unsigned? 1 : 0 (2,6) hex Set Less Than Unsig. sltu R R[rd] = (R[rs] < R[rt])? 1 : 0 (6) 0 / 2b hex Shift Left Logical sll R R[rd] = R[rt] << shamt 0 / 00 hex 1 ARITHMETIC CORE INSTRUCTION SET 2 OPCODE / FMT /FT / FUNCT (Hex) NAME, MNEMONIC FOR- MAT OPERATION Branch On FP True bc1t FI if(fpcond)pc=pc+4+branchaddr (4) 11/8/1/-- Branch On FP False bc1f FI if(!fpcond)pc=pc+4+branchaddr(4) 11/8/0/-- Divide div R Lo=R[rs]/R[rt]; Hi=R[rs]%R[rt] 0/--/--/1a Divide Unsigned divu R Lo=R[rs]/R[rt]; Hi=R[rs]%R[rt] (6) 0/--/--/1b FP Add Single add.s FR F[fd ]= F[fs] + F[ft] 11/10/--/0 FP Add {F[fd],F[fd+1]} = {F[fs],F[fs+1]} + add.d FR {F[ft],F[ft+1]} 11/11/--/0 FP Compare Single c.x.s* FR FPcond = (F[fs] op F[ft])? 1 : 0 11/10/--/y FP Compare FPcond = ({F[fs],F[fs+1]} op c.x.d* FR {F[ft],F[ft+1]})? 1 : 0 11/11/--/y * (x is eq, lt, or le) (op is ==, <, or <=) ( y is 32, 3c, or 3e) FP Divide Single div.s FR F[fd] = F[fs] / F[ft] 11/10/--/3 FP Divide {F[fd],F[fd+1]} = {F[fs],F[fs+1]} / div.d FR {F[ft],F[ft+1]} 11/11/--/3 FP Multiply Single mul.s FR F[fd] = F[fs] * F[ft] 11/10/--/2 FP Multiply {F[fd],F[fd+1]} = {F[fs],F[fs+1]} * mul.d FR {F[ft],F[ft+1]} 11/11/--/2 FP Subtract Single sub.s FR F[fd]=F[fs] - F[ft] 11/10/--/1 FP Subtract {F[fd],F[fd+1]} = {F[fs],F[fs+1]} - sub.d FR {F[ft],F[ft+1]} 11/11/--/1 Load FP Single lwc1 I F[rt]=M[R[rs]+SignExtImm] (2) 31/--/--/-- Load FP F[rt]=M[R[rs]+SignExtImm]; (2) ldc1 I F[rt+1]=M[R[rs]+SignExtImm+4] 35/--/--/-- Move From Hi mfhi R R[rd] = Hi 0 /--/--/10 Move From Lo mflo R R[rd] = Lo 0 /--/--/12 Move From Control mfc0 R R[rd] = CR[rs] 10 /0/--/0 Multiply mult R {Hi,Lo} = R[rs] * R[rt] 0/--/--/18 Multiply Unsigned multu R {Hi,Lo} = R[rs] * R[rt] (6) 0/--/--/19 Shift Right Arith. sra R R[rd] = R[rt] >>> shamt 0/--/--/3 Store FP Single swc1 I M[R[rs]+SignExtImm] = F[rt] (2) 39/--/--/-- Store FP M[R[rs]+SignExtImm] = F[rt]; (2) sdc1 I 3d/--/--/-- M[R[rs]+SignExtImm+4] = F[rt+1] FLOATING-POINT INSTRUCTION FORMATS FR opcode fmt ft fs fd funct FI opcode fmt ft immediate Shift Right Logical srl R R[rd] = R[rt] >> shamt 0 / 02 hex PSEUDOINSTRUCTION SET Store Byte sb I M[R[rs]+SignExtImm](7:0) = 28 NAME MNEMONIC OPERATION R[rt](7:0) (2) hex Branch Less Than blt if(r[rs]<r[rt]) PC = Label Store Conditional sc I M[R[rs]+SignExtImm] = R[rt]; Branch Greater Than bgt if(r[rs]>r[rt]) PC = Label 38 R[rt] = (atomic)? 1 : 0 (2,7) hex Branch Less Than or Equal ble if(r[rs]<=r[rt]) PC = Label M[R[rs]+SignExtImm](15:0) = Branch Greater Than or Equal bge if(r[rs]>=r[rt]) PC = Label Store Halfword sh I 29 R[rt](15:0) (2) hex Load Immediate li R[rd] = immediate Move move R[rd] = R[rs] Store Word sw I M[R[rs]+SignExtImm] = R[rt] (2) 2b hex REGISTER NAME, NUMBER, USE, CALL CONVENTION Subtract sub R R[rd] = R[rs] - R[rt] (1) 0 / 22 hex PRESERVED ACROSS Subtract Unsigned subu R R[rd] = R[rs] - R[rt] 0 / 23 hex NAME NUMBER USE A CALL? (1) May cause overflow exception $zero 0 The Constant Value 0 N.A. (2) SignExtImm = { 16{immediate[15]}, immediate } $at 1 Assembler Temporary No (3) ZeroExtImm = { 16{1b 0}, immediate } Values for Function Results (4) BranchAddr = { 14{immediate[15]}, immediate, 2 b0 } $v0-$v1 2-3 No and Expression Evaluation (5) JumpAddr = { PC+4[31:28], address, 2 b0 } (6) Operands considered unsigned numbers (vs. 2 s comp.) $a0-$a3 4-7 Arguments No (7) Atomic test&set pair; R[rt] = 1 if pair atomic, 0 if not atomic $t0-$t Temporaries No $s0-$s Saved Temporaries Yes BASIC INSTRUCTION FORMATS $t8-$t Temporaries No R opcode rs rt rd shamt funct $k0-$k Reserved for OS Kernel No I $gp 28 Global Pointer Yes opcode rs rt immediate $sp 29 Stack Pointer Yes J $fp 30 Frame Pointer Yes opcode address $ra 31 Return Address No Copyright 2009 by Elsevier, Inc., All rights reserved. From Patterson and Hennessy, Computer Organization and Design, 4th ed.
8 OPCODES, BASE CONVERSION, ASCII SYMBOLS MIPS (1) MIPS (2) MIPS opcode funct funct Binary Decimal Hexa- ASCII deci- mal Character (31:26) (5:0) (5:0) Hexa- Decimadecimal (1) sll add.f NUL 64 sub.f SOH A j srl mul.f STX B jal sra div.f ETX C beq sllv sqrt.f EOT D bne abs.f ENQ E blez srlv mov.f ACK F bgtz srav neg.f BEL G addi jr BS H addiu jalr HT I slti movz a LF 74 4a J sltiu movn b VT 75 4b K andi syscall round.w.f c FF 76 4c L ori break trunc.w.f d CR 77 4d M xori ceil.w.f e SO 78 4e N lui sync floor.w.f f SI 79 4f O mfhi DLE P (2) mthi DC Q mflo movz.f DC R mtlo movn.f DC S DC T NAK U SYN V ETB W mult CAN X multu EM Y div a SUB 90 5a Z divu b ESC 91 5b [ c FS 92 5c \ d GS 93 5d ] e RS 94 5e ^ f US 95 5f _ lb add cvt.s.f Space lh addu cvt.d.f ! a lwl sub " b lw subu # c lbu and cvt.w.f $ d lhu or % e lwr xor & f nor g sb ( h sh ) i swl slt a * 106 6a j sw sltu b b k c, 108 6c l d d m swr e e n cache f / 111 6f o ll tge c.f.f p lwc1 tgeu c.un.f q lwc2 tlt c.eq.f r pref tltu c.ueq.f s teq c.olt.f t ldc1 c.ult.f u ldc2 tne c.ole.f v c.ule.f w sc c.sf.f x swc1 c.ngle.f y swc2 c.seq.f a : 122 7a z c.ngl.f b ; 123 7b { c.lt.f c < 124 7c sdc1 c.nge.f d = 125 7d } sdc2 c.le.f e > 126 7e ~ c.ngt.f f? 127 7f DEL (1) opcode(31:26) == 0 (2) opcode(31:26) == 17 ten (11 hex ); if fmt(25:21)==16 ten (10 hex ) f = s (single); if fmt(25:21)==17 ten (11 hex ) f = d (double) 3 IEEE 754 FLOATING-POINT STANDARD (-1) S (1 + Fraction) 2 (Exponent - Bias) where Single Precision Bias = 127, Precision Bias = IEEE Single Precision and Precision Formats: MEMORY ALLOCATION STACK FRAME Stack $sp 7fff fffc hex $gp pc S Exponent Fraction S Exponent Fraction hex hex hex 0 hex Dynamic Data Static Data Text Reserved 4 IEEE 754 Symbols Exponent Fraction Object 0 0 ± ± Denorm 1 to MAX - 1 anything ± Fl. Pt. Num. MAX 0 ± MAX 0 NaN S.P. MAX = 255, D.P. MAX = Argument 6 Argument 5 Saved Registers Local Variables DATA ALIGNMENT Word Word Word Halfword Halfword Halfword Halfword Byte Byte Byte Byte Byte Byte Byte Byte Value of three least significant bits of byte address (Big Endian) EXCEPTION CONTROL REGISTERS: CAUSE AND STATUS B Interrupt Exception D Mask Code Copyright 2009 by Elsevier, Inc., All rights reserved. From Patterson and Hennessy, Computer Organization and Design, 4th ed. Higher Memory Addresses Stack Grows Lower Memory Addresses Pending U E I Interrupt M L E BD = Branch Delay, UM = User Mode, EL = Exception Level, IE =Interrupt Enable EXCEPTION CODES Number Name Cause of Exception Number Name Cause of Exception 0 Int Interrupt (hardware) 9 Bp Breakpoint Exception 4 Address Error Exception Reserved Instruction AdEL 10 RI (load or instruction fetch) Exception 5 Address Error Exception Coprocessor AdES 11 CpU (store) Unimplemented 6 IBE Bus Error on Arithmetic Overflow 12 Ov Instruction Fetch Exception 7 DBE Bus Error on Load or Store 13 Tr Trap 8 Sys Syscall Exception 15 FPE Floating Point Exception ASCII Character SIZE PREFIXES (10 x for Disk, Communication; 2 x for Memory) PRE- PRE- PRE- PRE- SIZE FIX SIZE FIX SIZE FIX SIZE FIX 10 3, 2 10 Kilo , 2 50 Peta milli femto- 10 6, 2 20 Mega , 2 60 Exa micro atto- 10 9, 2 30 Giga , 2 70 Zetta nano zepto , 2 40 Tera , 2 80 Yotta pico yocto- The symbol for each prefix is just its first letter, except µ is used for micro. $fp $sp MIPS Reference Data Card ( Green Card ) 1. Pull along perforation to separate card 2. Fold bottom side (columns 3 and 4) together
Computer Architecture. The Language of the Machine
Computer Architecture The Language of the Machine Instruction Sets Basic ISA Classes, Addressing, Format Administrative Matters Operations, Branching, Calling conventions Break Organization All computers
More informationMIPS Reference Guide
MIPS Reference Guide Free at PushingButtons.net 2 Table of Contents I. Data Registers 3 II. Instruction Register Formats 4 III. MIPS Instruction Set 5 IV. MIPS Instruction Set (Extended) 6 V. SPIM Programming
More informationECE 331 Hardware Organization and Design. Professor Jay Taneja UMass ECE - Discussion 5 2/22/2018
ECE 331 Hardware Organization and Design Professor Jay Taneja UMass ECE - jtaneja@umass.edu Discussion 5 2/22/2018 Today s Discussion Topics Program Concepts Floating Point Floating Point Conversion Floating
More informationThe MIPS Instruction Set Architecture
The MIPS Set Architecture CPS 14 Lecture 5 Today s Lecture Admin HW #1 is due HW #2 assigned Outline Review A specific ISA, we ll use it throughout semester, very similar to the NiosII ISA (we will use
More informationReduced Instruction Set Computer (RISC)
Reduced Instruction Set Computer (RISC) Reduced Instruction Set Computer (RISC) Focuses on reducing the number and complexity of instructions of the machine. Reduced number of cycles needed per instruction.
More informationReduced Instruction Set Computer (RISC)
Reduced Instruction Set Computer (RISC) Focuses on reducing the number and complexity of instructions of the ISA. RISC Goals RISC: Simplify ISA Simplify CPU Design Better CPU Performance Motivated by simplifying
More informationEEM 486: Computer Architecture. Lecture 2. MIPS Instruction Set Architecture
EEM 486: Computer Architecture Lecture 2 MIPS Instruction Set Architecture EEM 486 Overview Instruction Representation Big idea: stored program consequences of stored program Instructions as numbers Instruction
More informationComputer Organization & Design
Computer Organization & Design Peng Liu ( 刘鹏 ) College of Information Science & Electronic Engineering Zhejiang University, Hangzhou 310027, China liupeng@zju.edu.cn Lecture 2 MIPS Instruction Set Architecture
More informationMIPS Instruction Format
MIPS Instruction Format MIPS uses a 32-bit fixed-length instruction format. only three different instruction word formats: There are Register format Op-code Rs Rt Rd Function code 000000 sssss ttttt ddddd
More informationCISC 662 Graduate Computer Architecture. Lecture 4 - ISA MIPS ISA. In a CPU. (vonneumann) Processor Organization
CISC 662 Graduate Computer Architecture Lecture 4 - ISA MIPS ISA Michela Taufer http://www.cis.udel.edu/~taufer/courses Powerpoint Lecture Notes from John Hennessy and David Patterson s: Computer Architecture,
More informationDigital System Design II
Digital System Design II 数字系统设计 II Peng Liu ( 刘鹏 ) Dept. of Info. Sci. & Elec. Engg. Zhejiang University liupeng@zju.edu.cn Lecture 2 MIPS Instruction Set Architecture 2 Textbook reading MIPS ISA 2.1-2.4
More informationCISC 662 Graduate Computer Architecture. Lecture 4 - ISA
CISC 662 Graduate Computer Architecture Lecture 4 - ISA Michela Taufer http://www.cis.udel.edu/~taufer/courses Powerpoint Lecture Notes from John Hennessy and David Patterson s: Computer Architecture,
More informationComputer Architecture. MIPS Instruction Set Architecture
Computer Architecture MIPS Instruction Set Architecture Instruction Set Architecture An Abstract Data Type Objects Registers & Memory Operations Instructions Goal of Instruction Set Architecture Design
More informationECE 331 Hardware Organization and Design. Professor Jay Taneja UMass ECE - Discussion 3 2/8/2018
ECE 331 Hardware Organization and Design Professor Jay Taneja UMass ECE - jtaneja@umass.edu Discussion 3 2/8/2018 Study Jams Leader: Chris Bartoli Tuesday 5:30-6:45pm Elab 325 Wednesday 8:30-9:45pm Elab
More informationSPIM Instruction Set
SPIM Instruction Set This document gives an overview of the more common instructions used in the SPIM simulator. Overview The SPIM simulator implements the full MIPS instruction set, as well as a large
More informationECE232: Hardware Organization and Design. Computer Organization - Previously covered
ECE232: Hardware Organization and Design Part 6: MIPS Instructions II http://www.ecs.umass.edu/ece/ece232/ Adapted from Computer Organization and Design, Patterson & Hennessy, UCB Computer Organization
More informationRecap from Last Time. CSE 2021: Computer Organization. Levels of Programming. The RISC Philosophy 5/19/2011
CSE 2021: Computer Organization Recap from Last Time load from disk High-Level Program Lecture-3 Code Translation-1 Registers, Arithmetic, logical, jump, and branch instructions MIPS to machine language
More informationQuestion 0. Do not turn this page until you have received the signal to start. (Please fill out the identification section above) Good Luck!
CSC B58 Winter 2017 Final Examination Duration 2 hours and 50 minutes Aids allowed: none Last Name: Student Number: UTORid: First Name: Question 0. [1 mark] Read and follow all instructions on this page,
More information5/17/2012. Recap from Last Time. CSE 2021: Computer Organization. The RISC Philosophy. Levels of Programming. Stored Program Computers
CSE 2021: Computer Organization Recap from Last Time load from disk High-Level Program Lecture-2 Code Translation-1 Registers, Arithmetic, logical, jump, and branch instructions MIPS to machine language
More informationInstruction Set Architecture of. MIPS Processor. MIPS Processor. MIPS Registers (continued) MIPS Registers
CSE 675.02: Introduction to Computer Architecture MIPS Processor Memory Instruction Set Architecture of MIPS Processor CPU Arithmetic Logic unit Registers $0 $31 Multiply divide Coprocessor 1 (FPU) Registers
More informationMIPS Instruction Set
MIPS Instruction Set Prof. James L. Frankel Harvard University Version of 7:12 PM 3-Apr-2018 Copyright 2018, 2017, 2016, 201 James L. Frankel. All rights reserved. CPU Overview CPU is an acronym for Central
More informationReview: MIPS Organization
1 MIPS Arithmetic Review: MIPS Organization Processor Memory src1 addr 5 src2 addr 5 dst addr 5 write data Register File registers ($zero - $ra) bits src1 data src2 data read/write addr 1 1100 2 30 words
More informationECE 2035 Programming HW/SW Systems Fall problems, 7 pages Exam Two 23 October 2013
Instructions: This is a closed book, closed note exam. Calculators are not permitted. If you have a question, raise your hand and I will come to you. Please work the exam in pencil and do not separate
More informationM2 Instruction Set Architecture
M2 Instruction Set Architecture Module Outline Addressing modes. Instruction classes. MIPS-I ISA. High level languages, Assembly languages and object code. Translating and starting a program. Subroutine
More informationMIPS Assembly Language. Today s Lecture
MIPS Assembly Language Computer Science 104 Lecture 6 Homework #2 Midterm I Feb 22 (in class closed book) Outline Assembly Programming Reading Chapter 2, Appendix B Today s Lecture 2 Review: A Program
More informationToday s Lecture. MIPS Assembly Language. Review: What Must be Specified? Review: A Program. Review: MIPS Instruction Formats
Today s Lecture Homework #2 Midterm I Feb 22 (in class closed book) MIPS Assembly Language Computer Science 14 Lecture 6 Outline Assembly Programming Reading Chapter 2, Appendix B 2 Review: A Program Review:
More informationTSK3000A - Generic Instructions
TSK3000A - Generic Instructions Frozen Content Modified by Admin on Sep 13, 2017 Using the core set of assembly language instructions for the TSK3000A as building blocks, a number of generic instructions
More informationMIPS ISA. 1. Data and Address Size 8-, 16-, 32-, 64-bit 2. Which instructions does the processor support
Components of an ISA EE 357 Unit 11 MIPS ISA 1. Data and Address Size 8-, 16-, 32-, 64-bit 2. Which instructions does the processor support SUBtract instruc. vs. NEGate + ADD instrucs. 3. Registers accessible
More information101 Assembly. ENGR 3410 Computer Architecture Mark L. Chang Fall 2009
101 Assembly ENGR 3410 Computer Architecture Mark L. Chang Fall 2009 What is assembly? 79 Why are we learning assembly now? 80 Assembly Language Readings: Chapter 2 (2.1-2.6, 2.8, 2.9, 2.13, 2.15), Appendix
More informationMark Redekopp, All rights reserved. EE 357 Unit 11 MIPS ISA
EE 357 Unit 11 MIPS ISA Components of an ISA 1. Data and Address Size 8-, 16-, 32-, 64-bit 2. Which instructions does the processor support SUBtract instruc. vs. NEGate + ADD instrucs. 3. Registers accessible
More informationECE Exam I February 19 th, :00 pm 4:25pm
ECE 3056 Exam I February 19 th, 2015 3:00 pm 4:25pm 1. The exam is closed, notes, closed text, and no calculators. 2. The Georgia Tech Honor Code governs this examination. 3. There are 4 questions and
More informationCS 351 Exam 2 Mon. 11/2/2015
CS 351 Exam 2 Mon. 11/2/2015 Name: Rules and Hints The MIPS cheat sheet and datapath diagram are attached at the end of this exam for your reference. You may use one handwritten 8.5 11 cheat sheet (front
More informationThe MIPS R2000 Instruction Set
The MIPS R2000 Instruction Set Arithmetic and Logical Instructions In all instructions below, Src2 can either be a register or an immediate value (a 16 bit integer). The immediate forms of the instructions
More informationece4750-parc-isa.txt
========================================================================== PARC Instruction Set Architecture ========================================================================== # Author : Christopher
More informationMIPS Instruction Reference
Page 1 of 9 MIPS Instruction Reference This is a description of the MIPS instruction set, their meanings, syntax, semantics, and bit encodings. The syntax given for each instruction refers to the assembly
More informationWeek 10: Assembly Programming
Week 10: Assembly Programming Arithmetic instructions Instruction Opcode/Function Syntax Operation add 100000 $d, $s, $t $d = $s + $t addu 100001 $d, $s, $t $d = $s + $t addi 001000 $t, $s, i $t = $s +
More informationOverview. Introduction to the MIPS ISA. MIPS ISA Overview. Overview (2)
Introduction to the MIPS ISA Overview Remember that the machine only understands very basic instructions (machine instructions) It is the compiler s job to translate your high-level (e.g. C program) into
More informationF. Appendix 6 MIPS Instruction Reference
F. Appendix 6 MIPS Instruction Reference Note: ALL immediate values should be sign extended. Exception: For logical operations immediate values should be zero extended. After extensions, you treat them
More informationQ1: /30 Q2: /25 Q3: /45. Total: /100
ECE 2035(A) Programming for Hardware/Software Systems Fall 2013 Exam One September 19 th 2013 This is a closed book, closed note texam. Calculators are not permitted. Please work the exam in pencil and
More informationLecture 3 MIPS ISA and Performance
Lecture 3 MIPS ISA and Performance Peng Liu liupeng@zju.edu.cn 1 MIPS Instruction Encoding MIPS instructions are encoded in different forms, depending upon the arguments R-format, I-format, J-format MIPS
More informationLecture 2. Instructions: Language of the Computer (Chapter 2 of the textbook)
Lecture 2 Instructions: Language of the Computer (Chapter 2 of the textbook) Instructions: tell computers what to do Chapter 2 Instructions: Language of the Computer 2 Introduction Chapter 2.1 Chapter
More informationUniversity of California, Berkeley College of Engineering
University of California, Berkeley College of Engineering Department of Electrical Engineering and Computer Sciences Fall 2015 Instructors: Vladimir Stojanovic, John Wawrzynek 2015-09-06 L J After the
More informationProcessor. Han Wang CS3410, Spring 2012 Computer Science Cornell University. See P&H Chapter , 4.1 4
Processor Han Wang CS3410, Spring 2012 Computer Science Cornell University See P&H Chapter 2.16 20, 4.1 4 Announcements Project 1 Available Design Document due in one week. Final Design due in three weeks.
More informationINSTRUCTION SET COMPARISONS
INSTRUCTION SET COMPARISONS MIPS SPARC MOTOROLA REGISTERS: INTEGER 32 FIXED WINDOWS 32 FIXED FP SEPARATE SEPARATE SHARED BRANCHES: CONDITION CODES NO YES NO COMPARE & BR. YES NO YES A=B COMP. & BR. YES
More informationCSc 256 Midterm (green) Fall 2018
CSc 256 Midterm (green) Fall 2018 NAME: Problem 1 (5 points): Suppose we are tracing a C/C++ program using a debugger such as gdb. The code showing all function calls looks like this: main() { bat(5);
More informationECE 2035 Programming HW/SW Systems Spring problems, 6 pages Exam Two 11 March Your Name (please print) total
Instructions: This is a closed book, closed note exam. Calculators are not permitted. If you have a question, raise your hand and I will come to you. Please work the exam in pencil and do not separate
More informationMIPS%Assembly% E155%
MIPS%Assembly% E155% Outline MIPS Architecture ISA Instruction types Machine codes Procedure call Stack 2 The MIPS Register Set Name Register Number Usage $0 0 the constant value 0 $at 1 assembler temporary
More information5DV118 Computer Organization and Architecture Umeå University Department of Computing Science Stephen J. Hegner. Topic 3: Arithmetic
5DV118 Computer Organization and Architecture Umeå University Department of Computing Science Stephen J. Hegner Topic 3: Arithmetic These slides are mostly taken verbatim, or with minor changes, from those
More informationCPS311 - COMPUTER ORGANIZATION. A bit of history
CPS311 - COMPUTER ORGANIZATION A Brief Introduction to the MIPS Architecture A bit of history The MIPS architecture grows out of an early 1980's research project at Stanford University. In 1984, MIPS computer
More informationREGISTERS INSTRUCTION SET DIRECTIVES SYSCALLS
MARS REGISTERS INSTRUCTION SET DIRECTIVES SYSCALLS ΗΥ 134: ΕΙΣΑΓΩΓΗ ΣΤΗΝ ΟΡΓΑΝΩΣΗ ΚΑΙ ΣΧΕΔΙΑΣΗ Η/Υ Ι Registers MIPS has 32 integer registers. The hardware architecture specifies that: General purpose register
More informationInstructions: Language of the Computer
Instructions: Language of the Computer Tuesday 22 September 15 Many slides adapted from: and Design, Patterson & Hennessy 5th Edition, 2014, MK and from Prof. Mary Jane Irwin, PSU Summary Previous Class
More informationUniversity of California, Berkeley College of Engineering
University of California, Berkeley College of Engineering Department of Electrical Engineering and Computer Sciences Fall 2015 Instructors: Vladimir Stojanovic, John Wawrzynek 2015-09-06 After the exam,
More informationECE 2035 Programming HW/SW Systems Fall problems, 6 pages Exam Two 23 October Your Name (please print clearly) Signed.
Your Name (please print clearly) This exam will be conducted according to the Georgia Tech Honor Code. I pledge to neither give nor receive unauthorized assistance on this exam and to abide by all provisions
More informationInstructions: MIPS ISA. Chapter 2 Instructions: Language of the Computer 1
Instructions: MIPS ISA Chapter 2 Instructions: Language of the Computer 1 PH Chapter 2 Pt A Instructions: MIPS ISA Based on Text: Patterson Henessey Publisher: Morgan Kaufmann Edited by Y.K. Malaiya for
More informationComputer Architecture. Chapter 3: Arithmetic for Computers
182.092 Computer Architecture Chapter 3: Arithmetic for Computers Adapted from Computer Organization and Design, 4 th Edition, Patterson & Hennessy, 2008, Morgan Kaufmann Publishers and Mary Jane Irwin
More informationA Processor. Kevin Walsh CS 3410, Spring 2010 Computer Science Cornell University. See: P&H Chapter , 4.1-3
A Processor Kevin Walsh CS 3410, Spring 2010 Computer Science Cornell University See: P&H Chapter 2.16-20, 4.1-3 Let s build a MIPS CPU but using Harvard architecture Basic Computer System Registers ALU
More informationECE 15B Computer Organization Spring 2010
ECE 15B Computer Organization Spring 2010 Dmitri Strukov Lecture 7: Procedures I Partially adapted from Computer Organization and Design, 4 th edition, Patterson and Hennessy, and classes taught by and
More informationProgramming the processor
CSC258 Week 9 Logistics This week: Lab 7 is the last Logisim DE2 lab. Next week: Lab 8 will be assembly. For assembly labs you can work individually or in pairs. No matter how you do it, the important
More informationECE 2035 Programming HW/SW Systems Spring problems, 6 pages Exam One 4 February Your Name (please print clearly)
Your Name (please print clearly) This exam will be conducted according to the Georgia Tech Honor Code. I pledge to neither give nor receive unauthorized assistance on this exam and to abide by all provisions
More informationCSc 256 Midterm 2 Fall 2011
CSc 256 Midterm 2 Fall 2011 NAME: 1a) You are given a MIPS branch instruction: x: beq $12, $0, y The address of the label "y" is 0x400468. The memory location at "x" contains: address contents 0x40049c
More informationCS152 Computer Architecture and Engineering. Lecture 1 CS 152 Introduction & MIPS Review John Lazzaro. Dave Patterson
CS152 Computer Architecture and Engineering Lecture 1 CS 152 Introduction & MIPS Review 2004-08-31 John Lazzaro (www.cs.berkeley.edu/~lazzaro) Dave Patterson (www.cs.berkeley.edu/~patterson) www-inst.eecs.berkeley.edu/~cs152/
More informationKernel Registers 0 1. Global Data Pointer. Stack Pointer. Frame Pointer. Return Address.
The MIPS Register Set The MIPS R2000 CPU has 32 registers. 31 of these are general-purpose registers that can be used in any of the instructions. The last one, denoted register zero, is defined to contain
More informationMIPS Instructions: 64-bit Core Subset
MIPS Instructions: 64-bit Core Subset Spring 2008 General notes: a. R s, R t, and R d specify 64-bit general purpose registers b. F s, F t, and F d specify 64-bit floating point registers c. C d specifies
More informationChapter 2. Instructions: Language of the Computer. Adapted by Paulo Lopes
Chapter 2 Instructions: Language of the Computer Adapted by Paulo Lopes Instruction Set The repertoire of instructions of a computer Different computers have different instruction sets But with many aspects
More informationMIPS R-format Instructions. Representing Instructions. Hexadecimal. R-format Example. MIPS I-format Example. MIPS I-format Instructions
Representing Instructions Instructions are encoded in binary Called machine code MIPS instructions Encoded as 32-bit instruction words Small number of formats encoding operation code (opcode), register
More informationCourse Administration
Fall 2017 EE 3613: Computer Organization Chapter 2: Instruction Set Architecture 2/4 Avinash Kodi Department of Electrical Engineering & Computer Science Ohio University, Athens, Ohio 45701 E-mail: kodi@ohio.edu
More informationLec 10: Assembler. Announcements
Lec 10: Assembler Kavita Bala CS 3410, Fall 2008 Computer Science Cornell University Announcements HW 2 is out Due Wed after Fall Break Robot-wide paths PA 1 is due next Wed Don t use incrementor 4 times
More informationMIPS Assembly Language
MIPS Assembly Language Chapter 15 S. Dandamudi Outline MIPS architecture Registers Addressing modes MIPS instruction set Instruction format Data transfer instructions Arithmetic instructions Logical/shift/rotate/compare
More informationECE 2035 Programming HW/SW Systems Fall problems, 6 pages Exam One 22 September Your Name (please print clearly) Signed.
Your Name (please print clearly) This exam will be conducted according to the Georgia Tech Honor Code. I pledge to neither give nor receive unauthorized assistance on this exam and to abide by all provisions
More informationEE 109 Unit 13 MIPS Instruction Set. Instruction Set Architecture (ISA) Components of an ISA INSTRUCTION SET OVERVIEW
1 2 EE 109 Unit 13 MIPS Instruction Set Architecting a vocabulary for the HW INSTRUCTION SET OVERVIEW 3 4 Instruction Set Architecture (ISA) Defines the of the processor and memory system Instruction set
More informationComputer Architecture
CS3350B Computer Architecture Winter 2015 Lecture 4.2: MIPS ISA -- Instruction Representation Marc Moreno Maza www.csd.uwo.ca/courses/cs3350b [Adapted from lectures on Computer Organization and Design,
More informationAdventures in Assembly Land
Adventures in Assembly Land What is an Assembler ASM Directives ASM Syntax Intro to SPIM Simple examples L6 Simulator 1 A Simple Programming Task Add the numbers 0 to 4 10 = 0 + 1 + 2 + 3 + 4 In C : int
More informationCharacter Is a byte quantity (00~FF or 0~255) ASCII (American Standard Code for Information Interchange) Page 91, Fig. 2.21
2.9 Communication with People: Byte Data & Constants Character Is a byte quantity (00~FF or 0~255) ASCII (American Standard Code for Information Interchange) Page 91, Fig. 2.21 32: space 33:! 34: 35: #...
More informationENCM 369 Winter 2013: Reference Material for Midterm #2 page 1 of 5
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
More informationIntroduction to the MIPS. Lecture for CPSC 5155 Edward Bosworth, Ph.D. Computer Science Department Columbus State University
Introduction to the MIPS Lecture for CPSC 5155 Edward Bosworth, Ph.D. Computer Science Department Columbus State University Introduction to the MIPS The Microprocessor without Interlocked Pipeline Stages
More informationCSc 256 Midterm 2 Spring 2012
CSc 256 Midterm 2 Spring 2012 NAME: 1a) You are given this MIPS assembly language instruction (i.e., pseudo- instruction): ble $12, 0x20004880, there Translate this MIPS instruction to an efficient sequence
More informationECE 2035 Programming HW/SW Systems Fall problems, 6 pages Exam Two 21 October 2016
Instructions: This is a closed book, closed note exam. Calculators are not permitted. If you have a question, raise your hand and I will come to you. Please work the exam in pencil and do not separate
More informationExam in Computer Engineering
Exam in Computer Engineering Kurskod D0013E/SMD137/SMD082/SMD066 Tentamensdatum 2010-10-29 Skrivtid 14.00-18.00 Maximalt resultat 50 poäng Godkänt resultat 25 poäng Jourhavande lärare Andrey Kruglyak Tel
More informationNumber Representations
Simple Arithmetic [Arithm Notes] Number representations Signed numbers Sign-magnitude, ones and twos complement Arithmetic Addition, subtraction, negation, overflow MIPS instructions Logic operations MIPS
More informationChapter 6. Digital Design and Computer Architecture, 2 nd Edition. David Money Harris and Sarah L. Harris. Chapter 6 <1>
Chapter 6 Digital Design and Computer Architecture, 2 nd Edition David Money Harris and Sarah L. Harris Chapter 6 Chapter 6 :: Topics Introduction Assembly Language Machine Language Programming Addressing
More informationMark Redekopp, All rights reserved. EE 352 Unit 3 MIPS ISA
EE 352 Unit 3 MIPS ISA Instruction Set Architecture (ISA) Defines the software interface of the processor and memory system Instruction set is the vocabulary the HW can understand and the SW is composed
More informationCS 61c: Great Ideas in Computer Architecture
MIPS Functions July 1, 2014 Review I RISC Design Principles Smaller is faster: 32 registers, fewer instructions Keep it simple: rigid syntax, fixed instruction length MIPS Registers: $s0-$s7,$t0-$t9, $0
More informationReview. Lecture #9 MIPS Logical & Shift Ops, and Instruction Representation I Logical Operators (1/3) Bitwise Operations
CS6C L9 MIPS Logical & Shift Ops, and Instruction Representation I () inst.eecs.berkeley.edu/~cs6c CS6C : Machine Structures Lecture #9 MIPS Logical & Shift Ops, and Instruction Representation I 25-9-28
More informationEE108B Lecture 3. MIPS Assembly Language II
EE108B Lecture 3 MIPS Assembly Language II Christos Kozyrakis Stanford University http://eeclass.stanford.edu/ee108b 1 Announcements Urgent: sign up at EEclass and say if you are taking 3 or 4 units Homework
More informationCOMPUTER ORGANIZATION AND DESIGN
COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Interface 5 th Edition Chapter 3 Arithmetic for Computers Arithmetic for Computers Operations on integers Addition and subtraction Multiplication
More informationCHW 362 : Computer Architecture & Organization
CHW 362 : Computer Architecture & Organization Instructors: Dr Ahmed Shalaby Dr Mona Ali http://bu.edu.eg/staff/ahmedshalaby14# http://www.bu.edu.eg/staff/mona.abdelbaset Assignment What is the size of
More informationECE 2035 Programming HW/SW Systems Fall problems, 6 pages Exam One 19 September 2012
Instructions: This is a closed book, closed note exam. Calculators are not permitted. If you have a question, raise your hand and I will come to you. Please work the exam in pencil and do not separate
More informationCS 4200/5200 Computer Architecture I
CS 4200/5200 Computer Architecture I MIPS Instruction Set Architecture Dr. Xiaobo Zhou Department of Computer Science CS420/520 Lec3.1 UC. Colorado Springs Adapted from UCB97 & UCB03 Review: Organizational
More informationFlow of Control -- Conditional branch instructions
Flow of Control -- Conditional branch instructions You can compare directly Equality or inequality of two registers One register with 0 (>,
More informationExamples of branch instructions
Examples of branch instructions Beq rs,rt,target #go to target if rs = rt Beqz rs, target #go to target if rs = 0 Bne rs,rt,target #go to target if rs!= rt Bltz rs, target #go to target if rs < 0 etc.
More informationsoftware hardware Which is easier to change/design???
CS152 Computer Architecture and Engineering Lecture 2 Review of MIPS ISA and Performance January 27, 2003 John Kubiatowicz (http.cs.berkeley.edu/~kubitron) lecture slides: http://inst.eecs.berkeley.edu/~cs152/
More informationCOMPSCI 313 S Computer Organization. 7 MIPS Instruction Set
COMPSCI 313 S2 2018 Computer Organization 7 MIPS Instruction Set Agenda & Reading MIPS instruction set MIPS I-format instructions MIPS R-format instructions 2 7.1 MIPS Instruction Set MIPS Instruction
More informationReview: Organization. CS152 Computer Architecture and Engineering Lecture 2. Review of MIPS ISA and Design Concepts
Review: Organization Processor Input CS52 Computer Architecture and Engineering Lecture 2 Control Review of MIPS ISA and Design Concepts path Output January 26, 24 John Kubiatowicz (http.cs.berkeley.edu/~kubitron)
More informationCS3350B Computer Architecture MIPS Instruction Representation
CS3350B Computer Architecture MIPS Instruction Representation Marc Moreno Maza http://www.csd.uwo.ca/~moreno/cs3350_moreno/index.html Department of Computer Science University of Western Ontario, Canada
More informationComputer Organization MIPS ISA
CPE 335 Computer Organization MIPS ISA Dr. Iyad Jafar Adapted from Dr. Gheith Abandah Slides http://www.abandah.com/gheith/courses/cpe335_s08/index.html CPE 232 MIPS ISA 1 (vonneumann) Processor Organization
More informationEE 109 Unit 8 MIPS Instruction Set
1 EE 109 Unit 8 MIPS Instruction Set 2 Architecting a vocabulary for the HW INSTRUCTION SET OVERVIEW 3 Instruction Set Architecture (ISA) Defines the software interface of the processor and memory system
More informationMidterm. Sticker winners: if you got >= 50 / 67
CSC258 Week 8 Midterm Class average: 4.2 / 67 (6%) Highest mark: 64.5 / 67 Tests will be return in office hours. Make sure your midterm mark is correct on MarkUs Solution posted on the course website.
More informationECE260: Fundamentals of Computer Engineering
MIPS Instruction Set James Moscola Dept. of Engineering & Computer Science York College of Pennsylvania Based on Computer Organization and Design, 5th Edition by Patterson & Hennessy MIPS Registers MIPS
More informationECE260: Fundamentals of Computer Engineering
MIPS Instruction Set James Moscola Dept. of Engineering & Computer Science York College of Pennsylvania Based on Computer Organization and Design, 5th Edition by Patterson & Hennessy MIPS Registers MIPS
More informationInstruction Set Architecture part 1 (Introduction) Mehran Rezaei
Instruction Set Architecture part 1 (Introduction) Mehran Rezaei Overview Last Lecture s Review Execution Cycle Levels of Computer Languages Stored Program Computer/Instruction Execution Cycle SPIM, a
More information