Little Man’s Computer

SciCal600 / Educational simulator

READY

Program loaded.

01 Program Program

Start at 00

Assembly listing
AddressMachine codeSource instruction

02 Processor CPU

Decimal
ACC Calculator000
Z · 1N · 0
PC Next address00
IR Current instruction000
MAR Memory address00
MDR Memory data000
DECODEReady to fetch

PC → MAR → MDR → IR

Instructions completed0
Clock cycles0
CPU time0 μs

In-basket Input

Integers from 0–999, separated by spaces or commas. First in, first out.

Out-basket Output

Waiting for OUT

03 Mailboxes Memory

00–99
NextReadWriteDAT

Click a mailbox to inspect or edit its value and set a breakpoint. An orange dot marks a breakpoint.

04 Execution trace Register transfer language

Latest 160 micro-operations

Click “Step RTL” to follow each register transfer.

05Performance analysis

Lecture 5.2 · pp. 37–40

CPU time (μs) = clock cycles ÷ clock rate (MHz). Run speed only changes the animation; it does not change the simulated CPU clock.

Memory operations (reads + writes): 0 + 0 = 0

Counts reflect completed operations, including instruction fetches. Instruction counts update when an instruction finishes; the cycle total also includes a partially stepped instruction.

Lecture exercise: 3045 cycles

300 × 7 + 120 × 7 + 20 × 4 + 5 × 5 = 3045

At the selected clock rate: 30.45 μs

InstructionCycles eachExecutedCycles
Based on Lecture 5.1 (instruction set, examples and Von Neumann architecture) and Lecture 5.2 (RTL and performance). The negative-result display is a simulator convention; see Instructions & help. The LDA walkthrough separates decode as an explanation; the timing table uses 7 cycles for LDA.

Instructions & help

Choose an example → assemble → add input → step or run. Assembling resets the CPU, memory, input and output. Reassemble after editing the program.

InstructionCodeEffect
LDA XX5XXACC ← M[XX]
STO XX3XXM[XX] ← ACC; ACC is unchanged
ADD XX1XXACC ← ACC + M[XX]
SUB XX2XXACC ← ACC − M[XX]
INP901Read the oldest queued input
OUT902Copy ACC to the output
HLT / COB000Halt execution
BRA XX6XXUnconditional branch
BRZ XX7XXBranch when the zero flag Z = 1
BRP XX8XXBranch when non-negative (including zero)
DAT nnAllocate data; not a CPU instruction

Three digits and the negative flag

This simulator uses a project-defined model with three unsigned decimal digits: ACC and mailboxes store 000–999. ADD discards the thousands carry, so 999 + 2 → 001. SUB displays its result modulo 1000: 3 − 5 → 998, with a separate N = 1 flag so BRP can detect a negative result. The value 998 alone does not indicate the sign.

The displayed ACC value for a negative result is an explicit simulator convention; this display is part of the project-defined model. LDA and INP clear N; ADD / SUB update Z and N; STO, OUT and branches preserve the flags. STO stores only the three-digit value, not N. Loading it again with LDA treats it as non-negative data.

Syntax and stepping

Supports labels (e.g. LOOP SUB ONE), explicit addresses (e.g. 99 DAT 0)、//、; or # comments, and the STA / STORE / LOAD aliases. Machine code accepts one word per line or the explicit address format 00 901 . XX is a mailbox address, not an immediate value.

“Step instruction” finishes the current instruction; “Step RTL” performs one micro-operation. PC points to the next instruction, but during fetch it still points to the address being fetched. Its two-digit counter wraps from 99 to 00. HLT stops without incrementing PC. Unallocated mailboxes initially contain 000, which executes as HLT.

The project timing model uses LDA / STO / ADD / SUB = 7 cycles, INP / OUT = 5, branches = 4, and HLT = 3, with one cycle per RTL step. Time at 100 MHz = cycles ÷ 100, in μs.

Automatic execution pauses when INP has no input. Add data, then click Run. Execution pauses after 10,000 consecutive instructions to let you inspect a possible infinite loop; you may resume. Output belongs to the current run and is cleared by assembling or resetting.

Mailbox

Editing changes the live memory. Reset restores the assembled program. Editing an instruction lets you explore self-modifying code.