midterm fall12

6
EEL4742 Embedded System Exam 1 Fall 2012 NAME ----------------------------- Closed BOOK /No Notes/ No Calculator (3.333 points for each problem). No questions can be answered on this exam. Read every question carefully, as no credit will be given for misread questions. For each problem pick the closet answer that you think is correct. Carefully check your answers on your answer sheet as the answer sheet is the only item that will be graded. No partial credit win be given on a problem. 1. In a type 0 instruction, the SI bit = 0, Source = 010, the DI bit = 1, and the Destination = 011, what instruction below best fits these set of bits (instruction, source, destination? J a. Mov (R2), (R3) @ Mov R2, (R3) c. Mov (R2), R3 d. MovR2,R3 2. In the general processor, the STOP / HP.LT instruction is best implemented by which type €mar instruction? / './ a. Type 0 b. Type 1 c. Type 2 @ Type 3 3. In the generic processor, which type 1 instruction describes relative addressing? / a. MOY (XR), R2 b. MOY (R5), R2 @ MOY (W + PC), R2 d. MOY (W + XR), R2 4. Given the following ALU operation, ALU out = A + B (NOT), with A = Ox0031 and B = Ox0042, what is the output of the ALU (+ = ADD operation)? / a. -Ox0011 b. OxOOll [) -Ox0012 d. OxOOl2 5. The ASCII code for the iower case "e" is? j @ Ox65 c.Ox64 d.Ox44 b.Ox45

Upload: mishal-patel

Post on 10-Jul-2016

229 views

Category:

Documents


0 download

DESCRIPTION

Embeded fall 12

TRANSCRIPT

Page 1: Midterm Fall12

EEL4742 Embedded SystemExam 1

Fall 2012NAME -----------------------------

Closed BOOK /No Notes/ No Calculator (3.333 points for each problem).

No questions can be answered on this exam. Read every question carefully, as no creditwill be given for misread questions. For each problem pick the closet answer that youthink is correct. Carefully check your answers on your answer sheet as the answer sheet isthe only item that will be graded. No partial credit win be given on a problem.

1. In a type 0 instruction, the SI bit = 0, Source = 010, the DI bit = 1, and the Destination = 011,what instruction below best fits these set of bits (instruction, source, destination?

Ja. Mov (R2), (R3)@ Mov R2, (R3)c. Mov (R2), R3d. MovR2,R3

2. In the general processor, the STOP / HP.LT instruction is best implemented by which type €marinstruction?

/'./

a. Type 0b. Type 1c. Type 2@ Type 3

3. In the generic processor, which type 1 instruction describes relative addressing?

/ a. MOY (XR), R2b. MOY (R5), R2@ MOY (W + PC), R2d. MOY (W + XR), R2

4. Given the following ALU operation, ALU out = A + B (NOT), with A = Ox0031 and B =Ox0042, what is the output of the ALU (+ = ADD operation)?

/a. -Ox0011b. OxOOll[) -Ox0012d. OxOOl2

5. The ASCII code for the iower case "e" is?

j@ Ox65 c.Ox64 d.Ox44b.Ox45

Page 2: Midterm Fall12

6. Given the following MSP430 Instruction: add.w r6, r7, which equation below will set theoverflow flag (V). Assume the results of this addition is stored in a register called result andr6(0) is the LSB ofr6 and r6(15) is the MSB ofr6.

a. V = r6(15)' r7(15) result(l5) + r6(15) r7(15)' result(lS)'@ V = r6(15)' r7(15)' result(15) + r6(15) r7(15) result(15)'c. V = 1'6(7)' 1'7(7)' result(7) + r6(7) 1'7(7) result(7)d. V = r6(7) r7(7)' result(7)' + r6(7') r7(7) result(7)

7: The register transfer language (RTL) statement Mem(lOOO) ~ RI + (R2)

a. Adds what is in Rl and R2 and stores the result in memory location 1000.b. Uses Rl as an address to obtain the data from memory and adds what is in R2 and

stores the result in memory location 1000.c. Uses Rl as an address to obtain the data from and uses R2 an address as an

address to get the data from and then adds them together and stores the result inmemory location 1000.t) Adds what is in Rl to the data stored in memory given by the address given by R2and stores the result in memory location 1000.

8. The .sect ".sysmem" assembler directive is used to allocate data storage where in theMSP430?

j a. Reset vector(E) Random access memoryc. Flash read only memoryd. Input / Output space memory

9. In the MSP430 what symbol is used for absolute addressing?

a. s/ b. ?, !

'0 @ &d. #

I 10. In the MSP430, the program counter is used to keep track of:

The next instruction to be executed.The present instruction being executed.

c. The return address of a subroutine.d. The address used by the jump instruction.

11. The jump instruction (imp label) is located in memory such that the program counter isequal to OxF866 when this jump instruction is executed. If label is located at addressOxF800, to execute this instruction, what is the value of the 10 bit offset that will be storedwith the jmp instruction?

a. Ox066 b.Ox033 c.Ox39A ~OX3CD

Page 3: Midterm Fall12

12. What address in the MSP430 is used to store the location in memory where code is to beexecuted after a reset (known as the reset vector)?

a. Ox3100

/ b. Ox0200® OxFFFEd. OxFOOO

13. The binary value for the number 57123 is:

jGY 1101111100100011b. 1101111100100010c. 1101010100100011d. 1001111100100001

