Quiz8_2020-21

pdf

School

Western University *

*We aren’t endorsed by this school

Course

2208A

Subject

Computer Science

Date

Jan 9, 2024

Type

pdf

Pages

3

Uploaded by JusticeStar19063

Report
12/22/2020 OWL : COMPSCI 2208A 001 FW20 : Online Tests, Quizzes & Assignments https://owl.uwo.ca/portal/site/7a0fdb29-6a38-4330-adc3-7e8895544a8b/tool/1c394bc0-5806-499f-bc16-119cd7ad58dd/jsf/select/selectIndex 1/3 5.0/ 6.0 Points 12.0/ 12.0 Points Quiz 08 Return to Assessment List Part 1 of 3 - 5.0/ 6.0 Points Question 1 of 3 Our ARM7 does not have any division instruction. Yet, you still can implement division by utilizing ASR. Basically, if you want to divide the content of a register by 20, you multiply it by 3277, and then you shift the result using ASR#16. The effective result is 3277 ÷ 2 16 = 3277 ÷ 65536 ≈ 1/20, which is divided by 20. Write an ARM assembly program to divide the content of r0 by 20 and store the result in r1. Use r2 as a working register. Test your code by assigning various values to r0 What are the 3 instructions you used? Write your answer (i.e., the 3 instructions) in TWO parts, the Op-Code in a box and ALL operands in another box. The Op-Code of the 1st instruction is: LDR The operands of the 1st instruction are: r2, =3277 . The Op-Code of the 2nd instruction is: MUL The operands of the 2nd instruction are: r1, r0, r2 . The Op-Code of the 3rd instruction is: ASR The operands of the 3rd instruction are: r1, r1, #16 . Answer Key: LDR, r2, =3277, MUL, r1,r0,r2|r1,r2,r0, ASR, r1,#16|r1,#0x10 Part 2 of 3 - 12.0/ 12.0 Points Question 2 of 3 Consider the following ARM assembly program. COMPSCI 2208A 001 FW20 Online Tests, Quizzes & Assignments Online Tests, Quizzes & Assignments
12/22/2020 OWL : COMPSCI 2208A 001 FW20 : Online Tests, Quizzes & Assignments https://owl.uwo.ca/portal/site/7a0fdb29-6a38-4330-adc3-7e8895544a8b/tool/1c394bc0-5806-499f-bc16-119cd7ad58dd/jsf/select/selectIndex 2/3 AREA prog, CODE, READWRITE ENTRY ADR R0,C+1 MOV R1,#1 LDRB R2,[R0,#5] LDRB R3,[R0],-R1,LSL#2 LDRB R4,[R0,#2]! Loop B Loop A DCB 0x77 B DCD 0xAABBCCDD C SPACE 1 D DCB 0x88 E SPACE 1 F DCD 0x11223344 END MANUALLY calculate the values of R0, R1, R2, R3, and R4 after executing the above program. R0 = 0x 1F R2 = 0x 33 R3 = 0x 88 R4 = 0x DD . MANUALLY encode the " ADR R0,C+1 " ARM instruction into machine language. Write your answer as eight hexadecimal digits, each digit in a box. E 2 8 F 0 0 1 9 . MANUALLY encode the " LDRB R2,[R0,#5] " ARM instruction into machine language. Write your answer as eight hexadecimal digits, each digit in a box. E 5 D 0 2 0 0 5 . MANUALLY encode the " LDRB R3,[R0],-R1,LSL#2 " ARM instruction into machine language. Write your answer as eight hexadecimal digits, each digit in a box. E 6 5 0 3 1 0 1 . MANUALLY encode the " LDRB R4,[R0,#2]! " ARM instruction into machine language. Write your answer as eight hexadecimal digits, each digit in a box. E 5 F 0 4 0 0 2 . Answer Key: 1F|0000001F, 33|00000033, 88|00000088, DD|000000DD, E, 2, 8, F, 0, 0, 1, 9, E, 5, D, 0, 2, 0, 0, 5, E, 6, 5, 0, 3, 1, 0, 1, E, 5, F, 0, 4, 0, 0, 2 Part 3 of 3 - 2.0/ 2.0 Points Question 3 of 3
12/22/2020 OWL : COMPSCI 2208A 001 FW20 : Online Tests, Quizzes & Assignments https://owl.uwo.ca/portal/site/7a0fdb29-6a38-4330-adc3-7e8895544a8b/tool/1c394bc0-5806-499f-bc16-119cd7ad58dd/jsf/select/selectIndex 3/3 2.0/ 2.0 Points MANUALLY decode the following ARM machine language code to ARM assembly instruction. 0x34532911 Write your answer in TWO parts, the Op-Code in a box and ALL operands in another box. The Op-Code of the instruction is: LDRBCC The operands of the instruction are: r2, [r3], #-0x911 . Answer Key: LDRBCC|LDRCCB, r2,[r3],#-0x911 Gateway Help & Support Western University OWL is the learning management system of Western University. It is a customized version of Sakai. Copyright 2003-2020 The Apereo Foundation. All rights reserved. OWL - OWL - Sakai 11.3-owl6 - Server azuki30
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help