Introduction to Computer Systems Chapter 6

Introduction to Computer Systems Chapter 6 - Appendix F...

This preview shows pages 1–3. Sign up to view the full content.

Appendix F Selected Solutions F.6 Chapter 6 Solutions 6.1 Yes, for example, an iterative block where the test condition remains true for each iteration. This procedure will never end and is therefore not finite and not an algorithm. The following is an example of a procedure that isn’t an algorithm: x3000 0101 000 000 1 00000 ( LOOP AND R0, R0, #0 ) x3001 0000 010 111111110 ( BRz LOOP ) This is not an algorithm because the branch instruction is always taken and the program loops indefinitely. 6.3 The following program uses DeMorgan’s Law to set the appropriate bits of the machine busy register. x3000 1010000000001110 ( LDI R0, S ) x3001 1010001000001110 ( LDI R1, I ) x3002 0101010010100000 ( AND R2, R2, #0 ) x3003 0001010010100001 ( ADD R2, R2, #1 ) x3004 0001001001111111 ( L ADD R1, R1, #-1 ) x3005 0000100000000010 ( BRn D ) x3006 0001010010000010 ( ADD R2, R2, R2 ) x3007 0000111111111100 ( BRnzp L ) x3008 0001001010100000 ( D ADD R1, R2, #0 ) x3009 1001000000111111 ( NOT R0, R0 ) x300a 1001001001111111 ( NOT R1, R1 ) x300b 0101000000000001 ( AND R0, R0, R1 ) x300c 1001000000111111 ( NOT R0, R0 ) x300d 1011000000000001 ( STI R0, S ) x300e 1111000000100101 ( TRAP x25 ) 1

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
2 APPENDIX F. SELECTED SOLUTIONS x300e 0100000000000001 ( S .FILL x4001 ) x300f 0100000000000000 ( I .FILL x4000 ) 6.5 The three additions of 88 + 88 + 88 requires fewer steps to complete than the eighty eight additions of 3 + 3 + ... + 3. Because 88 + 88 + 88 requires fewer instructions to complete, it
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern