The Little Man Computer PowerPoint PPT Presentation

presentation player overlay
1 / 39
About This Presentation
Transcript and Presenter's Notes

Title: The Little Man Computer


1
The Little Man Computer
  • LMC was created by Dr. Stuart Madnick at MIT 1965

2
Layout of the LMC
  • LMC consists of a walled mailroom
  • There are 100 mailboxes addressed from 00 to 99
  • A mailbox can hold a signal slip of paper which
    is written three-digit decimal number
  • Calculator can add, subtract and hold 3-digit
    temporarily number
  • Hand counter is for little man to see which
    mailbox he has to get reset button is for people
    outside mailroom to press
  • Basket in and Basket out are for little
    communicate with outside world

3
Figure 6.1 The Little Man Computer
4
Operation of the LMC
  • 3 digits mean following
  • 1 digits for instruction (op code)
  • The rest for mailbox address (address)

3 25
5
Operation of the LMC cont.
  • Load instruction op code 5
  • Store instruction op code 3
  • Add instruction op code 1
  • Subtract instruction op code 2
  • Input instruction op code 9, address 01
  • 901
  • Output instruction op code 9, address 02
  • 902
  • Coffee break instruction (Halt) op code 0

6
Load
Walk to mailbox address
Little Man
Read 3-digit number in that mailbox
Walk to calculator and put these numbers to the
calculator
The numbers in the mailbox are left unchanged
7
Store
Walk to calculator and read 3-digit number on
calculator
Little Man
Write 3-digit number in a blank paper
Walk to mailbox address and put this paper to the
mailbox
The numbers in the calculator are left unchanged
8
Add
Walk to mailbox address
Little Man
Read 3-digit number in that mailbox
Walk to calculator and add these numbers to the
calculator
The numbers in the mailbox are left unchanged
9
Subtract
Walk to mailbox address
Little Man
Read 3-digit number in that mailbox
Walk to the calculator and subtract value on
calculator from mailbox value
The numbers in the mailbox are left unchanged
10
Input
Walk basket in
Little Man
Read 3-digit number in that basket
Walk to the calculator and put these numbers on
11
Output
Walk to the calculator
Little Man
Read 3-digit number from the calculator write
down in a paper
Walk to the basket out and put this paper in
12
Coffee break (halt)
Little Man
  • Summary of instructions
  • Move data
  • Load, store
  • Simple arithmetic
  • Add, subtract
  • Input and output
  • Input, output
  • Control machine
  • Coffee break

Stop doing anything Just relax and take a glass
of coffee
13
A simple program
  • We need to find the place for store the program
  • We assume that the program is stored at mail box
    address 00
  • When LM completes the instruction, he walks to
    the counter to increase its value 1 more
  • We can reset LM to execute program by pressing
    the reset button

14
Add two numbers
  • User places two numbers in the in basket
  • Result will be returned in the out basket
  • Input 901
  • Store 99 399
  • Input 901
  • Add 99 199
  • Output 902
  • Coffee break 000

In class Do add 3 number
15
An extended instruction set
  • Branch unconditionally instruction (Jump) op
    code 6
  • Branch on zero instruction op code 7
  • Branch on positive instruction op code 8

16
Branch unconditionally
Walk to counter
Little Man
Change counter to specific number
Execute the instruction where counter shows
17
Branch on zero
Walk to calculator
Little Man
The number on calculator is zero?
Yes, change value in counter to mailbox address
No, dont care
continue executing next instruction
18
Branch on positive
Walk to calculator
Little Man
The number on calculator is gt 0?
Yes, change value in counter to mailbox address
No, dont care
continue executing next instruction
19
Example of branch program
  • While (i0)
  • do something
  • 45 LDA 90 590 90 contains i
  • 46 BRZ 48 748 branch on zero
  • 47 BR 60 660
  • do something
  • 59 BR 45 645
  • 60 COB stop

Look at table 6.3 for mnemonic instruction page
155
90 000
90 100
20
Another example of branch
  • Find the positive difference between two numbers
    ? a b where a, b gt 0
  • 00 IN 901
  • 01 STO 10 310 store a
  • 02 IN 901
  • 03 STO 11 311 store b
  • 04 SUB 10 210 b-a
  • 05 BRP 08 808 gt0?
  • 06 LDA 10 510
  • 07 SUB 11 211
  • 08 OUT 902 print output
  • 09 COB 000
  • 10 DAT 000 a
  • 11 DAT 000 b

In high level language if (b-agt0) print
(b-a) else print (a-b)
21
The Instruction Cycle
  • Fetch
  • Execute
  • Von Neumann architecture
  • Stored program concept
  • Sequential numeric address executing

22
Fetch
23
Execute
24
More example
  • Write a Little Man program that accepts three
    values as input and produces the largest of the
    three as output
  • Write a Little Man program that prints out the
    odd numbers from 1 to 99. No input is required

25
Addressing mode
  • Immediate
  • Direct
  • Indirect
  • Register
  • Register Indirect
  • Indexed Addressing

Why do we need to have other methods of
addressing techniques in stead of only absolute
addressing?
26
Immediate addressing
  • Data is in the instruction
  • No memory reference to fetch data
  • Fast
  • Limited range

27
Direct Addressing
  • Address field contains address of operand
  • e.g. ADD A
  • Add contents of cell A to accumulator
  • Look in memory at address A for operand
  • Single memory reference to access data
  • No additional calculations to work out effective
    address
  • Limited address space

28
Direct Addressing Diagram
29
Indirect Addressing Diagram
  • Memory cell pointed to by address field contains
    the address of (pointer to) the operand

30
Indirect Addressing
  • Large address space
  • 2n where n word length
  • Multiple memory accesses to find operand
  • Often used in branch instructions
  • Often used in access table
  • Could have multiple levels of indirection
  • Like pointer in C or Pascal
  • Hence slower

31
Little Man indirect addressing(1)
32
Little Man indirect addressing(2)
33
Register Addressing (1)
  • Very fast performance
  • Example, move r1, r2

34
Register Addressing (2)
  • Operand is held in register named in address
    filed
  • Limited number of registers
  • Very small address field needed
  • Shorter instructions
  • Faster instruction fetch
  • No memory access
  • Very fast execution
  • Very limited address space
  • Multiple registers helps performance
  • Requires good assembly programming or compiler
    writing

35
Register Addressing Diagram
36
Register Indirect Addressing
  • Operand is in memory cell pointed to by contents
    of register R
  • Large address space (2n)
  • n is number of bits in the register
  • One fewer memory access than indirect addressing
  • Can use Auto incrementing or auto decrementing
    for table access

37
Register Indirect Addressing Diagram
38
Indexed Addressing (1)
Modifying an address with an index register
39
Indexed Addressing (2)
Indexing a base offset address
Write a Comment
User Comments (0)
About PowerShow.com