1. Trang chủ
  2. » Giáo Dục - Đào Tạo

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

2 30 0

Đang tải... (xem toàn văn)

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 2
Dung lượng 53,5 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

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

Trang 1

Homework #3

Assembly (Ch 3), Assembler (Ch 4), Stacks (Ch 5)

In order to automate the grading process, please follow the exact instruction when answer

the questions and don’t use extra or unnecessary words

1 (1 point) How does the circuit in a processor detect an OVERFLOW condition as defined

by 2’s complement addition? V flag

2 (3 points) A digital output port (8 bits) of an MSP430 processor is assigned to memory

location 0x0021 This output port controls 8 LEDs that are connected to Pins 0-7 Three

MSP430 assembly instructions can be used to turn ON and OFF and TOGGLE these LEDs

For example, to control the LED connected to Pin 0, we can use

bic.b #0x01, &0x0021 ; turn off the LED bis.b #0x01, &0x0021 ; turn on the LED xor.b #0x01, &0x0021 ; toggle the LED

a What assembly instruction turns on LEDs connected to Pins 3 and 4 at the same time?

bis.b #0x18, &0x0021

b What assembly instruction turns off all 8 LEDs at the same time?

bic.b #0xFF, &0x0021

c What assembly instruction toggles LEDs connected to Pins 1 and 7?

xor.b #0x82, &0x0021

3 (6 points) For the following assembly code, give contents of R4 after each line is executed.

1.0x8000: MOV.W #FOOEY,R4

2.0x8004: MOV.W &FOOEY,R4

3.0x8008: MOV.W FOOEY,R4

4.0x800c: MOV.W @R4,R4

5.0x800e: MOV.W @R4,R4

6.0x8010: MOV.W @R4+,R4

0x9000: FOOEY: word 0xA000

0xA000: FOOBAR: word 0x9000

Answer 1: 0x9000 Answer 2: 0xA000 Answer 3: 0xA000 Answer 4: 0x9000 Answer 5: 0xA000 Answer 6: 0x9000

// Note: FOOEY = 0x9000

4 (3 points) The following operations are performed on a stack:

PUSH A, PUSH B, POP, PUSH C,

PUSH D, POP, PUSH E, PUSH F, POP,

POP, POP, PUSH F

a What does the stack contain after the last PUSH F? A F

b At which point does the stack contain the most elements? First PUSH F

c Without removing any elements left on the stack from the previous operations, what does

the stack contain after the following additional operations? A F M

PUSH G, PUSH H, PUSH I, PUSH J, POP, PUSH K, POP, POP, POP, PUSH L, POP, POP, PUSH M

5 (10 points) How many cycles are used by each of the following instructions:

Trang 2

a mov.w r5,r6

b mov.b r5,r6

c add.b @r5,r6

d add.b 10(r5),r6

e sub.w 10(r5),20(r6)

f mov.w #1,r5

g mov.w #100,r5

h jmp label

i jne label

j xor.w r5, label

1 1 2 3 6 1 2 2 2 4

6 (7 points) Create the symbol table entries (in correct order) generated by the assembler for

the following code The code is loaded into memory starting at location 0x8382 Answer

your questions in hexadecimal number with “0x” (e.g., 0x8382).

; UNSIGNED MULTIPLY: r4 x r5 -> r6|r7

;

; UNSIGNED MULTIPLY AND ACCUMULATE:

; (r4 x r5) + r6|r7 -> r6|r7

;

mySeed: word SEED

Symbol Value Question 1 SEED 21845= 0x5555 Question 2 MPYU 0x8383

Question 3 MACU 0x8388

Question 4 L$01 0x838C

Question 5 L$02 0x8394

Question 6 L$03 0x839C

Question 7 mySeed 0x83A0

Ngày đăng: 06/09/2021, 17:29

TỪ KHÓA LIÊN QUAN

🧩 Sản phẩm bạn có thể quan tâm

w