{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

EE319K-FinalS10

# EE319K-FinalS10 - 1/11 EE 319K Spring 2010 Final Exam...

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

1/11 EE 319K Spring 2010 Final Exam Ramesh Yerraballi TTh Full Name : Duration : 75 minutes This is a closed book exam; You may use your calculators; Write answers within the space provided after each of the questions. There are 7 questions on the test, read all of them first so you may properly allocate your time to answer them. Please provide comments for all code you write to help understand your answer and possibly award you partial credit. You may use the back of the sheets for extra space. 1. [4 points] In the FIFO implementation that uses a counter, what causes a race condition? How do you fix it? 2. [6 points] To convert from temperature expressed in Fahrenheit to Celsius, the following formula is used: C = (5/9)x(F-32) . Given the range of F is 0 to127, write C code that will do the conversion without the use of float/double declarations or casts. Specifically, write the appropriate declarations for F and C and the expression that realizes the given formula. 3. [5 points] For a clock frequency of 8 Mhz, \$______ should be written into the 9S12 SCIBD register to provide a bandwidth of 24 kbps. The protocol is 8 bits data. 1 start bit, 1 stop bit and no parity bit.

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

View Full Document
2/11 4. [20 pts] In the following code, the stack is used for passing an input parameter, a return value, local variables, and, to save registers that the subroutine modifies. The subroutine makes use of two local variables, which are accessed using Register X as the stack frame pointer. Read the comments to understand the code and pay attention to instructions to figure out the sizes of input/output parameters and variables. org \$0800 reslt rmb 2 org \$4000 main lds #\$4000 des ; Allocate space des ; for the return value movb #100,1,-sp ; Allocate and pass input parameter jsr sub ldd nnn ,sp ; get return value into reg D std reslt ; store result leas 3,sp ; De-allocate input and output space infty bra infty ;****************sub************* inp equ aaa ; binding for input parameter out equ bbb ; binding for return value sum equ ccc ; binding for local variable sum num equ ddd ; binding for local variable num sub pshx ; save register X tsx ; Setup Frame Pointer leas -2,sp ; Allocate space for sum leas -1,sp ; Allocate space for num ; ..... other stuff ..... ldaa inp,X ; get a copy of inp parameter ; ..... other stuff ..... -----> std out,X ; store RegD into out to return leas 3,sp ; De-allocate locals pulx ; restore RegX rts ; return org \$FFFE fdb main
3/11 4.1. [10 pts] What are the values of aaa, bbb, ccc, ddd and nnn ? aaa 4 bbb 5 ccc -2 ddd -3 nnn 1 4.2. [10 pts] Describe the contents (e.g., oldX in two bytes, local variable num ) of the stack after line indicated by the arrow ----> is executed: Address Contents \$3FF4 \$ 3FF5 \$3FF6 Num \$3FF7 Sum(High Byte) \$3FF8 Sum(Low Byte) \$3FF9 Saved Old X (High Byte) \$3FFA Saved Old X (Low Byte) \$3FFB Return Address (High Byte) \$3FFC Return Address (Low Byte) \$3FFD Inp \$3FFE Out (High Byte) \$3FFF Out (Low Byte) \$4000 Program Starts Here Note that the question clearly says that the local variables use Register X Stack Frame addressing. The tsx instruction makes X point to the address marked in table. All values in 4.1 except nnn are relative to this value of X.

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

View Full Document
4/11 5. [20 Points] Given the following FSM:
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}