hw2soln - a. a. b. 2903506946 add f, g, h 4294947667 add f,...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: a. a. b. 2903506946 add f, g, h 4294947667 add f, f, i add f, f, j addi f, h, 5 f, f, g 2.7.3addi b. a. AD100002 Summer 2009 b. FFFFB353 2.1.2 a. b. 3 2 Prof. Schimmel 2.7.4 a. ECE 3055 Computer Architecture and OS Chapter 2 Solutions 01111111111111111111111111111111 b. 1111101000 2.1.3 S27 2.7.5 b. 2.9.310 a. 7FFFFFFF a. no overflow 2.1.4 b. 3E8 b. overflow a. f = g + h = g + h a. 14 Homework 2 Solution 2.7.6f b. 2.9.4 a. b. a. 80000001 no overflow 5 a. no 2.1.5 overflow b. FFFFFC18 2.9.5 Solution 2.8 2.8.1 Solution 2.2 a. 1D100002 b. 6FFFB353 2.2.1 b. 5 a. 7FFFFFFF, no Chapter 2 Solutions overflow 2.9.6add b. b. a. b. a. 80000000, overflow add f, f, f f, f, i a. 2.8.2487587842 add f, f, addi f, j, 2 g 1879028563 60000001, no overflow Chapter 2 Solutions S29 Solution 2.10 2.10.1 2.8.3 b. a. add sw $v1, $at, $v0 $a1, 4($s0) 64($t0) overflow b. 0, 2.11.5 no overflow Chapter 2 $t3, 4($s0) Solutions a. sw EFFFFFFF, overflow b. lw C0000000, 2.11.6 $t0, 2.10.4 2.10.2 2.8.4 b. a. a. a. b. b. b. a. 0x00221820 0xAD450004 I-type ow 0x01004020 overfl I-type ow 0x8E690004 no overfl Solution 2.12 2.12.1 2.10.3 2.8.5 2.10.5 a. a. a. a. b. b. b. b. Type AE0B0004 opcode no overflow R-type R-type 8D080040 no overflow I-type R-type 6 6 rs 3 5 rt 3 5 rd 3 5 shamt 5 5 funct 6 6 total bits = 26 total bits = 32 2.8.6 2.10.6 2.12.2 a. a. b. b. a. b. overflow op=0x0, rd=0x8, rs=0x8, rt=0x0, funct=0x0 Type opcode rs rt no overflow op=0x23, rs=0x13, rt=0x9, imm=0x4 I-type 6 3 3 I-type 6 5 5 immed 16 10 total bits = 28 total bits = 26 Solution 2.9 Solution 2.11 2.12.3 2.9.1 2.11.1 registers less bits per instruction could reduce code size a. less a. overflow less registers more register spills more instructions 2.19.3 Solution 2.12 after calling a. 2.12.1 $sp => old $sp => Type function compare: 0x7ffffffc ??? 4 contents of register $ra opcode rs rt rd shamt funct 3 5 6 ??? 5 5 contents of register 6 $ra contents of register $ra compare total bits = 26 total bits = 32 #return to a. b. after calling function sub: R-type 6 3 3 old $sp => 0x7ffffffc R-type 6 5 4 5 $sp => 8 2.12.2 after b. a. b. calling function fib_iter: old $sp => 0x7ffffffc ??? Type opcode rs rt 4 contents of 8 contents of I-type 6 3 3 12 contents of $sp => 16 contents of I-type 6 5 5 immed register $ra register $s0 16 register $s1 register $s2 10 total bits = 28 total bits = 26 2.12.3 2.19.4 less registers less bits per instruction could reduce code size f: addi $sp,$sp,8 less registers more register spills more instructions sw $ra,4($sp) sw $s0,0($sp) b. smaller constants more lui instructions could increase code size move $s0,$a2 smaller constants smaller opcodes smaller code size jal func move $a0,$v0 $a1,$s0 2.12.4 move jal func lw $ra,4($sp) a. 17367056 lw $s0,0($sp) addi b. 2366177298 $sp,$sp,8 jr $ra a. a. 2.12.5 a. b. add lw $t0, $t1, $0 $t1, 12($t0) ...
View Full Document

This note was uploaded on 07/30/2009 for the course ECE 3055 taught by Professor Staff during the Spring '08 term at Georgia Institute of Technology.

Ask a homework question - tutors are online