11 questions on Microprocessor System Design | ECE 2534, Exams of Microprocessors

Material Type: Exam; Class: Microcontroller Interfacing; Subject: Electrical & Computer Engineer; University: Virginia Polytechnic Institute And State University; Term: Spring 2009;

Typology: Exams

Pre 2010

Uploaded on 02/25/2010

grantb2
grantb2 🇺🇸

1

(1)

12 documents

1 / 5

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Page 1
MIDTERM EXAMINATION
ECE 2534: MICROPROCESSOR SYSTEM DESIGN
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.
pf3
pf4
pf5

Partial preview of the text

Download 11 questions on Microprocessor System Design | ECE 2534 and more Exams Microprocessors in PDF only on Docsity!

MIDTERM EXAMINATION

ECE 2534: MICROPROCESSOR SYSTEM DESIGN

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.

  1. (8 points) Convert these 8-bit 2's-complement numbers to decimal form.

a) ( 00100011 ) 2 cm

b) ( 10111111 ) 2 cm

  1. (8 points) Convert the following decimal numbers to 8-bit 2's-complement form, if that is possible. If it is not possible, carefully explain why this is so.

a) 65

b) 128

  1. (9 points) This question concerns the MicroBlaze microcontroller. a) If r9 contains the value 0xE0000000 and the Carry bit is 1, then the instruction srl r9,r9 will cause r9 to contain the value _____________________.

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 _____________________.

  1. (8 points) You have been told that the on-chip memory (the “block RAM”) for the MicroBlaze has addresses from 0x0 to 0x3FF. What is the maximum number of MicroBlaze machine instructions that could be placed in the on-chip memory?
  1. (20 points). Write a complete MicroBlaze assembly-language subroutine called AVERAGE16 that computes the average (the mean value) of an array of 16 integers. As usual for arrays, these integers are stored one after the other in memory. The address for the first integer of the array is passed as a parameter to the subroutine in register r5. The result (the computed average) should be returned to the calling program in register r3. Use r15 as the link register.

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.

  1. (10 points) Consider the following complete C/C++ program, which has been written for the Spartan3E board. It compiles with no errors or warnings using mb-gcc. You may assume that the given addresses for the switches and LEDs are correct.

///////////////////////////////////////////////////////// // 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.