S10_test2_practice

S10_test2_practice - ECE 332 Spring 2010 Test 2 Practice Page 1 of 7 Boise State University Department of Electrical and Computer Engineering ECE

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

View Full Document Right Arrow Icon

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

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

Unformatted text preview: ECE 332 Spring 2010 Test 2 Practice Page 1 of 7 Boise State University Department of Electrical and Computer Engineering ECE 332 Microprocessors, Practice Test 2 – S Name: ______________________________ Reference during test: Nios II Processor Reference Handbook NO CALCULATORS! If you finish early, go back and check your work. You do not receive extra credit for finishing early. For all problems utilize proper register conventions. 1. (15 points) Using the following code to complete the memory snapshot when execution reaches the return 0 statement. Assume that execution is currently at the highlighted instruction. // file: structures.c struct abc { unsigned int a; unsigned char b; unsigned short c; }; int main( void ) { unsigned int a; struct abc x; unsigned int b; struct abc y; unsigned int c; a = 0xaaaaaaaa; b = 0xbbbbbbbb; c = 0xcccccccc; x.a = 0x11111111; x.b = 0x22; x.c = 0x3333; y = x; return 0; } Registers snapshot Current Memory Snapshot In the blank snapshot below show the memory values after the program runs to completion. Memory Snapshot at end of program (word format) ECE 332 Spring 2010 Test 2 Practice Page 2 of 7 2. (10 points) For the following code show the resulting output when program runs to completion. #include <stdio.h> typedef unsigned short ui16; int main( void ) { ui16 nbrs = {111, 222, 333, 444, 555 }; ui16 *pnbrs; pnbrs = nbrs; printf( "size of nbrs: %d\n" , sizeof (nbrs)); printf( "size of pnbrs: %d\n" , sizeof (pnbrs)); printf( "%d\n" , *pnbrs); pnbrs += 2; printf( "%d\n" , *pnbrs); pnbrs++; printf( "%d\n" , *pnbrs); pnbrs -= 2; printf( "%d\n" , *pnbrs);...
View Full Document

This document was uploaded on 11/02/2011 for the course ECE 332 at Boise State.

Page1 / 7

S10_test2_practice - ECE 332 Spring 2010 Test 2 Practice Page 1 of 7 Boise State University Department of Electrical and Computer Engineering ECE

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

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