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

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

View Full Document Right Arrow Icon
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)
Background image of page 1

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

View Full DocumentRight Arrow Icon
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
Background image of page 2
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!
Background image of page 3

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

View Full DocumentRight Arrow Icon
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
Background image of page 4
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.
Background image of page 5

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

View Full DocumentRight Arrow Icon
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)
Background image of page 6
10 Problem Statement • Because problem statements are written in English, they are sometimes ambiguous and/or incomplete. – Where is “file” located?
Background image of page 7

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

View Full DocumentRight Arrow Icon
Image of page 8
This is the end of the preview. Sign up to access the rest of the document.

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 Right Arrow Icon
Ask a homework question - tutors are online