Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

MIPS Instruction Set and Computer Architecture, Summaries of Architecture

Information about the MIPS instruction set, including opcode values, instruction formats for types A, B, C, and D, and examples of MIPS instructions and their corresponding pseudoinstructions. It also includes a problem set from a Computer Architecture course at Rose-Hulman Institute of Technology, which covers topics such as variable length instructions, addressing modes, and MIPS assembly language.

Typology: Summaries

2021/2022

Uploaded on 08/05/2022

nguyen_99
nguyen_99 🇻🇳

4.2

(82)

1K documents

1 / 10

Toggle sidebar

Related documents


Partial preview of the text

Download MIPS Instruction Set and Computer Architecture and more Summaries Architecture in PDF only on Docsity! CSSE 232 – Computer Architecture I Rose-Hulman Institute of Technology Fall 2005-2006 Computer Science and Software Engineering Profs. Archana Chidanandan and Larry Merkle 1 of 10 Exam 1 - Solutions Name:____________________________________________________ Instructions: • Write all answers on these pages. Use the back as necessary. • Clearly indicate your final answer. • For full credit, show your work, and document your code. • Read the entire examination before starting, and then budget your time. Authorized resources: • Green reference card from the text. Unauthorized resources: You are NOT permitted to use any resources other than those identified above. In particular, you may NOT use books, notes, electronic files, calculators, PDAs, or computers. Good luck! Problem Number Maximum Points Points Earned 1a 12 1b 12 1c 8 1d 8 2a 12 2b 17 3 16 4 14 Total 99 + 1 bonus CSSE 232 – Computer Architecture I Rose-Hulman Institute of Technology Fall 2005-2006 Computer Science and Software Engineering Profs. Archana Chidanandan and Larry Merkle 2 of 10 Problems Problem 1a.[12 points] List the machine language fields and obtain the hexadecimal representation for the following MIPS instructions: lw $t0, 4($t1) Opcode = 35; rs = $t1 = $9; rt = $t0 = $8; 16-bit signed immediate = 0x4 0x8d280004 addi $s2, $s1, -5 Opcode = 8; rs = $s1 = $17; rt = $s2 = $18; 16-bit signed immediate = -5 0x2232fffb sub $t3, $t5, $a0 Opcode = 0; Funct = 34; rs = $t5 = $13; rt = $a0 = $4; rd = $t3 = $11 0x01a45822 Problem 1b. [12 points]Give the MIPS assembly language statements represented by each of the following: 0x27a50004 addiu $5, $29, 4 or addiu $a1, $sp,4 0x001a2082 srl $4, $26, 2 or srl $a0, $k0, 2 0x116a0004 beq $11, $10, 4 or beq $t3, $t2, loop CSSE 232 – Computer Architecture I Rose-Hulman Institute of Technology Fall 2005-2006 Computer Science and Software Engineering Profs. Archana Chidanandan and Larry Merkle 5 of 10 a. [12 points] Show the instruction format for each type i.e. A, B, C, and D. Indicate clearly how many bits are allocated for each field. Hint: Start with the C and D types. One possible solution: A type format 11 9 8 6 5 3 2 0 Opcode rd rs Function field B type format C type format D type format 11 9 8 6 5 3 2 0 Opcode rd rs rt b. [17 points] For each of the instructions below, assign a value for the opcode field, as well as values for any fields that augment the opcode (e.g. the funct field for MIPS R-type instructions) One possible assignment Instruction Opcode Values of fields that augment opcode Add 000 000 Sub 000 001 Jr 000 010 And 000 011 Or 000 100 Getinput 000 101 Putoutput 000 110 Addi 001 000 Beq 001 001 Bne 001 010 Lw 001 011 Sw 001 100 Sl 001 101 J 010 No field Jal 011 No field Rfe 100 No field Slt 101 No field 23 12 11 9 8 6 5 3 2 0 16-bit immediate Opcode rd rs Function field 11 9 8 0 Opcode 9-bit immediate CSSE 232 – Computer Architecture I Rose-Hulman Institute of Technology Fall 2005-2006 Computer Science and Software Engineering Profs. Archana Chidanandan and Larry Merkle 6 of 10 Problem 3[16 pts] For each pseudoinstruction listed below, give a minimal sequence of actual MIPS instructions to accomplish the same thing. You may need to use $at for some of the sequences. “big” refers to a 32-bit immediate value and “small” refers to a 16-bit immediate value. a. move $sp, $s0 add $sp, $s0, $0 b. li $a0, big lui $at, big[31:16] ori $a0, $at, big[15:0] c. lw $v0, big($k0) lui $at, big[31:16] add $at, $at, $k0 lw $v0, big[15:0]($at) d. ble $t8, $t9, label slt $at, $t9, $t8 beq $at, $0, Label CSSE 232 – Computer Architecture I Rose-Hulman Institute of Technology Fall 2005-2006 Computer Science and Software Engineering Profs. Archana Chidanandan and Larry Merkle 7 of 10 Problem 4 [14 pts] Complete the MIPS program on the following pages by filling in the provided spaces with MIPS assembly language statements such that: • The procedure dotProduct accepts three input parameters: the addresses of two arrays and the size of the arrays. • The procedure dotProduct returns the dot product of the vectors represented by the two arrays. • The procedure dotProduct follows MIPS register usage conventions. • The main program calls the procedure dotProduct in such a way that the dot product (0, 1, 2, 3, 4, 5, 6, 7, 8, 9) · (1, 2, 3, 4, 5, 6, 7, 8, 9, 10) = 0 + 2 + 6 + 12 + … + 90 = 330 is displayed. Assume the existence of another MIPS procedure product that returns in $v0 the product of its two integer parameters, which are passed in $a0 and $a1. In other words, even though product is not shown, you may call it, and you do not need to write it. Read all the provided parts of the program, before you begin.
Docsity logo



Copyright © 2024 Ladybird Srl - Via Leonardo da Vinci 16, 10126, Torino, Italy - VAT 10816460017 - All rights reserved