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 28 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

Nội dung

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

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 point) How does the circuit in a processor detect an OVERFLOW condition as defined by 2’s complement addition? V flag (3 points) A digital output port (8 bits) of an MSP430 processor is assigned to memory location 0x0021 This output port controls 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 bis.b xor.b #0x01, &0x0021 #0x01, &0x0021 #0x01, &0x0021 ; turn off the LED ; turn on the LED ; toggle the LED a What assembly instruction turns on LEDs connected to Pins and at the same time? bis.b #0x18, &0x0021 b What assembly instruction turns off all LEDs at the same time? bic.b #0xFF, &0x0021 c What assembly instruction toggles LEDs connected to Pins and 7? xor.b #0x82, &0x0021 (6 points) For the following assembly code, give contents of R4 after each line is executed 1.0x8000: MOV.W 2.0x8004: MOV.W 3.0x8008: MOV.W 4.0x800c: MOV.W 5.0x800e: MOV.W 6.0x8010: MOV.W 0x9000: FOOEY: word 0xA000: FOOBAR: word #FOOEY,R4 &FOOEY,R4 FOOEY,R4 @R4,R4 @R4,R4 @R4+,R4 Answer Answer Answer Answer Answer Answer 1: 2: 3: 4: 5: 6: 0x9000 0xA000 0xA000 0x9000 0xA000 0x9000 0xA000 0x9000 // Note: FOOEY = 0x9000 (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 (10 points) How many cycles are used by each of the following instructions: BYU, ECEn/CS 124 Homework #3 Page 1/2 a b c d e f g h i j mov.w r5,r6 mov.b r5,r6 add.b @r5,r6 add.b 10(r5),r6 sub.w 10(r5),20(r6) mov.w #1,r5 mov.w #100,r5 jmp label jne label xor.w r5, label 1 2 (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) SEED set 21845 ; 65536/3 ; UNSIGNED MULTIPLY: r4 x r5 -> r6|r7 ; MPYU: mov.w mySeed,r7 ; LSB -> mySeed clr.w r6 ; -> MSBs RESULT ; UNSIGNED MULTIPLY AND ACCUMULATE: ; (r4 x r5) + r6|r7 -> r6|r7 ; MACU: push r8 clr.w r8 ; MSBs MULTIPLIER 1 L$01: bit.w #1,r4 jz L$02 add.w r5,r7 addc.w r8,r6 ; TEST BIT 5-4 ; IF 0: DO NOTHING ; IF 1: ADD RESULT 1 1 L$02: rla.w rlc.w rrc.w jnz r5 r8 r4 L$01 ; MULTIPLIER x ; ; NEXT BIT TO TEST ; IF C: FINISHED 1 1 L$03: pop Ret r8 mySeed: word SEED 1 Symbol BYU, ECEn/CS 124 Question SEED Question Question Question Question Question Question MPYU MACU L$01 L$02 L$03 mySeed Value 21845= 0x5555 0x8383 0x8388 0x838C 0x8394 0x839C 0x83A0 Homework #3 Page 2/2

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

TỪ KHÓA LIÊN QUAN

w