This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: 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 2...
View Full Document
This note was uploaded on 03/30/2008 for the course ECE 252 taught by Professor Wood during the Spring '08 term at University of Wisconsin.
- Spring '08