EE319KMid-Term1F10

# EE319KMid-Term1F10 - 1/7 EE 319K Fall 2010 First Mid-Term...

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

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

View Full Document

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.

Unformatted text preview: 1/7 EE 319K Fall 2010 First Mid-Term Dr. Ramesh Yerraballi Full Name (eid) : ( ) Duration : 75 minutes This is a closed book exam; No calculators are allowed; Write answers within the space provided after each of the questions. There are THREE questions on the test with several sub-questions, read all of them first so you may properly allocate your time to answer them. If you need extra space, you may write on the backside of the sheets. 1. [ 50 pts ] Answer the following i. [12 points] Consider the following two 8-bit number numbers: P : %10011011, Q : %00100101 a. What decimal values do P and Q represent if they are 8-bit unsigned integers? P :___________________________ Q :___________________________ b. What decimal value do P and Q represent if they are 8-bit signed integers? P :___________________________ Q :___________________________ c. What are the values of the N, Z, C and V bits. When P and Q are added: ldaa #%10011011 adda #%00100101 N: Z: C: V: ii. [4 points] What will be the value of the B register after executing the following? ldab #\$A5 ;B = %10100101 (\$A5) asrb ;B = %11010010 (\$D2) eorb #\$7F ;B = %11010010 ^ %01111111 = %10101101 (\$AD) lslb ;B = %01011010 (\$5A) Register B: \$5A 2/7 iii. [8 points] Write the assembly code equivalent of the following C code snippet. Assume that there are assembly routines by the same names foo and bar that you can call. Specifically, you must declare global variables x1 and x2 and write the code for the while statement. unsigned char x1, x2; . . // x1 and x2 are . // computed here . while (x1 < x2) { foo(); } bar(); iv. [6 points] What are the values of registers A and B after execution of the following program? [Hint: Do not assume, trace the program flow and register contents] org \$4000 main ldaa #16 ; RegA initialized to 16 ldab #8 ; RegB initialized to 8 loop decb ; In loop: we decrement B:7->6->5->4 asla ; multiply A by 2: 32->64->128->256(0) bne loop ; and repeat till A becomes zero stop ; A becomes when it we put 256 in it org \$FFFE ; Note: I could have used bcc instead fdb main ; bne to check for overflow Register A: Register B: 4 3/7 v. [8 points] The values of relevant registers and memory locations at the start of execution of the following code sequence and given to the right. What are their values after completion of the code sequence? Code Sequence ldd #\$F00D std 2,-SP ldab 0,SP ldaa 1,SP Before After Reg D: \$0000 _______ Reg SP: \$4000 _______ Mem[\$3FFE]: \$ABCD ________ vi. [12 points] For each of the instructions below, fill in what addressing mode is used and how many read and write bus cycles does it take. The bus cycles of the first instruction has been filled for you....
View Full Document

{[ snackBarMessage ]}

### Page1 / 7

EE319KMid-Term1F10 - 1/7 EE 319K Fall 2010 First Mid-Term...

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

View Full Document
Ask a homework question - tutors are online