Tải bản đầy đủ (.doc) (2 trang)

Bài tập Kỹ thuật vi xử lý - DTVT - BKDN (bài02)

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (42.02 KB, 2 trang )

Homework #2
Assembly (Ch. 3)

In order to automate the grading process, please follow the exact instruction when answer
the questions and don’t use extra or unnecessary words. For example, enter just the
number for question 1 without the word “register” or “registers”.
1. (1 point)

How many registers for temporary data storage does MSP430 processor have? 12

(2 points) How many are reserved for special purposes? 4
2. Six commonly used constants are generated using two registers in order to increase processor
efficiency.
(1 point) Which two MSP430 registers are used for this purpose (write the answer without
an “and” in between, e.g., R7 R8)? R2 R3
(2 points) What are these six constants in decimal numbers? (Enter your answer without any
“and” or “,” in between and enter the numbers in order starting from the smallest one, e.g., -1
0 1 2 3 4)? -1 0 1 2 4 8
3. (1 point) What are the three MSP430 assembly instruction formats (Enter just the names of
the formats, no “and”, “instruction“, “format”, or ”,”)?
Double operand
single operand
jump
(1 point) How many instructions are CPU instructions (Enter just the number)? 27
(1 point)

How many instructions are emulated instructions? 24

4. The following three lines of code are MSP430 assembly instructions.
(1)
(2)


(3)

MOV.w
AND.w
ADD.w

#0x1234,R5
#0xF0E0,R5
#0x0103,R5

(1 point) What is the value stored in R5 after the first instruction is executed (Enter all four
digits of the hexadecimal value with “0x”)? 0x1234
(1 point) What is the value stored in R5 after the first two instructions are executed (Enter
all four digits of the hexadecimal value with “0x”)? 0x1020
(1 point) What is the value stored in R5 after all three instructions are executed (Enter all
four digits of the hexadecimal value with “0x”)? 0x1123
5. The following four lines of code are MSP430 assembly instructions.
(1)
(2)
(3)
(4)

MOV.w
MOV.w
SUB.w
XOR.w

#0x0002,R5
#0x0001,R6
R6,R5

R6,R5

(1 point) What is the value stored in R5 after the first instruction is executed (Enter all four
digits of the hexadecimal value with “0x”)? 0x0002
(1 point) What is the value stored in R5 after the first three instructions are executed (Enter
all four digits of the hexadecimal value with “0x”)? 0x0001
(1 point) What is the value stored in R5 after all four instructions are executed (Enter all four
digits of the hexadecimal value with “0x”)? 0x0000
BYU, ECEn/CS 124

Homework #2


6. The following three lines of code are MSP430 assembly instructions.
(1)
(2)
(3)

MOV.w
BIC.w
BIS.w

#0x0055,R5
#0xFFEE,R5
#0x1144,R5

(1 point) What is the value stored in R5 after the first instruction is executed (Enter all four
digits of the hexadecimal value with “0x”)? 0x0055
(1 point) What is the value stored in R5 after the first two instructions are executed (Enter all
four digits of the hexadecimal value with “0x”)? 0x0011

(1 point) What is the value stored in R5 after all three instructions are executed (Enter all four
digits of the hexadecimal value with “0x”)? 0x1155
7. The following four lines of code are MSP430 assembly instructions.
(1)
(2)
(3)
(4)

MOV.w
RRA.w
RRC.w
SXT

#0x0055,R5
R5
R5
R5

(1 point) What is the value stored in R5 after the first two instructions are executed (Enter all
four digits of the hexadecimal value with “0x”)? 0x002A
(1 point) What is the value stored in R5 after the first three instructions are executed (Enter
all four digits of the hexadecimal value with “0x”)? 0x8015
(1 point) What is the value stored in R5 after all four instructions are executed (Enter all four
digits of the hexadecimal value with “0x”)? 0x0015
8. The following four lines of code are MSP430 assembly instructions.
(1)
(2)
(3)
(4)


MOV.w
MOV.w
CMP.w
JEQ

#0x0005,R5
#0x0003,R6
R6,R5
somewhere

(3 point) Does the program “jump” to “somewhere” after all four instructions are executed
(yes or no)? no
9. The following four lines of code are MSP430 assembly instructions.
(1)
(2)
(3)
(4)

MOV.w
CLR.w
INCD.w
DEC.w

#0x0055,R5
R5
R5
R5

(1 point) What is the value stored in R5 after the two instructions are executed (Enter all four
digits of the hexadecimal value with “0x”)? 0x0000

(1 point) What is the value stored in R5 after the first three instructions are executed (Enter
all four digits of the hexadecimal value with “0x”)? 0x0002
(1 point) What is the value stored in R5 after all four instructions are executed (Enter all four
digits of the hexadecimal value with “0x”)? 0x0001
10. (1 point)
(1 point)

Is the instruction AND.w R5,R5 equivalent to instruction NOP (yes or no)? no
How many source addressing modes does MSP430 assembly have? 7

(1 points) How many destination addressing modes does MSP430 assembly have? 4

BYU, ECEn/CS 124

Homework #2



×