21
Introduction to Comput ing Systems (3rd Exam)

Introduction to Computing Systems (3rd Exam). 1.[5] Suppose R1 contains an integer x and R2 contains another integer y. Please write an instruction which

  • View
    216

  • Download
    0

Embed Size (px)

Citation preview

Introduction to Computing Systems (3rd Exam)

1. [5] Suppose R1 contains an integer x and R2 contains another integer y. Please write an instruction which puts x+y in R3.

0001011001000010 or 0001011010000001

2. [5] Suppose R3 contains an integer x. Please write an instruction which puts x-1 in R3.

0001011011111111

3. [5] Please write an instruction which puts zero in R6.

0101110XXX100000

4. [5] Suppose R5 contains xFFFF. Please write an instruction to change the contents of R5 to xFFF0.

0101101101110000 or 0001101101110001

5. [5] Suppose there is an integer x stored at memory location x30F6. We want to read x into R4 by executing an instruction placed at memory location x30E6. What is this instruction?

0010100000001111

6. [5] Suppose there is an instruction placed at memory location x413E. After the instruction is executed, the PC is loaded with x4120 if the condition code Z = 1. What is the instruction located at x413E?

0000010111100001

7. [5] Suppose R2 contains xAFAF. We want R2 to contain x5050 after an instruction is executed. What is the instruction?

1001010010111111

8. [5] Suppose there is an instruction placed at x30F8. After the instruction is executed, the contents of R2 will be stored at memory location x30F4. What is the instruction located at x30F8?

0011010111111011

9. [5] What does the following instruction do?

0001101101100001.

R5 R5 + 1

10. [5] What does the following instruction do?

0101111111100000

R7 0

11. [5] What happens if the following instruction,

0000111110000101

located at x507B, is executed?

Jump to x5001 or PC is loaded with x5001

12. [5] What happens if the following instruction,

0000000010000100

located at x7679, is executed?

PC is loaded with x767A or the next instruction to be executed is at x767A

13. [5] What does the following instruction do?

1001010110111111.

R2 (R6)’

14. [5] Suppose xABAB, xCDCD, xEFEF are stored at memory locations x3FC7, x3FC8, and x3FC9, respectively. If the instruction

0010011110101110

is located at x4019, what will the contents of R3 be after the execution of this instruction?

R3 xCDCD

15. [5] If memory location x4018 contains the following instruction:

1110110111111101.

What will the contents of R6 be after the execution of this instruction?

R6 x4016

16. [5] Suppose the instruction

1010011111001100

is in x4A1B, the contents of x49E8 is x1120,and the contents of x1120 is x7654. What will the content of R3 be after the execution of this instruction?

R3 x7654

17. [5] Suppose R1 contains xF0F0 and R2 contains x2345. What will the contents of x2362 be after the execution of the following instruction?

0111001010011101.

[x2362] xF0F0

18. [5] Suppose R2 contains xABCD. What will R2 contain after the execution of the following instruction?

1001010010111111.

R2 x5432

19. [5] Please write an instruction to move the value in R2 into R6.

0001110010100000

20. [5] What happens if the following instruction is executed?

0000111111111111.

Will execute this instruction forever