Quiz3.fa07

SPARC Architecture, Assembly Language Programming, and C (2nd Edition)

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

View Full Document Right Arrow Icon
Signature __________________ Name___________________ cs30x____ Student ID _________________ Score: Quiz 3 CSE 30 Spring 2007 #1. a) Write the appropriate save instruction to allocate stack space for the following local variables and any padding. short a; char b; unsigned short c; int d; char e; float f; save _________ , ______________________________ , _________ (Use the formula, not an absolute value) b) Write the appropriate unoptimized SPARC assembly instructions using the above local variables. d = b; a = -9876; e = ’B’; a = c; (OVER)
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. a) Write the appropriate save instruction to allocate stack space for the following local variable declaration . short a[9]; save _________ , ______________________________ , _________ (Use the formula, not an absolute value)
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: b) Write the appropriate instructions to perform the following assignment statements. a[7] = a[4]; ________________________ ________________________ a[5] = a[1]; ________________________ ________________________ short *ptr; /* ptr mapped to %l5 */ ptr = &a[1]; ________________________ ++ptr; /* ptr mapped to %l5 */ ________________________ short d = *ptr; /* d mapped to %l2; ptr to %l5 */ ________________________ *ptr = d; /* d mapped to %l2; ptr to %l5 */ ________________________ #3. Write the equivalent C expression for an array index access. Remember scaling is done automatically by the compiler. float a[10]; . a[i] is equivalent to _____________________________ (equivalent pointer expression) ....
View Full Document

Page1 / 2

Quiz3.fa07 - b) Write the appropriate instructions to...

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