The Little-Man Computer Damian Gordon. The Little-Man Computer Most computer architectures conform to the so-called von Neuman Architecture. This means.

Slides:



Advertisements
Similar presentations
The “Little Man Computer” Version
Advertisements

Computer Architecture and the Fetch-Execute Cycle
Learning how to use the Little man computer
The Little man computer
The CPU Revision Typical machine code instructions Using op-codes and operands Symbolic addressing. Conditional and unconditional branches.
Instruction Set Architecture & Design
LMC Little Moron Computer
Some thoughts: If it is too good to be true, it isn’t. Success is temporary. It is hard work to make it simple. Knowing you did it right is enough reward.
CSCE 121, Sec 200, 507, 508 Fall 2010 Prof. Jennifer L. Welch.
Recap – Our First Computer WR System Bus 8 ALU Carry output A B S C OUT F 8 8 To registers’ input/output and clock inputs Sequence of control signal combinations.
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
Von Neumann architecture
EBeckett: Using The Work Of Samuel Beckett To Teach Fundamental Computing Concepts Damian Gordon.
An Interactive Web-Based Simulation of a General Computer Architecture
IT253: Computer Organization Lecture 4: Instruction Set Architecture Tonga Institute of Higher Education.
GCSE Computing#BristolMet Session Objectives#11 MUST identify what program instructions consist of SHOULD describe how instructions are coded as bit patterns.
What have mr aldred’s dirty clothes got to do with the cpu
Computer Architecture and the Fetch-Execute Cycle
Computer Architecture and the Fetch-Execute Cycle
Microcode Source: Digital Computer Electronics (Malvino and Brown)
Chapter 4 MARIE: An Introduction to a Simple Computer.
Chapter 4 The Von Neumann Model
How Computers Work … and how you can work them. Art 315 Lecture 03 Dr. J Parker Fall 2010.
CHAPTER 6: The Little Man Computer
Chapter 8: The Very Simple Computer
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.
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.
CMSC 150 PROGRAM EXECUTION CS 150: Wed 1 Feb 2012.
D75P 34 – HNC Computer Architecture
CHAPTER 6: The Little Man Computer
© GCSE Computing Candidates should be able to:  describe the characteristics of an assembler Slide 1.
Dale & Lewis Chapter 5 Computing components
Von Neumann Model Computer Organization I 1 September 2009 © McQuain, Feng & Ribbens The Stored Program Computer 1945: John von Neumann –
Examples with 3-Digit Numbers
CMSC 104, Lecture 061 Stored Programs A look at how programs are executed.
Computer Organization Instructions Language of The Computer (MIPS) 2.
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.
The Postman in your PC Today you are going to learn how a computer’s CPU works to handle data. Teachcompsci.co.uk.
Instruction Memory value Description ADD1xx Add the value stored at memory address xx to the value in the accumulator register SUB2xx Subtract the value.
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.
Computer Architecture. Instruction Set “The collection of different instructions that the processor can execute it”. Usually represented by assembly codes,
Stored Program Concept Learning Objectives Learn the meaning of the stored program concept The processor and its components The fetch-decode-execute and.
The Little man computer
CHAPTER 6: The Little Man Computer
Gunjeet Kaur Dronacharya Group of institutions
Chapter 4 The Von Neumann Model
CHAPTER 6: The Little Man Computer
Review of computer processing and the basic of Operating system
Lesson Objectives A note about notes: Aims
Chapter 4 The Von Neumann Model
Chapter 4 The Von Neumann Model
Starter Read the Feedback Click on Add new Feedback Open Realsmart
Data Representation – Instructions
CHAPTER 6: The Little Man Computer
Making Programming Friendlier
EBeckett: Using The Work Of Samuel Beckett To Teach Fundamental Computing Concepts Damian Gordon.
Phillipa Gill SCI 199 Y Tutorial Sept. 14, 2009 Phillipa Gill
Computer Architecture
Computer Architecture
Chapter 4 The Von Neumann Model
DO IT NOW The LMC has the following instruction set:
The Stored Program Computer
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.
A Level Computer Science Topic 5: Computer Architecture and Assembly
Objectives Describe common CPU components and their function: ALU Arithmetic Logic Unit), CU (Control Unit), Cache Explain the function of the CPU as.
Learning how to use the Little man computer
Little Man Computer.
Presentation transcript:

