Homework 2 99

Homework 2 99 - EE 4720 Homework 2 Due: 19 February 1999...

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

View Full Document Right Arrow Icon
EE 4720 Homework 2 Due: 19 February 1999 The SPARC assembly language program below is used in the problems that follow. SPARC register names are %g0-%g7 , %i0-%i7 , %l0-%l7 , and %o0-%o7 ; and %g0 is a zero register (like r0 in DLX). The destination for arithmetic, logical, and load instructions is the rightmost register ( add %l1,%l2,%l3 means %l3=%l1+%l2 ). SPARC uses a condition code register and special condition- code-setting instructions for branches. Branches include a delay slot. LOOP: ld [%l1], %l2 ! Load l2 = MEM[ l1 ] addcc %l2, %g0, %g0 ! g0 = g0 + l2. Sets cond. codes. Note: g0 is zero reg. be DONE ! Branch if result zero. nop ! Fill delay slot with nop. add %l6, %l2, %l6 ! l6 = l6 + l2 andcc %l3, 1, %g0 Sets cond. codes. Note: g0 is zero reg. be SKIP1 nop add %l4, 1, %l4 SKIP1: subcc %l3, 1000, %g0 bpos SKIP2 ! Branch if >= 0; nop add %l4, %l3, %l4 SKIP2: andcc %l3, 1, %g0 be SKIP3 nop add %l4, %l4, %l4 SKIP3: add %l1, 4, %l1 ba LOOP ! Branch always. (Jump.)
Background image of page 1

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

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

This note was uploaded on 08/01/2009 for the course EE 4720 taught by Professor Staff during the Spring '08 term at LSU.

Page1 / 2

Homework 2 99 - EE 4720 Homework 2 Due: 19 February 1999...

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

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