14. Given the following MSP430 instruction with OxAF52 stored in r8: KI[JIJr.W#OK306D? Jr8,whatwill be the value stored in r8 after execution of this instruction?

j a. Ox603F ~Ox9F3F c.Ox903F d.Ox6140

15. If the Stack Pointer register SP = Ox8FFO, then the instruction push.b rr7 sets the SP to:J a. Ox8FED \iV Ox8FEE c. Ox8FEF d. Ox8FFl .

16. Given the following MSP430 assembly code, what is in register r7 after its execution:

j.text

.global _STRTSTRT mov.w #stk, SPStopwDT mov.w #WDTPW+WDTHOLD,&WDTCTL

mov.w #0xfacd,r7setcrra.~'11 r7swpb r7

ed jmp ed

a. OxFD66 b.Ox7D66 c. OxOD66 'Q) Ox66FD

17. Given the following MSP430 assembly code what is in register r7 after its execution:

.text.global STRT

STRT mov.w #stk, SPStopwDT mov.w #WDTPW+WDTHOLD,&WDTCTL

mov.w #exelee,r7inv.w r7incd.w t~7

ed jmp ed

I I

U

Page 4: Midterm Fall12

Q -OxOOFF b. -OxOlOO c.OxOl01 d. -Ox0099

18. In the MSP430, the jlo label instruction jumps to the address label if:

I a. Z = 1h. N=O

J Q C=Od. V= I

19. Given for the MSP430 that r7 has stored in it the value Ox0f15 and r8 has the value OxOf09what is the status ofthe flags (N, C, Z, V) after executing sub.w r7~r8?

J a. N=O, C= 0, Z=O, V = °IN=l, C= 0, Z=O, V = 0. F=1 .~=(I Z'=O V = 1_ '" _., \....... U, _ '). _

d. N=l, C= 1, Z=O, V = 1

20. Which of the following MSP 430 instruction is equivalent to indirect addressing usingregister r8?

a. r8@ 0(r8)c. pc(r8)d. @r8+

21. It is desired to set port 2 bits dO - d3 as output and d4 - d7 as input ofthe MSP430. Which ofthe following instructions properly configures port 2?

J® mov.b #OxOf,&P2DIRb. mov.b #OxfO,&P2DIRc. mov.b #OxOf,&P20UTd. mov.b #OxfO,&P2IN

22. Given the following microcode for the general processor, what assembly instruction best fitsthis microcode:

A = Rl, B = R6, D = R7, R/W' = read, MUXSEL=MEM,F=ALoad CARLoad DIRLoad RegA = R6, B = R7, D = R6F=ADDLoad DOR, RlvV' = read, MUXSEL=DORLoad DIRLoad RegRlW' = read

Page 5: Midterm Fall12

INSTRUCTION SOURCE REG, DEST REG

a. ADD Rl, R6b. ADD (Rl), (R6)

@ ADD (Rt), R6d. ADD R1, (R6)

23. Given BR #W, what is the possible range of values for W?

a. -128to+127 b. 0 to 255 c. -32,768 to 32767 @ 0 to 65535

24. In MSP430 assembly language programming, a different prefix are used to differentiatebetween different kinds of data. Which statement gives the right prefix?

Binary Decimal Hexadecimal Octala~ b Nothing h qb) % # Ox - Nothingc) (jiJ $ Nothing qd) Nothing % $ b

25. Given the following MSP430 assembly code, what ASCII symbol is stored in the lower 8 bitsofr9?

.text

.global _STRTSTRT mov.w #stk, SPStopWDT mov.w #WDTPW+WDTHOLD,&WDTCTL

mov.b #0x21,r9rla.b r9add.b #0x02,r9

ed jmp ed

(/I

a. 'E'\ I ® 'D'

c. 'C'd. 'B'

26. Which of the following MSP430 assembly instructions will generate an error?

IIcJ

a. mov.w @r0, r4b. mov.w r6, r4(0 mov.w r4, #0x0012d. mov.w 0(rl), r4

27. To convert the hexadecimal values A - F to ASCII lower case symbols (letters) 'a' - If,whatmust be added to the hexadecimal values A - F?

\~ Ox57 b.Ox37 c.Ox50 d.Ox30

Page 6: Midterm Fall12

28. Multiplication by 2 is best implemented in the MSP430 using which shift operation?

/ rs ria h. rle e. ITa d. ITe

29. Given the following MSP430 assembly program, what is in memory location result after itsexecution?

result

.sect ".sysmem".string "This is a TTT ttt Test".byte 0x00.word 0x8880.text.global _STRTmov.w #stk, SPmov.w #WDTPW+WDTHOLD,&WDTCTLmov.w #bufl,rSmov.w #0x10,&resultmov.b 0(r5), 0(r6)cmp.b #80, 0(r5)

jeq donecmp.b .'T', 0(r5)jeq inccntinc.w rSjmp loopdec.w &resultinc.w r5jmp loop

bufl

STR!StopWDT

loop

inccnt

doneed jmp ed

a.Ox0009 b.Ox0005 G·OxOOOb d.OxOOOe

30. Given the following MSP430 assembly program, what is in memory location result afterits execution?

.sect ".sysmem"result .word 0x0000

.text

.global _STRTSTRT mov.w #stk, SPStopWDT mov.w #WDTPW+WDTHOLD,&WDTCTL

mov.w #loop, r6mov.w #0x0001,r7mov.w #0x0002,r8push.w r6push.w r7plAsh.w rBcall #sbrtneinc.w r8

mov.w R8, &resultjmp ed

looped