ECE314sp08_HW2

ECE314sp08_HW2 - ECE/CS 314 Spring 2008 Homework 2 Hung...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
1 ECE/CS 314 Spring 2008 Homework 2 Hung Dang (hvd2) Due Tuesday, Feb 19, 2006 before 10:00pm EST Problem 1. Endian Representation (15 points) The following assembly code sequence is executed on two different machines, one of which is big-endian and the other little-endian. lw $6, 0($5) lh $7, 4($5) lhu $8, 6($5) lui $9, 0xFEED ori $9, $9, 0xBABE lb $10, 11($5) lbu $11, 14($5) ori $12,$12,0xBABE lui $12, 0xFEED lb $13, 6($5) The initial contents of memory are the same on both machines, as shown in below. Word Address Byte Offset 00 01 10 11 0x2000F000 0xDE 0xAD 0xC0 0xDE 0x2000F004 0xAB 0xC1 0x23 0xD0 0x2000F008 0xCA 0xFE 0xF0 0x0D 0x2000F00C 0xF1 0x23 0xFA 0xCE a) Contents of the registers on the big-endian machine after execution of all instructions (assume $6 to $13 are initially 0): $5 0x2000F000 $6 0xdeadc0de $7 0xffffabc1 $8 0x000023d0 $9 0xfeedbabe $10 0x0000000d $11 0x000000fa $12 0xfeedbabe $13 0x00000023
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2 b) Contents of the registers on the little-endian machine after execution of all instructions (assume $6 to $13 are initially 0): $5 0x2000F000 $6 0xdec0adde $7 0xc1abffff $8 0xd0230000 $9 0xbebaedfe $10 0x0d000000 $11 0xfa000000 $12 0xbebaedfe $13 0x23000000
Background image of page 2
3 Problem 2. Answer the following questions about the following MIPS function (15 points) foo: addiu $29,$29,(-72) sw $31,40($29) sw $s0,20($29) sw $s1,24($29) sw $s5,28($29) sw $s2,32($29) sw $s7,36($29) sw $a0,72($29) sw $a2,80($29) # … more instructions (X) … or $a0,$0,$a1 or $a1,$0,$a2 or $a2,$0,$a3 lw $a3,88($29) lw $t0,92($29) sw $t0,16($29) jal boo # … more instructions (Y) … lw $s7,36($29) lw $s2,32($29) lw $s5,28($29) lw $s1,24($29) lw $s0,20($29) lw $31,40($29) addiu $29,$29,72 jr $31 (a) What is the size, in words, of foo’s stack frame? 18 (b) How many arguments does foo have? 5 (c) How many words are reserved in foo’s stack frame to preserve “saved registers”? What are the stack frame offsets (in bytes) for each of these registers?
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 09/03/2008 for the course ECE 3140 taught by Professor Mckee/long during the Spring '07 term at Cornell.

Page1 / 9

ECE314sp08_HW2 - ECE/CS 314 Spring 2008 Homework 2 Hung...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online