The “Little Man Computer” Version

Slides:



Advertisements
Similar presentations
2. Getting Started Heejin Park College of Information and Communications Hanyang University.
Advertisements

© 2010 Pearson Addison-Wesley. All rights reserved. Addison Wesley is an imprint of Chapter 5: Repetition and Loop Statements Problem Solving & Program.
Title Subtitle.
Solve Multi-step Equations
Chapter 2: Data Manipulation
Processor Data Path and Control Diana Palsetia UPenn
SE 292 (3:0) High Performance Computing L2: Basic Computer Organization R. Govindarajan
Figure 12–1 Basic computer block diagram.
CHAPTER 6: The Little Man Computer
MANINDER KAUR Maninder Kaur 1
Low-Level Programming Languages and Pseudocode
Computer Architecture and the Fetch-Execute Cycle
Chapter 4 The Von Neumann Model
CS 240 Computer Programming 1
25 seconds left…...
1. 2 CST-092 Beginning Computer Windows Concepts Lecture 1: Computer Concepts Computer Concepts Getting Started.
Chapter 10: The Traditional Approach to Design
Systems Analysis and Design in a Changing World, Fifth Edition
Execution Cycle. Outline (Brief) Review of MIPS Microarchitecture Execution Cycle Pipelining Big vs. Little Endian-ness CPU Execution Time 1 IF ID EX.
PSSA Preparation.
Stored Program Architecture
Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved Chapter 3 Loops.
Chapter 2 Data Manipulation Dr. Farzana Rahman Assistant Professor Department of Computer Science James Madison University 1 Some sldes are adapted from.
The Little man computer
Room: E-3-31 Phone: Dr Masri Ayob TK 2123 COMPUTER ORGANISATION & ARCHITECTURE Lecture 5: CPU and Memory.
LMC Little Moron Computer
CSCE 121, Sec 200, 507, 508 Fall 2010 Prof. Jennifer L. Welch.
Stored Program Concept: The Hardware View
Dale & Lewis Chapter 5 Computing components. Let’s design a computer Generic CPU with registers −Program counter (PC) – 5 bits (size of addresses) −Instruction.
The Little Man Computer
A-Level Computing#BristolMet Session Objectives#4 MUST describe the differences between the main types of primary memory SHOULD describe the function and.
The Computer Processor
A-Level Computing#BristolMet Session Objectives#5 MUST identify different buses and registers used in a CPU SHOULD describe the use of buses to send information.
An Interactive Web-Based Simulation of a General Computer Architecture
CS 1308 Computer Literacy and the Internet Computer Systems Organization.
CHAPTER 6: The Little Man Computer
Model Computer CPU Arithmetic Logic Unit Control Unit Memory Unit
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.
PHY 201 (Blum)1 Microcode Source: Digital Computer Electronics (Malvino and Brown)
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.
A summary of TOY. 4 Main Components Data Processor Control Processor Memory Input/Output Device.
© GCSE Computing Candidates should be able to:  describe the characteristics of an assembler Slide 1.
COMPILERS CLASS 22/7,23/7. Introduction Compiler: A Compiler is a program that can read a program in one language (Source) and translate it into an equivalent.
Electronic Analog Computer Dr. Amin Danial Asham by.
Dale & Lewis Chapter 5 Computing components
Examples with 3-Digit Numbers
This is where you can reset and run your program. If your program has an “INP” (input) command, you will type it in this box here. Using the LMC These.
Mastering LMC Coding Part #1 Introduction to Low Level Languages Introduction to Little Man computer Simple examples (demos) with video tutorials included.
Program to multiply 2 numbers 500-Input x 291-Store acc. as x 500-Input y 292-Store acc. as y 193-Load y in to acc. (0 on 1 st parse) 391-Add x to acc.
The Postman in your PC Today you are going to learn how a computer’s CPU works to handle data. Teachcompsci.co.uk.
Little Man Computer Task 1 Last lesson you were asked to write a program to multiply two numbers together. The next slide has a working program to do this.
1. 2 TimeActivity 9:45Welcome and introductions 10:00What is a computer? 10:15What’s inside? 10:45Activity: A simple view of how computers work 11:15Coffee/tea.
The Little man computer
CHAPTER 6: The Little Man Computer
CHAPTER 6: The Little Man Computer
Review of computer processing and the basic of Operating system
Lesson Objectives A note about notes: Aims
Starter Read the Feedback Click on Add new Feedback Open Realsmart
The Processor and Machine Language
CHAPTER 6: The Little Man Computer
CSCE Fall 2013 Prof. Jennifer L. Welch.
MARIE: An Introduction to a Simple Computer
The Little Man Computer
Computer Architecture
Computer Architecture
CSCE Fall 2012 Prof. Jennifer L. Welch.
GCSE OCR 1 The CPU Computer Science J276 Unit 1
Little Man Computer There’s a little man in the mailroom that follows each instruction to the letter but he can only follow one instruction at a time.
Objectives Describe common CPU components and their function: ALU Arithmetic Logic Unit), CU (Control Unit), Cache Explain the function of the CPU as.
Little Man Computer.
Presentation transcript:

The “Little Man Computer” Version How the CPU Works The “Little Man Computer” Version

Download the tutorial You can download your own copy of the Little Man Computer simulation from the University of Hertfordshire Start the download now Save it to your hard drive We will use it shortly The link: http://www.herts.ac.uk/lis/ltdu_temp/ltdu/projects/mm5/# You can access this link directly from my website

The Little Man Computer

