{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

EE319KMid-Term1S11-MW

# EE319KMid-Term1S11-MW - 1/8 EE 319K Spring 2011 First...

This preview shows pages 1–6. Sign up to view the full content.

1/8 EE 319K Spring 2011 First Mid-Term Dr. Ramesh Yerraballi Full Name : Duration : 75 minutes EID :__________________________ Instructions : This is a closed book exam No calculators are allowed Write answers within the box/space provided after each of the questions. If you need more space, you may write on the back of the sheets. There are SEVEN questions on the test, read all of them first so you may properly allocate your time to answer them. Score Sheet Question Max Your Score 1 12 2 8 3 10 4 10 5 15 6 15 7 30

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

View Full Document
2/8 1. [12 pts ] Give the binary representations for the following i. The signed 5 bit number -14? ii. The unsigned 5-bit number 23? iii. What are the largest unsigned and smallest signed 5-bit numbers one can represent (in decimal)? 2. [ 8 pts ] Identify the addressing modes used in each of the following instructions: Instruction Addressing Modes ldd \$44 psha bra ofatree movb foo,bar bset DDRP,#128 3. [10 points] The values of N, Z, C and V flags are 0, 0, 1 and 1 respectively after a comparison operation was performed. Which of the branches will be taken/not taken (put a check mark). Branch Taken Not Taken bge blt blo bne bhs
3/8 [Yes/No] [Give your reasoning] 4. [10 pts] Answer the following a. [4 pts] How much time does one clock cycle take on the DP512/DG128 when operating in Run mode? b. [2 pts] Memory-mapped I/O means that the same operations we use to read from and write to memory can be used to read from and write to I/O devices. [True/False] c. [2 pts] Say, your program has subroutines that are called from main . What happens if you do not initialize the stack pointer with a statement like: lds #\$4000 [Answer in no more than 15 words] d. [2 pts] The following piece of code is intended to swap the contents of registers A and B pshd pula pulb Does it work? 5. [ 15 pts ] Assume the following instruction: puld is located at address \$401A . Memory contents of locations where the stack pointer is pointing to are given below. The stack pointer itself has a value of \$3FFC . \$00 \$20 SP -> \$3FFC \$10 \$40 \$30 \$00

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

View Full Document
4/8 Complete the following table showing the contents of the R/W bus line, Address bus lines, the Data bus lines, and registers, PC, SP, when the puld instruction is executed: R/W Addr Data PC SP R \$4050 \$3A \$4051 \$3FF0 W \$3FEE \$12 \$4051 \$3FEE W \$3FEF \$34 \$4051 \$3FEE (Use as many rows as needed) 6. [ 15 pts ] Given the following assembly code Assembly Code Res rmb 1 . . . clr Res ldab #12 loop ldaa Res aba staa Res dbne B,loop a. [5 points] What does the code do? i. Stores in Res , the sum of all odd numbers from 12 down to 1. ii. Stores in Res , the sum of all numbers from 12 down to 1. iii. Stores in Res , the value 144, which is 12 added to itself 12 times. iv. Stores in Res , the sum of all even numbers from 12 down to 1. v. Stores in Res , the number of 1’s in the binary representation of 12. b. [10 points] Write the C equivalent of the above assembly code Hint : Do not try to do a line-by-line translation. It is easier if you understand what is being done in assembly and then rewrite it in C.
5/8 7. [ 30 pts ] You are asked to write a software module that controls an LED on a fishing rod. When fish bite on the bait they often peck at the bait, which could temporarily

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}