Tài liệu Bài giảng Introduction to Computing Systems - Chapter 06: Programming: Chapter 6ProgrammingProblem solving DebuggingProblem solvingStart with systematic decomposition of problem“top-down” analysisstepwise refinementAlgorithms must have properties of:finitenesscompletenessdefinitenesscomputability2Structured programmingThree control structures:SequentialThis is the defaultConditionalBranching or decision-makingIterationLoops3Implementing the control structuresSequential Conditional Iterative4Stepwise refinement illustratedCharacter count algorithm: statement of problem & first level of refinement5Stepwise refinement (cont.)2nd & 3rd levels6Stepwise refinement (cont.)Final level7DebuggingA debugging tool provides (at least) the ability to: Set values to registers & memory locationsenter as hex, decimal or binary values Execute instructions one at a time, or in small groupsRun will set the program runningStep causes a fixed number of instructions to be executed (often used to “single-step” through part of a program) Stop execution when desiredBreakpoints all...
10 trang |
Chia sẻ: honghanh66 | Lượt xem: 888 | Lượt tải: 0
Bạn đang xem nội dung tài liệu Bài giảng Introduction to Computing Systems - Chapter 06: Programming, để tải tài liệu về máy bạn click vào nút DOWNLOAD ở trên
Chapter 6ProgrammingProblem solving DebuggingProblem solvingStart with systematic decomposition of problem“top-down” analysisstepwise refinementAlgorithms must have properties of:finitenesscompletenessdefinitenesscomputability2Structured programmingThree control structures:SequentialThis is the defaultConditionalBranching or decision-makingIterationLoops3Implementing the control structuresSequential Conditional Iterative4Stepwise refinement illustratedCharacter count algorithm: statement of problem & first level of refinement5Stepwise refinement (cont.)2nd & 3rd levels6Stepwise refinement (cont.)Final level7DebuggingA debugging tool provides (at least) the ability to: Set values to registers & memory locationsenter as hex, decimal or binary values Execute instructions one at a time, or in small groupsRun will set the program runningStep causes a fixed number of instructions to be executed (often used to “single-step” through part of a program) Stop execution when desiredBreakpoints allow the user to set points at which execution will halt & wait for a new “Run” instruction Examine the contents of registers and memory locations at any point8Debugging exampleA program to find the first 1 in a 16-bit word9Debugging example (cont.)Oops! We have an infinite loop!Setting a breakpopint at location x3007 & repeatedly running the code shows that the loop does not trerminate because there is no 1 in the test case number10
Các file đính kèm theo tài liệu này:
- chap6_1859.ppt