Docsity

Computer Organization and Systems Programming - Quiz 3 | CSE 30, Quizzes of Computer Science

Partial preview of the text

Download Computer Organization and Systems Programming - Quiz 3 | CSE 30 and more Quizzes Computer Science in PDF only on Docsity!

Name:

cs30x____

Score:

Quiz 3

CSE 30

Fall 2002

a) Write the appropriate save instruction to allocate stack space for the following local variables and any padding. char a; unsigned short b; char c; short d; int e; save _________ , ______________________________ , _________ (Use the formula, not an absolute value) b) Write the appropriate unoptimized SPARC assembly instructions using the above local variables. c = โ€™Aโ€™;

d = -9876;

e = b;

c = a;

(OVER)

a) Write the appropriate save instruction to allocate stack space for the following local variable declara- tion. short a[6]; save _________ , ______________________________ , _________ (Use the formula, not an absolute value) b) Write the appropriate instructions to perform the following assignment statements. a[5] = a[3];



a[2] = a[1];



short ptr; / ptr mapped to %l1 */ ptr = &a[0];


ptr++; /* ptr mapped to %l1 */


i = ptr; / i mapped to %l0; ptr to %l1 */


ptr = i; / i mapped to %l0; ptr to %l1 */