LMC Instruction Codes LOAD instruction – op code 1 Note: The Little Man goes to the mailbox specified Reads the three-digit number in the mailbox Puts that into the Calculator Note: The number in the mailbox is unchanged The number in the calculator is replaced by the new number

LMC Instruction Codes STORE instruction – op code 2 Note: The Little Man goes to the Calculator and reads the number there He writes the number down on a slip of paper and puts it into the mailbox specified in the instructions Note: The number in the Calculator does not change The number in the Mailbox is replaced with the new value

LMC Instruction Codes ADD instruction – op code 3 Note: The Little Man walks over to the mailbox address specified in the instructions He reads the number and adds this number to the number already in the calculator. Note: The number in the mailbox is unchanged

LMC Instruction Codes SUBTRACTION – op code 4 Note: Same as the ADD instruction, except the number is subtracted For this model we will assume that the Little Man handles negative numbers correctly, though we will not deal with it here. Note: The number in the mailbox is left unchanged

LMC Instruction Codes INPUT (or READ) – op code 5, “address” 00 (the 00 is ignored for this special instruction code) The Little Man gets a slip of paper in from the in-basket He types this number into the calculator Each INPUT instruction handles only 1 slip of paper The Little Man will ignore the address portion of this code

LMC Instruction Codes OUTPUT (or PRINT) – op code 6, “address” 00 (the 00 is ignored for this special instruction code) The Little Man walks to the calculator and writes down the number on a slip of paper This slip is put in to the out basket Each OUTPUT instruction places 1 piece of paper in the out basket The Little Man will ignore the address portion of this code

LMC Instruction Codes COFFEE BREAK (or HALT) – op code 7 The Little Man takes a break. He will ignore the address portion of the instruction

A Simple Program A few items We need to store the instructions somewhere We need a method to tell the Little Man where to find the particular instructions that he is supposed to perform at any given time

A Simple Program Assumed Solutions Assume that the instructions are stored in the mailbox starting at mailbox number 00 The Little Man will perform instructions by looking at the value in the instruction location counter and execute the instruction found in the mailbox whose address has that value

A Simple Program Assumed Solutions Each time the LM completes and instruction, he will increment the Instruction Location Counter and do the instruction specified by the counter

A Simple Program Look at a program where the USER uses the Little Man Computer to add two numbers. The User will place two numbers in the in basket The sum of the two will appear as a result in the out basket

A Simple Program INPUT 500 The first step is to give the LM access to the data This instruction has the LM read the first number from the in basket in to the calculator

A Simple Program STORE 99 299 It is not possible for the LM to simply read another number into the calculator. It would destroy the first number We must save the first number somewhere Mailbox 99 is chosen so that we don’t have any conflicts with other data or programs Discuss this

A Simple Program INPUT 500 ADD 399 The LM reads the second number into the calculator ADD 399 We do not need to save the 2nd number in the example, but we could have. The 1st number from mailbox 99 is added to the 2nd number in the calculator

A Simple Program OUTPUT 600 COFFEE BREAK 700 Note: The LM puts the result in to the out basket COFFEE BREAK 700 The program terminates Note: These instructions are stored sequentially starting from mailbox 00. This is so we could run the program again

A Simple Program Code Summary 00 500 INPUT 01 299 STORE DATA Mailbox Instruction Step code description 00 500 INPUT 01 299 STORE DATA 02 500 INPUT 2ND # 03 399 ADD 1ST # TO it 04 600 OUTPUT RESULT 05 700 STOP 99 DATA

Extended Code Set Example of Branching 45 LDA 90 590 90 is assumed to have a value 46 BRZ 48 748 Branch if the value is 0 47 BR 60 660 Exit loop; Jump to NextStatement 48 … This is where the task is located 59 BR 45 645 End of Task; loop test again 60 Next code statement

Run the CPU Simulator Now you try it. Do the sample program included with the simulation Write your own program (and show me that they work) Write a program to add 3 numbers Write a program that correctly calculates x + y + z – a – b (Ex. 1 + 2 + 3 – 4 – 5 = -3) For the bold and intelligent ones: Write the last program only using 2 mailboxes!

How the CPU Works A More Complex View

Overview We saw in the “Little Man Computer” a simplified version of how a CPU works. Memory, the Control Unit, the Accumulator (calculator) were all located in the same area Decimal system used for communication of instructions Memory was limited to 100 “mailboxes”

CPU Components 3 Major Parts Arithmetic/Logic Unit (ALU) Control Unit (CU) Memory The ALU & CU are known as the Central Processing Unit

Block Diagram of System Memory CPU ALU I/O Control Unit Program Counter

Direct Comparison of LMC & CPU Control Unit ALU I/O Interface Memory Program Counter

Arithmetic/ Logic Unit (ALU) Memory CPU ALU I/O Control Unit Program Counter Arithmetic/ Logic Unit (ALU) The component where data is held temporarily Calculations occur here It knows how to perform operations such as ADD, SUB, LOAD, STORE, SHIFT. It knows the commands that make up the machine language of the CPU It is the calculator

Control Unit Program Counter Memory CPU ALU I/O Control Unit Program Counter Control Unit Interprets and controls the execution of instructions This control corresponds to the “fetch-execute” cycle The fetch cycle gets the instructions The execute cycle does the work specified in the instruction Most of the actions of the fetch-execute cycle are the movement of data or addresses from one part of the cpu to another Note

Control Unit Program Counter Memory CPU ALU I/O Control Unit Program Counter Registers “A Register is a single, permanent storage location within the CPU used for a PARTICULAR, defined purpose.” “A register is used to hold a binary value temporarily for storage, for manipulation, and/or for simple calculations.” Registers have special addresses

The End…