The Little-Man Computer Damian Gordon

The Little-Man Computer Most computer architectures conform to the so-called von Neuman Architecture. This means that they execute programs by accessing both instructions and data on the same storage device. The computer performs the following sequence of steps;

The Little-Man Computer 1.Fetch the next instruction from memory at the address in the program counter 2.Decode the instruction using the control unit 3.Increment the Program Counter 4.The control unit commands the rest of the computer to execute the instruction 5.Go to step 1

The Little-Man Computer This is the Fetch-Decode-Execute (FDE) cycle. These computers are known as Stored- Program Computers since the separation of storage from the processing unit is implicit in this model.

The Little-Man Computer A conceptual device or thought experiment to teach this architecture was developed by Stuart Madnick of MIT in the 1960s and is called the Little Man Computer (LMC) Paradigm.

The Little-Man Computer The LMC Paradigm consists of a room with a 'Little Man' (or homunculus) who simulates the operations of a computer. The room has an array of locations that store information (and instructions), an input and output tray, and a calculator.

The Little-Man Computer The analogy between the LMC and real computers is not perfect, but this approach is a simple and powerful conceptual model which allows us easy entry level to the basics of computer architecture.

In-tray Out-tray

In-tray Out-tray Pigeon Holes

In-tray Out-tray In-tray

Out-tray Program Counter

In-tray Out-tray Calculator

In-tray Out-tray Out-tray

In-tray Out-tray

The addresses of the pigeon- holes are consecutive, and they may contain either: – Data (numbers, values), or – Instructions (copy, subtract, add) 17 20

In-tray Out-tray -- Each morning the boss fills the pigeon-holes with several instructions and data, and puts papers in the IN-TRAY

In-tray Out-tray -- The Little Man’s job is to read these instructions one at a time, reading the corresponding instruction to the value on the Program Counter.

In-tray Out-tray -- The calculator (aka Accumulator) can be used to store values temporarily, and do arithmetic (add, subtract, etc.).

In-tray Out-tray -- The Little-Man will output all of his results into the OUT-TRAY which the boss collects in the evenings.

In-tray Out-tray

In-tray Out-tray STORE

In-tray Out-tray STORE

In-tray Out-tray STORE LOAD

The Little-Man Computer TYPE OF INSTRUCTIONINSTRUCTIONDESCRIPTION ArithmeticADD Add the value of a given memory location to calculator ArithmeticSUBTRACT Subtract the value of a given memory location to calculator Data MovementSTORE Copy the value from the calculator into a given memory location Data MovementLOAD Copy the value from a given memory location into the calculator Input/OutputINPUT Get the value from the IN-TRAY and put it into the calculator Input/OutputOUTPUT Put the value in the calculator into the OUT-TRAY Machine ControlSTOP Take a break

The Little-Man Computer Let’s see a program in action.

In-tray Out-tray

In-tray Out-tray

In-tray Out-tray INBOX --> ACCUMULATOR INPUT the first number, enter into calculator 55

In-tray Out-tray INBOX --> ACCUMULATOR INPUT the first number, enter into calculator

In-tray Out-tray

In-tray Out-tray ACCUMULATOR --> MEMORY[08] STORE the calculator's current value in memory location [08]

In-tray Out-tray ACCUMULATOR --> MEMORY[08] STORE the calculator's current value in memory location [08]

In-tray Out-tray

In-tray Out-tray INBOX --> ACCUMULATOR INPUT the second number, enter into calculator

In-tray Out-tray INBOX --> ACCUMULATOR INPUT the second number, enter into calculator

In-tray Out-tray

In-tray Out-tray ACCUMULATOR --> MEMORY[09] STORE the calculator's current value in memory location [09]

In-tray Out-tray ACCUMULATOR --> MEMORY[09] STORE the calculator's current value in memory location [09]

In-tray Out-tray

In-tray Out-tray MEMORY[08] --> ACCUMULATOR LOAD the first value back into the calculator

In-tray Out-tray MEMORY[08] --> ACCUMULATOR LOAD the first value back into the calculator

