{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

4 - Programming We now have a sufficient set of...

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

4 Programming • We now have a sufficient set of instructions to write serious programs • Indeed, the instruction set of the LC-3 is computationally complete in the sense that (given sufficient memory capacity) any Turing computable function can be realized by a program written in LC-3 machine language • Note that this concept for instructions (software building blocks) is analogous to that of a logically complete set of gate types (hardware building blocks)

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

View Full Document
5 Programming (Chapter 6) Programming: Solving Problems •Top-down design •Basic Constructs •Debugging Problem Language Machine (ISA) Architecture Algorithms Micro-architecture Circuits Devices Human Analytical thinker Programmer Compiler, Assembler Electrons
6 Solving Problems using a Computer • Methodologies for creating computer programs that perform a desired function. • Problem Solving – How do we figure out what to tell the computer to do? – Convert problem statement into algorithm, using stepwise refinement . – Convert algorithm into LC-3 machine instructions. • Debugging – How do we figure out why it didn’t work? – Examining registers and memory, setting breakpoints, etc. Time spent on the first can reduce time spent on the second!

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

View Full Document
7 Top-Down Design • There is a considerable gap between Problem and Machine (ISA) Architecture • Top-Down Design – Stepwise Refinement – Divide-and-Conquer – Structured Programming • Idea: – Break a task down into smaller, more precisely stated subtasks – Apply top-down design to subtasks Problem Language Machine (ISA) Architecture Algorithms Micro-architecture Circuits Devices Human Analytical thinker Programmer Compiler, Assembler Electrons
8 Stepwise Refinement • Also known as systematic decomposition . • Start with problem statement: “We wish to count the number of occurrences of a character in a file. The character in question is to be input from the keyboard; the result is to be displayed on the monitor.” • Decompose task into a few simpler subtasks . • Decompose each subtask into smaller subtasks , and these into even smaller subtasks , etc. ... until you get to the machine instruction level.

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

View Full Document
9 Four Steps (Simplified) • Analyze problem (main task) – Input given, output required • Decompose problem into subtasks – Flowchart • Develop flowcharts and algorithms for subtasks – Write algorithms in pseudo-code • Translate pseudo-code into a program (in a given programming language)
10 Problem Statement • Because problem statements are written in English, they are sometimes ambiguous and/or incomplete. – Where is “file” located?

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 34

4 - Programming We now have a sufficient set of...

This preview shows document pages 1 - 8. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online