Chapter 6 LMC Little Moron Computer von Neumann
- Slides: 30
Chapter 6 LMC Little Moron Computer
von Neumann Principles (revisited) • Stored program concept - Memory & Data • Memory is addressed linearly • Memory is addressed without regard to content 1 John von Neumann, 1945
LMC Mailboxes Calculator 00 LM 01 02 03 04 05 06 07 Counter 96 97 98 99
LMC Organization
CPU Components
LMC - CPU
LMC Instructions n n OPCODE OPERAND OPCODE Source OPERAND Instruction Mailbox Address
Address vs. Contents G Addresses are consecutive G Contents may be data or instructions
The CPU - The Instruction Cycle START Fetch Next Instruction & Decode Execute Instruction HALT Fetch Cycle Execute Cycle
Fetch an Instruction
Fetch an Instruction (continued)
Execute an Instruction
Execute an Instruction (continued)
LMC Instruction Set n n n 1 xx 2 xx 3 xx 5 xx 6 xx 7 xx 8 xx 9 01 9 02 0 00 ADD SUB STO LDA BR BRZ BRP IN OUT HLT DAT Arithmetic Data Movement Program Control Input/Output Data Storage Location
LDA INSTRUCTION 5 xx l l Go to mailbox with address xx Read 3 -digit number on paper in mailbox (leave paper there) Enter 3 -digit number into calculator Advance location counter NOTE: Accumulator changes in value. Contents of memory location xx does not change.
STO INSTRUCTION 3 xx l l l Retrieve value from calculator Go to mailbox at address xx and replace 3 -digit number on paper in mailbox with value from calculator Advance location counter NOTE: Accumulator does not change in value. Contents of memory location xx does change.
ADD INSTRUCTION 1 xx l l Go to mailbox with address xx Read 3 -digit number on paper in mailbox (leave paper there) Add 3 -digit number to number stored in calculator Advance location counter NOTE: Accumulator changes in value.
SUB INSTRUCTION 2 xx l l Go to mailbox with address xx Read 3 -digit number on paper in mailbox (leave paper there) Subtract 3 -digit number from number stored in calculator Advance location counter NOTE: Accumulator changes in value.
IN INSTRUCTION 9 01 l l Wait for paper slip to be placed in IN Basket. Remove paper from IN Basket, and read 3 -digit number on it Enter number into calculator Advance location counter NOTE: Accumulator changes in value.
OUT INSTRUCTION 9 02 l l l Copy number from calculator onto paper Place paper into OUT Basket Advance location counter NOTE: Accumulator does not change in value.
BRANCH INSTRUCTION 6 xx l Set value of location counter to xx
BRZ INSTRUCTION 7 xx l l Observe value stored in calculator If value is 0, set value of location counter to xx
BRP INSTRUCTION 8 xx l l Observe value stored in calculator If value is not negative, set value of location counter to xx NOTE: 0 value is considered positive.
HLT INSTRUCTION 0 00 l LMC takes a break. NOTE: Make no assumptions about contents of memory or calculator.
ADD TWO INPUT NUMBERS l l l l 00 01 02 03 04 05 99 IN STO 99 IN ADD 99 OUT HLT DAT 00 9 3 9 1 9 0 0 01 99 02 00 00
FIND POSITIVE DIFFERENCE OF TWO INPUT NUMBERS l l l 00 01 02 03 04 05 06 07 08 09 10 11 IN STO 10 IN STO 11 SUB 10 BRP 08 LDA 10 SUB 11 OUT HLT DAT 00 9 3 2 8 5 2 9 0 01 10 01 11 10 08 10 11 02 00 00 00
Problem 6. 6: Find largest of 3 numbers Part 1: Find larger of two numbers and store its value in memory cell. l 00 IN 9 01 ; input three numbers and save l 01 STO 99 3 99 l 02 IN 9 01 l 03 STO 98 3 98 l 04 IN 9 01 l 05 STO 97 3 97 l 06 SUB 98 2 98 ; subtract number in 98 from that in 97 l 07 BRP 10 8 11 ; number in 97 larger l 08 LDA 98 5 98 ; number in 98 larger-restore 98 l 09 BR 11 6 11 l 10 LDA 97 5 97 ; restore 97 l 11 STO 96 3 96 ; store larger of (97, 98) in 96
Problem 6. 6 (continued) l l l 12 13 14 15 16 17 18 96 97 98 99 SUB 99 BRP 16 LDA 99 BR 17 LDA 96 OUT HLT DAT 00 2 8 5 6 5 9 0 0 0 99 16 99 17 96 02 00 00 00 ; subtract number in 99 from larger ; number in 96 larger ; number in 99 larger--restore 99 ; restore 96
Problem 6. 7 - Find Largest of N Numbers l l l l 00 01 02 03 04 05 06 07 08 09 10 11 12 13 98 99 IN STO 99 IN BRZ 11 STO 98 SUB 99 BRP 08 BR 02 LDA 98 STO 99 BR 02 LDA 99 OUT HLT DAT 00 9 3 9 7 3 2 8 6 5 3 6 5 9 0 01 99 ; store the first number in 99 01 11 ; completion flag 98 ; store new value temporarily 99 08 ; new value larger--store it in 99 02 ; old value in 99 is larger--get next number 98 99 02 00 00 00; contains largest number currently input
Problem 6. 14: Program Loader l l l l l 00 … 86 87 88 89 90 91 92 BR 86 6 86; Jump to location 86 LDA 98 STO 92 INP SUB 97 BRZ 01 ADD 97 DAT 00 5 3 9 2 7 1 0 98 92 02 97 01 97 00 93 94 95 96 LDA 92 ADD 99 STO 92 BR 88 5 1 3 6 92 99 92 88 l l l l 97 DAT 999 98 DAT 301 99 DAT 01 9 99 3 01 0 01 ; initialize the STORE instruction at location 92 ; input a value ; subtract 999 ; done loading--jump to 01 for execution ; restore input value ; store value. This will contain 3 XX, with XX indexed ; each time ; load the STORE instruction in 92 ; increment it ; and resave it ; continue with the next input [NOTE: No test for exceeding ; memory] ; value 999 for testing ; initial STORE 01 instruction as a data value ; value 1 for indexing
- Lmc commands
- Iag moron
- Embesil idiot moron
- Isabel hormigos
- Embesil idiot moron
- Mar von neumann
- Von neumann model components
- John von neumann institute
- John von neumann random number generator
- John von neumann schema
- Gargalo de von neumann
- Relance poker
- Jon von neumann
- Sexitillion
- John von neumann university
- First draft of a report on the edvac
- John louis von neuman
- Modello di von neumann spiegazione semplice
- Von neumann
- Ias von neumann
- Von neumann model components
- Non von neumann model
- Estrutura de von neumann
- Ventajas de la arquitectura de von neumann
- Architettura harvard
- Architektura von neumanna
- Von neumann test
- Modelo de von neumann
- Von neumann rechner simulation
- John von neumann algorithm
- Il modello di von neumann