Title: CHAPTER 6: The Little Man Computer
1CHAPTER 6The Little Man Computer
- The Architecture of Computer Hardware and Systems
Software An Information Technology Approach - 3rd Edition, Irv Englander
- John Wiley and Sons ?2003
- Linda Senne, Bentley College
- Wilson Wong, Bentley College
2Introduction
- The power of the computer does not arise from
complexity. Instead, the computer has the ability
to perform simple operations at an extremely high
rate of speed. - These operations can be combined to provide the
computer capabilities that you are familiar with.
3LMC Little Man Computer
- Original was created by Dr. Stuart Madnick at MIT
in 1965. - He produced a newer version in 1979. The newer
version has a slightly modified instruction set.
We will use the modified version.
4The Little Man Computer
5Mailboxes Address vs. Content
- Addresses are consecutive
- Content may be
- Data or
- Instructions
6Content Instructions
- Op code
- Operation code
- Arbitrary mnemonic
- Operand
- Object to be manipulated
- Data or
- Address of data
7Magic!
- Load program into memory
- Put data into In Basket
8Assembly Language
- Specific to a CPU
- 1 to 1 correspondence between assembly language
instruction and binary (machine) language
instruction - Mnemonics (short character sequence) represent
instructions - Used when programmer needs precise control over
hardware, e.g., device drivers
9Instruction Set Direct Addressing
10Instruction Set LOAD (Direct)
11Instruction Set STORE (Direct)
12Instruction Set ADD (Direct)
13Instruction Set SUB (Direct)
14Instruction Set INPUT
15Instruction Set OUTPUT
16Instruction Set HALT
17Instruction Set SKIP
18Instruction Set JUMP (Direct)
19What does this program do?
- 00 IN
- 01 STA 99
- 02 IN
- 03 ADD 99
- 04 OUT
- 05 HLT
- Write the opcode.
20What does this program do?
- 00 IN
- 01 STA 99
- 02 IN
- 03 STA 98
- 04 ADD 99
- 05 STA 97
- 06 LDA 99
- 07 OUT
- 08 LDA 98
- 09 OUT
- 10 LDA 97
- 11 OUT
- 12 HLT
21Write a program to
- Enter two number. Find (and output) the sum of
twice the first number plus the second number. - Enter two number. Compute the sum of twice the
first number and three times the second number.
Output the first number, then the second number,
then the result.
22INDIRECT ADDRESSING
23Instruction Set LOAD (Indirect)
24Instruction Set STORE (Indirect)
25Instruction Set ADD (Indirect)
26Instruction Set SUB (Indirect)
27Instruction Set JUMP (Indirect)
28Immediate Addressing
29Instruction Set LOAD (Immediate)
30Instruction Set ADD (Immediate)
31Instruction Set SUB (Immediate)
32Indirect, Immediate, Direct
- 00 IN
- 01 STA 99
- 02 ADD 05
- 03 STA 99
- 04 ADD 99
- 05 OUT
- 06 SUB 99
- 07 OUT
- 08 HLT
33Indirect, Immediate, Direct
- 00 IN Input a number gt 10 to the calculator
- 01 STA 99 Direct Addressing--Store data in
calc to mailbox 99 - 02 ADD 05 Add the number five to the
calculator - 03 STA 99 Indirect addressing- Store
contents of calculator - to the mailbox pointed to by the contents
- of mailbox 99
- 04 ADD 99 Indirect addressing Add contents
of mailbox pointed by 99 to
contents of the calculator - 05 OUT
- 06 SUB 99 Indirect addressing-- Subtract
contents of mailbox pointed to by the
contents of mailbox 99 - 07 OUT Print out result in calculator to
output basket - 08 HLT End program
34Counting Forward INFINITE
- 00 LDA 90
- 01 OUT
- 02 ADD 01
- 03 STA 90
- 04 JMP 01
- 05 HLT
- 90 DAT 00
35Counting up to an enter num
- 00 IN
- 01 STA 99
- 02 LDA 90
- 03 OUT
- 04 ADD 01
- 05 STA 90
- 06 LDA 99
- 07 SUB 01
- 08 SKN
- 09 JMP 01
- 10 HLT
- 90 DAT 00
36LMC Input/Output
IN OUT
37LMC Internal Data
LDA STA
38Data storage location
- Physically identical to instruction mailbox
- Not located in instruction sequence
- Identified by DAT mnemonic
39LMC Arithmetic Instructions
ADD SUB
40Instruction Cycle
- Fetch Little Man finds out what instruction he
is to execute - Execute Little Man performs the work.
41Fetch Portion ofFetch and Execute Cycle
1. Little Man reads the address from the location
counter
2. He walks over to the mailbox that corresponds
to the location counter
42Fetch, cont.
3. And reads the number on the slip of paper (he
puts the slip back in case he needs to read it
again later)
43Execute Portion
1. The Little Man goes to the mailbox address
specified in the instruction he just fetched.
2. He reads the number in that mailbox (he
remembers to replace it in case he needs it
later).
44Execute, cont.
3. He walks over to the calculator and punches
the number in.
4. He walks over to the location counter and
clicks it, which gets him ready to fetch the next
instruction.
45von Neumann Architecture (1945)
- Stored program concept
- Memory is addressed linearly
- Memory is addressed without regard to content