CS270 Colorado State University ========= LC3 ========= Ch 5 ------------ Control Flow Typical fetch phase increments PC to address next instruction. Control flow instructions modify the PC. Example: 0x3000 0xE0FF [#R0 <- 0x3100] 0x3001 0x0402 [#BR z +2] 0x3002 0x103F [#R0 <- R0 - 1] 0x3003 0x0FFD [#BR nzp -3] 0x3004 0xF025 [#HALT] 0x3100 0x000A [#Data (1)] ---------------------- Addressing Modes & Wrap-up Immediate Register PC Offset Indirect Base+Offset ADD X X - - - AND NOT LD ST LDI STI LDR STR LEA BR JMP JSR JSRR RET RTI TRAP --------------------- LC3 Examples First Example: What does the program do? Will the program work? If not, how can we fix it? Second Example: The above example has a very strange method of operation, would it still work? What is the largest single value you could add with this method? Would this method work for negative numbers? ============= LC3 debugging ============= Ch 6 How can you run the simulator program in debug mode? What makes debugging much easier? ------------------------ mstrout@cs.colostate.edu, 9/24/08 pace@cs.colostate.edu, 9/29/08