ECE 2534 Test 1 2/19/08
1. Fill in the blanks in the .lst file given below.
1 .text
2 .globl subroutine
3 subroutine:
4 0000 00600000 add r3,r0,r0
5 0004 24E00020 ______________
6 label1:
7 0008 BCA50008 bgei r5,label2
8 000c 20630001 addi r3,r3,1
9 label2:
10 ____ ________ add r5,r5,r5
11 ____ 20E7FFFF addi r7,r7,-1
12 ____ ________ bgti r7,label1
13 001c B60F0008 rtsd r15,8
14 0020 80000000 nop
2. Write a header for the subroutine below. It is meant to be called from C.
.text
.globl subroutine
subroutine:
addi r6,r0,8
lwi r5,r1,4
label:
lw r8,r1,r6
add r5,r5,r8
addi r6,r6,4
rsubi r7,r6,40
bgei r7,label
addi r6,r0,10
idiv r3,r6,r5
rtsd r15,8
nop