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

Đề thi giữa kỳ Kỹ thuật vi xử lý - DTVT - BKDN

5 34 0

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

THÔNG TIN TÀI LIỆU

Đề thi giữa kỳ Kỹ thuật vi xử lý ngành điện tử viên thông trường đại học bách khoa đà nẵng

Questions: Answers: Bài (1 điểm) Assembler thay giả lệnh sau lệnh thực MSP430? (What native MSP430 instruction is replaced by the assembler for each of the following emulated instruction?) a b c d e f g h i j k ADC.W dst DEC dst DECD dst INC dst INCD dst INV.B dst RLA.W dst RLC.B dst CLR dst NOP RET Bài (1 điểm) Một chương trình chứa lệnh sau Sau dịch nạp vào nhớ, cho biết giá trị tai vị trí nhớ 0x800a 0x800c Ghi kết hai hệ nhị phân hexa (An assembly language program contains the following two instructions After assembly is completed, what is in memory locations 0x800a and 0x800c? (Give your answer in hexadecimal with “0x” and in binary.) label: org 0x800a rla.w r4 jne label a.ADDC.W #0,dst b.SUB.W #1,dst c.SUB.W #2,dst d.ADD.W #1,dst e.ADD.W) #2,dst f.XOR.B #0FFh,dst g.ADD.W dst,dst h.ADDC.B dst,dst i.MOV.W #0,dst j.MOV #0,R3 k.MOV @SP+,PC 0x800a:5404 (0101 0100 0000 0100) 0x800c:23FE (0010 0011 1111 1110) a A,F b Sau PUSH F lần thứ gồm A,C,E,F c A,F,M Bài (1 điểm) Các hoạt động sau thực stack MSP430: PUSH A, PUSH B, POP, PUSH C, PUSH D, POP, PUSH E, PUSH F, POP, POP, POP, PUSH F a Sau lệnh PUSH F cuối cùng, stack chứa phần tử nào? b Lúc stack chứa nhiều phần tử nhất? c Tiếp tục thực hoạt động sau, stack chứa phần tử nào? PUSH G, PUSH H, PUSH I, PUSH J, POP, PUSH K, POP, POP, POP, PUSH L, POP, POP, PUSH M Bài (1 điểm) Mỗi lệnh sau thực chu kỳ? (How many cycles are used by each of the following instructions:) 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 a b c d e f g h i Bài (1 điểm) Xét đoạn chương trình ng̀n Assembly có sử dụng directive sau Cho biết nội dung vùng nhớ liên quan khởi tạo directive MSP430 có kiến trúc little-endian Hãy ghi giá trị vào bảng bên phải (Consider the following assembly directives (see below) Show the content of relevant region of memory initialized by these directives MSP430 is a little-endian architecture Fill in the table.) ORG 0xF000 b1: DB b2: DB -122 b3: DB 10110111b b4: DB 0xA0 EVEN tf EQU 25 w1: DW 32330 w2: DW -32000 s1: Label b1 b2 B3 B4 W1 W2 S1 Address [hex] 0xF000 0xF001 0xF002 0xF003 0xF004 0xF005 0xF006 0xF007 0xF008 0xF009 0xF00A 0xF00B Memory[7:0] [hex] 0x05 0x86 0xB7 0xA0 0x4A 0x7E 0x00 0x83 0x41 0x42 0x43 0x44 DB 'ABCD' Bài (2 điểm) Xét lệnh bảng bên phải Với lệnh xác định việc thay đổi giá trị ghi cờ V, N, Z, C sau lệnh thực ghi vào ô trống bảng Giá trị ban đầu ghi là: R2=0x0007, R5=0xAA55, R7=0x1357 Giả sử điều kiện đầu với lệnh (Consider the following instructions given in the table below For each instruction determine changes in registers after its execution Fill in the empty cells in the table Initial value of registers R2, R5, and R7 is as follows: R2=0x0007, R5=0xAA55, R7=0x1357 Assume the starting conditions are the same for each question (i.e., always start from the initial conditions in registers).) Instruction ADD.B R5, R7 ADD R5, R7 ADDC R5, R7 SUB.B R5, R7 SUBC R5, R7 CMP.B R5, R7 CMP R5, R7 BIT R5, R7 BIC R5, R7 BIS R5, R7 AND R5, R7 XOR.B R5, R7 SWB R7 (SWPB) RRC.B R7 RRC R7 RRA.B R7 RRA R7 R7=0x???? 0x00AC 0xBDAC 0xBDAD 0x0002 0x6902 0x1357 0x1357 0x1357 0x1102 0xBB57 0x0255 0x0002 0x5713 0x00AB 0x89AB 0x002B 0x09AB V 0 0 0 0 0 0 1 0 N 1 0 0 1 0 1 0 Z 0 0 0 0 1 0 0 0 C 0 1 1 1 1 1 1 Bài (1 điểm) Cho số hexa 16-bit cột thứ hai Từng số coi số nhị phân không dấu có dấu 16-bit (số bù 2) Cho biết giá trị thập phân chúng cách ghi kết vào cột tương ứng ghi vắn tắt trình tính cách làm bên với trường hợp (a) Consider the following 16-bit hexadecimal numbers (second column) Each of these values can be interpreted as an unsigned 16-bit integer or a signed 16-bit integer represented in 2’s complement Provide the decimal value for each number and interpretation Show your work as illustrated in (a) (a) (b) (c) (d) (e) 16-bit hexadecimal A223 81C2 9689 A2EB 39CD Unsigned int (Số khơng dấu) Signed int (Số có dấu) 41507 33218 38537 41707 14797 -24029 -32318 -26999 -23829 14797 (a) Unsigned (không dấu): A22316 = 10*163 + 2*162 + 2*161 + 3*160 = 4150710 Signed (có dấu): A22316 = 1010.0010.0010.00112 => this is a negative number (đây số âm); Its 2’s complement is: 0101.1101.1101.1101 = 5DDD16 = 5*163 + 13*162 + 13*161 + 13*160 = 2402910 => A22316 = -2402910 (b)unsigned: 81C2h = 8*16^3 + 1*16^2 + 12*16 + Signed: 81C2h = 1000 0001 1100 0010 b => số âm 2’s complement: 0111 1110 0011 1110 = 7E3Eh = 7*16^3 + 14*16^2 + 3*16 + 14 = 32318 => -32318 Bài (1 điểm) Thực phép toán số học sau với toán hạng số có dấu Cho biết kết hệ thập phân giá trị cờ C,V,N Z Ghi vắn tắt trình thực bên cạnh tương tự câu a Consider the following arithmetic operations Find the results in decimal and set the flags C, V, N, and Z accordingly (a) 8-bit, two’s complement 5510 = 00111111 5510 + 10510 10510 = 01101001 Kết quả: -8810 10101000 = -8810 C=0 V=1 N=1 Z=0 (b) 8-bit, two’s complement -55 = 11001001 (-55)10 - 6810 -68 = 10111100 Kết -123 1000 0101 = -123 C=1V=0N=1Z=0 (c) 16-bit, two’s complement FFBB = 1111 1111 1011 1011 FFBB16 – 008816 0088 = 0000 0000 1000 1000 Kết -205 FF33 = 1111 1111 0011 0011 C=1V=0N=1Z=0 (d) 16-bit, two’s complement FF5116 + 3410 Kết -141 C=0V=0N=1Z=0 (e) 16-bit, two’s complement 00AF16 + 9910 Kết 274 C=0V=0N=0Z=0 Bài (1 điểm) Xét lệnh bảng Với lệnh xác định độ dài (tính word), từ lệnh viết hệ hexa, mode địa toán hạng nguồn giá trị ghi R7 sau lệnh thực để ghi vào ô trống bảng Nội dung ban đầu nhớ cho bảng đó.Giá trị ban đầu ghi là: R5=0xF000, R6=0xF008, R7=0xFFFF Giả sử điều kiện ban đầu lệnh (Consider the following instructions given in the table below For each instruction determine its length (in words), the instruction words (in hexadecimal), source operand addressing mode, and the content of register R7 after execution of each instruction Fill in the empty cells in the table The initial content of memory is given below Initial value of registers R5, R6, and R7 is as follows: R5=0xF000, R6=0xF008, R7=0xFFFF Assume the starting conditions are the same for each question (i.e., always start from initial conditions in memory) and given register values.) (i) (ii) (a) (b) (c) (d) (e) (f) (g) (h) (i) (j) Label Instr Address Instruction Instr Length [words] Instruction Word(s) [hex] Source Operand Addressing Mode R7=? [hex] 0x1116 0x1116 0x1116 0x1116 0x1116 0x1116 0x1116 0x1116 0x1116 0x1116 0x1116 0x1116 MOV R5, R7 MOV.B R5, R7 MOV 4(R5), R7 MOV.B 3(R5), R7 MOV.B -3(R6), R7 MOV TONI, R7 MOV.B EDE, R7 MOV &EDE, R7 MOV.B @R5, R7 MOV @R5+, R7 MOV #45, R7 MOV.B #45, R7 1 2 2 2 1 2 0x4507 0x4447 0x4517 0004 0x4557 0003 0x4657 FFFD 0x4017 DEEC 0x4057 DEF4 0x4217 F00C 0x4567 0x4537 0x4037 002D 0x4077 002D Register Register Index Index Index Symbolic Symbolic Absolute Indirect Indirect auto Immediate Immediate 0xF000 0x0000 0x0203 0x00FF 0x0002 0x0203 0x00DA 0xCDDA 0x0004 0x0504 0x002D 0x002D Address [hex] 0xF000 0xF002 TONI 0xF004 0xF006 0xF008 0xF00A EDE 0xF00C 0xF00E Memory[15:0] [hex] 0x0504 0xFFEE 0x0203 0x3304 0xF014 0x2244 0xCDDA 0xEFDD

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

Xem thêm:

TỪ KHÓA LIÊN QUAN

w