Little Man FDE Cycle

The Little Man Computer

Load an assembly program, then step through the Fetch, Decode, Execute cycle. Follow the Little Man as he moves values between the registers, the ALU and memory along the address and data buses.

  1. FetchCopy the next instruction from memory into the CPU, using the PC, MAR, MDR and both buses.
  2. DecodeSplit the instruction in the CIR into its opcode and operand and work out what it means.
  3. ExecuteCarry out the instruction using the registers, the ALU and memory. Then the cycle repeats.

Assembly program

Use // for comments

Assembled into memory

Machine code 507 opcode = what to do operand = which address
AddrLabelInstructionOpcodeOperandCode
Instruction set
CodeMnemonicWhat it does
1xxADDACC ← ACC + value at address xx
2xxSUBACC ← ACC − value at address xx
3xxSTAStore ACC in memory at address xx
5xxLDALoad the value at address xx into ACC
6xxBRABranch always: PC ← xx
7xxBRZBranch if ACC is zero
8xxBRPBranch if ACC is zero or positive
901INPInput a number into ACC
902OUTOutput the value in ACC
000HLTStop the program
—DATNot an instruction: reserves a memory location for data
Control bus · READ and WRITE signals CPU (processor) Control unit PC Program Counter 00 Decoder — CIR Current Instruction Register instruction 000 → opcode ? operand ?? MAR Memory Address Register 00 MDR Memory Data Register 000 ACC Accumulator 000 ALU Arithmetic Logic Unit Address bus one way → Data bus two way ↔ Main memory (RAM) addresses 00–99 Input keyboard → ACC — Output ACC → screen — Instructions completed 0
Ready

Ready to fetch

Output

Explore the diagram

Click any part of the CPU, a bus, a memory location or the Little Man to see what it does.