Sunteți pe pagina 1din 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?
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 m
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.
b.
[)
d.

-Ox0011
OxOOll
-Ox0012
OxOOl2

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

Ox65

b.Ox45

c.Ox64

d.Ox44

ar

6. Given the following MSP430 Instruction: add.w r6, r7, which equation below will set the
overflow flag (V). Assume the results of this addition is stored in a register called result and
r6(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 in
memory location 1000.
Adds what is in Rl to the data stored in memory given by the address given by R2
and stores the result in memory location 1000.

t)

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

a. Reset vector
(E) Random access memory
c. Flash read only memory
d. Input / Output space memory

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

, !

'0

a.
b. ?

&

d. #

10. In the MSP430, the program counter is used to keep track of:
The
The
c. The
d. The

next instruction to be executed.


present instruction being executed.
return address of a subroutine.
address used by the jump instruction.

11. The jump instruction (imp label) is located in memory such that the program counter is
equal to OxF866 when this jump instruction is executed. If label is located at address
OxF800, to execute this instruction, what is the value of the 10 bit offset that will be stored
with the jmp instruction?
a. Ox066

b.Ox033

c.Ox39A

~OX3CD

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

a. Ox3100
b. Ox0200
OxFFFE
d. OxFOOO

13. The binary value for the number 57123 is:

GY

1101111100100011
b. 1101111100100010
c. 1101010100100011
d. 1001111100100001

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

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:

a. Ox8FED

\iV Ox8FEE

c. Ox8FEF

d. Ox8FFl

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

.text
.global _STRT
STRT
mov.w
#stk, SP
StopwDT mov.w
#WDTPW+WDTHOLD,&WDTCTL
mov.w #0xfacd,r7
setc
rra.~'11 r7
swpb r7
ed

a. OxFD66

jmp ed

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, SP
StopwDT mov.w
#WDTPW+WDTHOLD,&WDTCTL
mov.w #exelee,r7
inv.w r7
incd.w t~7
ed

jmp ed

I I

b. -OxOlOO

-OxOOFF

c.OxOl01

d. -Ox0099

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

a. Z = 1
h. N=O
Q C=O
d. V= I

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

a. N=O, C= 0, Z=O, V
N=l, C= 0, Z=O, V
.
F=1 .~= (I Z'=O V
d. N=l, C= 1, Z=O, V

_ '"

_.,

\.......

U,

').

=
=0

= 1
_

= 1

20. Which of the following MSP 430 instruction is equivalent to indirect addressing using
register 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 of
the following instructions properly configures port 2?

mov.b
b. mov.b
c. mov.b
d. mov.b

#OxOf, &P2DIR
#OxfO, &P2DIR
#OxOf, &P20UT
#OxfO, &P2IN

22. Given the following microcode for the general processor, what assembly instruction best fits
this microcode:
A = Rl, B = R6, D = R7, R/W' = read, MUXSEL=MEM,
F=A
Load CAR
Load DIR
Load Reg
A = R6, B = R7, D = R6
F=ADD
Load DOR, RlvV' = read, MUXSEL=DOR
Load DIR
Load Reg
RlW' = read

INSTRUCTION SOURCE REG,

DEST REG

a. ADD Rl, R6
b. ADD (Rl), (R6)
@ ADD (Rt), R6
d. ADD R1, (R6)
23. Given BR #W, what is the possible range of values for W?
a. -128to+127

b. 0 to 255

@ 0 to 65535

c. -32,768 to 32767

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

a~
b)
c)
d)

Binary
b
%

(jiJ
Nothing

Decimal
Nothing
#
$

Hexadecimal
h
Ox Nothing
$

Octal

q
Nothing

q
b

25. Given the following MSP430 assembly code, what ASCII symbol is stored in the lower 8 bits
ofr9?
.text
.global _STRT
STRT
mov.w
#stk, SP
StopWDT mov.w
#WDTPW+WDTHOLD,&WDTCTL
mov.b #0x21,r9
rla.b r9
add.b #0x02,r9
ed
jmp ed

(
/
\ I

'E'
'D'
c. 'C'
d. 'B'
a.

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

cJ

a. mov.w @r0, r4
b. mov.w r6, r4
(0 mov.w r4, #0x0012
d. mov.w 0(rl), r4

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

Ox57

b.Ox37

c.Ox50

d.Ox30

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

rs

h. rle

ria

e.

d. ITe

ITa

29. Given the following MSP430 assembly program, what is in memory location result after its
execution?
.sect ".sysmem"
.string "This is a TTT ttt Test"
.byte 0x00
result
.word 0x8880
.text
.global _STRT
STR!
mov.w
#stk, SP
StopWDT mov.w
#WDTPW+WDTHOLD,&WDTCTL
mov.w #bufl,rS
mov.w #0x10,&result
loop
mov.b 0(r5), 0(r6)
cmp.b #80, 0(r5)
jeq done
cmp.b .'T', 0(r5)
jeq inccnt
inc.w rS
jmp loop
inccnt dec.w &result
inc.w r5
jmp loop
done
jmp
ed
ed
bufl

a.Ox0009

b.Ox0005

GOxOOOb

d.OxOOOe

30. Given the following MSP430 assembly program, what is in memory location result after
its execution?
.sect ".sysmem"
.word 0x0000
.text
.global _STRT
STRT
mov.w
#stk, SP
StopWDT mov.w
#WDTPW+WDTHOLD,&WDTCTL
mov.w #loop, r6
mov.w #0x0001,r7
mov.w #0x0002,r8
push.w r6
push.w r7
result

plAsh.w rB

loop
ed

call #sbrtne
inc.w r8
mov.w R8, &result
jmp
ed

S-ar putea să vă placă și