



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Exam; Class: Microcontroller Interfacing; Subject: Electrical & Computer Engineer; University: Virginia Polytechnic Institute And State University; Term: Spring 2009;
Typology: Exams
1 / 5
This page cannot be seen from the preview
Don't miss anything!




Spring 2009
NAME (print): ______________________________________________
STUDENT ID: ______________________________________________
Honor system pledge: I have neither given nor received unauthorized aid on this exam.
SIGNATURE: ______________________________________________
Ground rules. Please read carefully.
Do not open the exam until the instructor says to begin. All work on this exam must be your own. If you have questions during the exam, ask the instructor. Do not communicate with another student. This is a closed-book exam. No books or notes are allowed. No electronic devices are permitted. The exam is worth 100 points. Time limit: 50 minutes. The exam consists of 11 problems on 5 pages. There is also an extra-credit problem at the end. Be sure that all pages are present in your copy. In addition to the regular exam pages, the instructor will provide you with Table 1-6 from the Microblaze Processor Reference Guide. You do not need to return that handout after the exam. Solve every problem. Clearly show how you arrive at each answer, and clearly indicate your final answers. Partial credit is possible on most problems. If you need additional space to work a problem, continue on the back of the page. If a question seems ambiguous, give your reasons and state your assumptions clearly. Unless otherwise indicated, all references to the MicroBlaze processor specifically mean the current version on this semester’s Spartan3E boards. Check the front of the classroom occasionally for important corrections or announcements. Print your name or initials on each page of this exam. This will help ensure that you receive proper credit even if the pages become separated.
a) 65
b) 128
b) If r9 contains the value 0xE0000000 and the Carry bit is 1, then the instruction src r9,r9 will cause r9 to contain the value _____________________.
c) If r9 contains the value 0xE0000000 and the Carry bit is 1, then the instruction sra r9,r9 will cause r9 to contain the value _____________________.
For full credit, your subroutine must use a loop to access elements of the array. Do not alter the contents of the array. Your subroutine does not need to check for overflow conditions. The subroutine does not need to preserve any register contents, and it is not required to use the system stack. Because the size of the array is a power of 2, the subroutine should use some instruction(s) other than idiv, idivu, or fdiv to do the necessary division for computing the average. Don’t worry about rounding the result.
///////////////////////////////////////////////////////// // PROGRAM: ex1.cpp
// Peripherals volatile unsigned int * const SWITCHREG = (unsigned int)0x84110000; volatile unsigned int * const LEDREG = (unsigned int)0x84130000;
// Main program int main(void) { int sw;
while (1) { sw = (*SWITCHREG) & 0x4; if (sw == 0) *LEDREG = 0x55; else *LEDREG = 0xaa; } return 0; }
For reference, here is a diagram that gives information about switches on the Spartan board.
In the space below, give a brief, high-level description of what the program does at a high level.^ When the program runs, what will the user observe on the Spartan3E board? Please provide just 2 or 3 complete English sentences – no flow charts, no pseudocode, no explanations of individual instructions.