19-1 Programming…. 19-2 The Pencil and Paper Computer The Pencil & Paper Instruction Set: (table 5.4.2 on p148) The Operand specifies a memory location.

Slides:



Advertisements
Similar presentations
Dr. Ken Hoganson, © August 2014 Programming in R COURSE NOTES 2 Hoganson Language Translation.
Advertisements

Programming 68HC11.
 Suppose for a moment that you were asked to perform a task and were given the following list of instructions to perform:
2.3) Example of program execution 1. instruction  B25 8 Op-code B means to change the value of the program counter if the contents of the indicated register.
The Little man computer
The Computer Continuum5-1 Chapter 5: Two Computers and Their Programs How do programs, written by programmers, work with the computer’s hardware components.
The CPU Revision Typical machine code instructions Using op-codes and operands Symbolic addressing. Conditional and unconditional branches.
1 Lecture-2 CSIT-120 Spring 2001 Revision of Lecture-1 Introducing Computer Architecture The FOUR Main Elements Fetch-Execute Cycle A Look Under the Hood.
Instruction Set Architecture & Design
Assembly Language Programming CS208. Assembly Language Assembly language allows us to use convenient abbreviations (called mnemonics) for machine language.
Systems Environment 3 Quick Revision Review of Exercises Introduction to TOM TOM Exercises.
Assembly Language Programming. CPU The CPU contains a Control Unit, Arithmetic Logic Unit (ALU) and a small number of memory locations called Registers.
Chapter 7 Low-Level Programming Languages. 2 Chapter Goals List the operations that a computer can perform Discuss the relationship between levels of.
1 Lecture-2 CS-120 Fall 2000 Revision of Lecture-1 Introducing Computer Architecture The FOUR Main Elements Fetch-Execute Cycle A Look Under the Hood.
Chapter 4 H1 Assembly Language: Part 2. Direct instruction Contains the absolute address of the memory location it accesses. ld instruction:
Dale & Lewis Chapter 5 Computing components. Let’s design a computer Generic CPU with registers −Program counter (PC) – 5 bits (size of addresses) −Instruction.
Computer ArchitectureFall 2007 © Sep 10 th, 2007 Majd F. Sakr CS-447– Computer Architecture.
Data Transfer & Decisions I (1) Fall 2005 Lecture 3: MIPS Assembly language Decisions I.
10-1 Programming Remember: –programming language –how to program (conceptually) –intro to programming the “ROBOT” computer In this lecture: –programming.
Assembly & Machine Languages
The von Neumann Model – Chapter 4 COMP 2620 Dr. James Money COMP
The CPU The Central Presentation Unit Main Memory and Addresses Address bus and Address Space Data Bus Control Bus The Instructions set Mnemonics Opcodes.
Chapter 5: Hardware and Software: Putting It Together Berlin Chen 2003 Textbook: Kurt F. Lauckner and Mildred D. Lintner, "The Computer Continuum," Prentice.
Session 3 Process and organize data 1. Terminology 2 For a list of computer and internet terminology, please see the.
GCSE Computing#BristolMet Session Objectives#11 MUST identify what program instructions consist of SHOULD describe how instructions are coded as bit patterns.
Computer Science 101 Assembly Language. Problems with Machine Language Uses binary - No English-like words to make it more readable Uses binary - No English-like.
CSC 3210 Computer Organization and Programming Chapter 1 THE COMPUTER D.M. Rasanjalee Himali.
Computer Systems Week 7: Looping and Input/Output with 3-bit Alma Whitfield.
Lecture 14 Today’s topics MARIE Architecture Registers Buses
Computer Science Illuminated Programming: Controlling the Hardware.
CS 111 – Sept. 15 Chapter 2 – Manipulating data by performing instructions “What is going on in the CPU?” Commitment: –Please read through section 2.3.
Important Concepts  Parts of the CPU  Arithmetic/Logic Unit  Control Unit  Registers  Program Counter  Instruction Register  Fetch/Decode/Execute.
Little Man Computer When your program gets “translated to machine code” all 0’s & 1’s The translator must know the language of the program (java) as well.
Chapter 7 Low-Level Programming Languages (slides modified by Erin Chambers)
Represents different voltage levels High: 5 Volts Low: 0 Volts At this raw level a digital computer is instructed to carry out instructions.
1.4 Representation of data in computer systems Instructions.
Addressing Modes1 Addressing modes are concerned with how the CPU accesses the operands used by its instructions.
An Example Architecture. A Paper Computer - Woody Woody's characteristics Word size – 8 bits One word.
Dale & Lewis Chapter 5 Computing components
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Control Unit.
Computer Systems – Machine & Assembly code. Objectives Machine Code Assembly Language Op-code Operand Instruction Set.
Assembly Language Programming of 8085 BY Prof. U. V. THETE Dept. of Computer Science YMA.
Chapter 2 Data Manipulation © 2007 Pearson Addison-Wesley. All rights reserved.
Introduction to Computing Systems and Programming Programming.
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Control Unit.
Some of the utilities associated with the development of programs. These program development tools allow users to write and construct programs that the.
Instruction Memory value Description ADD1xx Add the value stored at memory address xx to the value in the accumulator register SUB2xx Subtract the value.
A computer consists of five functionally independent main parts.
Computer Architecture. Instruction Set “The collection of different instructions that the processor can execute it”. Usually represented by assembly codes,
The Little man computer
Today’s Agenda Exam 2 Part 2 (11:15am-12:30pm)
Control Unit Lecture 6.
Assembly Language Programming of 8085
Microprocessor T. Y. B. Sc..
CHAPTER 6: The Little Man Computer
Assembly Language Assembly Language
1. Introduction A microprocessor executes instructions given by the user Instructions should be in a language known to the microprocessor Microprocessor.
What should we teach regarding…
Starter Read the Feedback Click on Add new Feedback Open Realsmart
The Processor and Machine Language
ECE243 Interpreter Lab.
Design of the Control Unit for One-cycle Instruction Execution
Making Programming Friendlier
Sequencing, Selection, and Loops in Machine Language
Tri-state buffer A circuit which allows an input to go to output when desired Otherwise it behaves as if “nothing” is connected to the wire An equivalent.
Computer Architecture
A Discussion on Assemblers
Program Execution.
Algoritmos y Programacion
Little Man Computer.
Presentation transcript:

