21
Introduction to Comput ing Systems (3rd Exam)

Introduction to Computing Systems (3rd Exam)

Embed Size (px)

DESCRIPTION

Introduction to Computing Systems (3rd Exam). [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. [5] Suppose R3 contains an integer x. Please write an instruction which puts x-1 in R3. - PowerPoint PPT Presentation

Citation preview

Page 1: Introduction to Computing Systems (3rd Exam)

Introduction to Computing Systems (3rd Exam)

Page 2: 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

Page 3: Introduction to Computing Systems (3rd Exam)

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

0001011011111111

Page 4: Introduction to Computing Systems (3rd Exam)

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

0101110XXX100000

Page 5: Introduction to Computing Systems (3rd Exam)

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

0101101101110000 or 0001101101110001

Page 6: Introduction to Computing Systems (3rd Exam)

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

Page 7: Introduction to Computing Systems (3rd Exam)

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

Page 8: Introduction to Computing Systems (3rd Exam)

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

1001010010111111

Page 9: Introduction to Computing Systems (3rd Exam)

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

Page 10: Introduction to Computing Systems (3rd Exam)

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

0001101101100001.

R5 R5 + 1

Page 11: Introduction to Computing Systems (3rd Exam)

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

0101111111100000

R7 0

Page 12: Introduction to Computing Systems (3rd Exam)

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

0000111110000101

located at x507B, is executed?

Jump to x5001 or PC is loaded with x5001

Page 13: Introduction to Computing Systems (3rd Exam)

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

Page 14: Introduction to Computing Systems (3rd Exam)

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

1001010110111111.

R2 (R6)’

Page 15: Introduction to Computing Systems (3rd Exam)

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

Page 16: Introduction to Computing Systems (3rd Exam)

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

Page 17: Introduction to Computing Systems (3rd Exam)

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

Page 18: Introduction to Computing Systems (3rd Exam)

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

Page 19: Introduction to Computing Systems (3rd Exam)

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

1001010010111111.

R2 x5432

Page 20: Introduction to Computing Systems (3rd Exam)

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

0001110010100000

Page 21: Introduction to Computing Systems (3rd Exam)

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

0000111111111111.

Will execute this instruction forever