In-tray Out-tray

In-tray Out-tray ACCUMULATOR = ACCUMULATOR - MEMORY[09] SUBTRACT the second number from the first value

In-tray Out-tray ACCUMULATOR = ACCUMULATOR - MEMORY[09] SUBTRACT the second number from the first value

In-tray Out-tray ACCUMULATOR = ACCUMULATOR - MEMORY[09] SUBTRACT the second number from the first value

In-tray Out-tray

In-tray Out-tray ACCUMULATOR --> OUTBOX OUTPUT the calculator's result to the OUT-TRAY

In-tray Out-tray ACCUMULATOR --> OUTBOX OUTPUT the calculator's result to the OUT-TRAY

In-tray Out-tray

In-tray Out-tray Take a break

In-tray Out-tray

The Little-Man Computer The Little-Man doesn’t need to understand the overall goal of the instructions (in this case he doesn’t need to know that he is subtracting two numbers), as long as the boss has arranged the instructions correctly, and the Little-Man follows them, everything works without understanding. (cf. John Searle's Chinese Room Argument)

The Little-Man Computer But, that’s a bit too easy, because the instructions are in plain English. Let’s make it a bit more complicated Let’s restate the English as more computer-like instructions.

The Little-Man Computer An instruction has two parts – what to do (Operation) and what to do it on (the Operands), e.g. SUBTRACT Accumulator, [09]

The Little-Man Computer An instruction has two parts – what to do (Operation) and what to do it on (the Operands), e.g. SUBTRACT Accumulator, [09] Operation

The Little-Man Computer An instruction has two parts – what to do (Operation) and what to do it on (the Operands), e.g. SUBTRACT Accumulator, [09] OperandsOperation

The Little-Man Computer Note: SUBTRACT Accumulator, [09] which is SUBTRACT 55, 36 which is 29

The Little-Man Computer So, let’s create codes for different kinds of operations:

The Little-Man Computer TYPE OF INSTRUCTIONINSTRUCTIONCODE ArithmeticADD1xx ArithmeticSUBTRACT2xx Data MovementSTORE3xx Data MovementLOAD5xx Input/OutputINPUT901 Input/OutputOUTPUT902 Machine ControlSTOP000

The Little-Man Computer So: SUBTRACT Accumulator, [09] becomes 209

The Little-Man Computer And: Becomes: 901, 308, 901, 309, 508, 209, 902, 000 INBOX --> ACCUMULATOR INPUT the first number, enter into calculator ACCUMULATOR --> MEMORY[08] STORE the calculator's current value in memory location [08] INBOX --> ACCUMULATOR INPUT the second number, enter into calculator ACCUMULATOR --> MEMORY[09] STORE the calculator's current value in memory location [09] MEMORY[08] --> ACCUMULATOR LOAD the first value back into the calculator ACCUMULATOR = ACCUMULATOR - MEMORY[09] SUBTRACT the second number from the first value ACCUMULATOR --> OUTBOX OUTPUT the calculator's result to the OUT-TRAY Take a break

The Little-Man Computer NOTE: We are doing A-B, which is not the same as B-A, so we read A into the calculator, move it to memory, we read B into the calculator, move it to memory, move A back into the calculator, and do the subtraction. This is because the command works as follows: SUBTRACT CALCULATOR, MEMORY So A has to be in the calculator, and B in memory.

The Little-Man Computer So what does that look like from the Little- Man’s perspective?

In-tray Out-tray

In-tray Out-tray

In-tray Out-tray

In-tray Out-tray

In-tray Out-tray

In-tray Out-tray

In-tray Out-tray

In-tray Out-tray

In-tray Out-tray

In-tray Out-tray

In-tray Out-tray

In-tray Out-tray

In-tray Out-tray

In-tray Out-tray

In-tray Out-tray

In-tray Out-tray

In-tray Out-tray

In-tray Out-tray

In-tray Out-tray

In-tray Out-tray

In-tray Out-tray

In-tray Out-tray

In-tray Out-tray

In-tray Out-tray

In-tray Out-tray

In-tray Out-tray

The Little-Man Computer TYPE OF INSTRUCTIONINSTRUCTIONOP CODE ArithmeticADD ArithmeticSUBTRACTSUB Data MovementSTORESTA Data MovementLOADLDA Input/OutputINPUTINP Input/OutputOUTPUTOUT Machine ControlSTOPHLT

The Little-Man Computer But what if we want to do IF statements or WHILE loops, we need some more commands. We call there “Branch” commands

The Little-Man Computer INSTRUCTIONCODEDESCRIPTIONOP CODE BRANCH (Unconditional) Unconditional branch. Set the Program Counter to value XX. 6xxBRA BRANCH IF ZERO Conditional branch. If the accumulator is zero, branch to XX, otherwise do nothing. 7xxBRZ BRANCH IF POSITIVE Conditional branch. If the accumulator is positive, branch to XX, otherwise do nothing. 8xxBRP

The Little-Man Computer So what does a BRA look like from the Little- Man’s perspective?

In-tray Out-tray

In-tray Out-tray

In-tray Out-tray

In-tray Out-tray

In-tray Out-tray

In-tray Out-tray

The Little-Man Computer So what does a BRZ look like from the Little- Man’s perspective?

In-tray Out-tray

In-tray Out-tray

In-tray Out-tray

In-tray Out-tray

In-tray Out-tray

In-tray Out-tray

The Little-Man Computer OR

In-tray Out-tray

In-tray Out-tray

In-tray Out-tray

In-tray Out-tray

In-tray Out-tray

In-tray Out-tray

In-tray Out-tray

The Little-Man Computer So what does a BRP look like from the Little- Man’s perspective?

In-tray Out-tray

In-tray Out-tray

In-tray Out-tray

In-tray Out-tray

In-tray Out-tray

In-tray Out-tray

In-tray Out-tray

The Little-Man Computer OR

In-tray Out-tray

In-tray Out-tray

In-tray Out-tray

In-tray Out-tray

In-tray Out-tray

In-tray Out-tray

The Little-Man Computer TYPE OF INSTRUCTIONINSTRUCTIONCODE ArithmeticADD1xx ArithmeticSUBTRACT2xx Data MovementSTORE3xx Data MovementLOAD5xx BranchingBRA6xx BranchingBRZ7xx BranchingBRP8xx Input/OutputINPUT901 Input/OutputOUTPUT902 Machine ControlSTOP000

The Little-Man Computer Let’s say we wanted to write a program to subtract two numbers, but if the first number is smaller than the second one, swap them around, so that the answer is always positive.

The Little-Man Computer Get A; Get B; Output := A – B; IF (Output) < 1 THEN Output := B – A; ENDIF;

The Little-Man Computer Get A; Get B; Output := A – B; IF (Output) < 1 THEN Output := B – A; ENDIF; INPSTA 10 INPSTA 11 SUB 10 BRP ENDIF; LDA 10SUB 11 OUT

The Little-Man Computer INBOX --> ACCUMULATOR INPUT the first number, enter into calculator ACCUMULATOR --> MEMORY[10] STORE the calculator's current value in memory location [10] INBOX --> ACCUMULATOR INPUT the second number, enter into calculator ACCUMULATOR --> MEMORY[11] STORE the calculator's current value in memory location [11] ACCUMULATOR = ACCUMULATOR - MEMORY[10] SUBTRACT the second number from the first value IS ACCUMULATOR POSITIVE? GOTO MEMORY[08] BRANCH to memory location [08] if accumulator is positive MEMORY[10] --> ACCUMULATOR LOAD the first value back into the calculator ACCUMULATOR = ACCUMULATOR - MEMORY[11] SUBTRACT the second number from the first value ACCUMULATOR --> OUTBOX OUTPUT the calculator's result to the OUT-TRAY Take a break [Used for data]

The Little-Man Computer INPSTA 10INPSTA 11 SUB 10BRP 08LDA 10SUB OUTHLTDAT

The Little-Man Computer DAT

The Little-Man Computer The Little-Man Computer helps explain how the computer works The Little-Man doesn’t need to know what the program does, it just needs to follow orders. The Little-Man only does one thing at a time, but the operating system can swap different programs so quickly that it looks like they are all running together.