19-1 Programming…

19-2 The Pencil and Paper Computer The Pencil & Paper Instruction Set: (table on p148) The Operand specifies a memory location (variable) whose value will be printed to the screen (displayed to output units). PRINT 110 The Operand (the last 5 bits of the instruction) specifies a location within the current program (i.e., line number) that will be executed next if the Accumulator is greater than zero. Otherwise, the PJUMP instruction is skipped and the next instruction is executed “normally” PJUMP 111 The Operand specifies a memory location (variable) whose value will be replaced by a numerical value read from the keyboard (input units) READ 101 The Operand specifies a memory location (variable) whose value will be replaced by the current value in the Accumulator. STORE 100 The Operand specifies a memory location (variable) whose value will replace the current value in the Accumulator. LOAD 011 The Operand specifies a memory location (variable) whose value will be subtracted from the Accumulator. SUB 010 The Operand (the last 5 bits of the instruction) specifies a memory location (variable) whose value will be added to the Accumulator. ADD 001 The computer stops interpretation of the current program.STOP000 The action taken by the CPU, in English mnemonic Opcode

19-3 Working with the P&P Computer –Addition & Subtraction are done via the Accumulator –Reading and Printing are done via Memory –Decision and Repetition (PJUMP) are done via the Accumulator –We will write our programs with Mnemonics and assume there's an Assembler to translate our program into binary/machine code we can use “named” memory slots (variables) instead of “numbered” memory slots. –In essence, we don't care which specific memory slot we use, as long as its use is consistent READ X ==assembler==> –We wish to read a value from the keyboard (user) and store it in a named slot “X” -- the assembler decides “X” is slot 17, so all other references to “X” should be turned into 17.

19-4 The Pencil and Paper Computer Process for writing Pencil & Paper Computer programs: 1. Determine the requirements What is the input? What is the desired output? What needs to be computed? 2. Determine the algorithm. Break the problem down into steps. How do we computer what needs to be computed? Write an outline of the steps. 3. Write the program. 4. Test/Debug (Trace through the program)

19-5 The Pencil and Paper Computer Problem: Write a program that prints the counting numbers from 5 down to 1. ONE = 1 COUNT = 5 0 PRINT COUNT 1 LOADCOUNT 2 SUBONE 3 STORECOUNT 4 PJUMP0 5 STOP Memory: Accumulator: Output: CountOne

19-6 The Pencil and Paper Computer The count down from 5 program in machine code... Memory Address Value ONE = 1 COUNT = 5 0 PRINT COUNT 1 LOADCOUNT 2 SUBONE 3 STORECOUNT 4 PJUMP0 5 STOP