SimHYMN Explained Simply

Written by

in

SimHYMN is an educational Central Processing Unit (CPU) and memory simulator designed to teach introductory computer science students how a computer executes programs at the machine level. Created by Dr. Carl Burch, it simplifies complex computer architecture into a microscopic, easy-to-understand model consisting of just 3 registers, 32 bytes of memory, and 8 core instructions.

By stripping away the millions of moving parts found in a modern processor, SimHYMN demystifies the foundational “Fetch-Execute” cycle that powers every computer on earth. The Architecture: Anatomy of a Micro-CPU

Modern CPUs have billions of transistors and complex caching layers, but SimHYMN boils the hardware down to the absolute bare essentials. It is divided into two primary zones: the CPU registers and the system memory. The Three Key Registers

Registers are ultra-fast, tiny storage slots built directly into the CPU. SimHYMN uses exactly three:

Program Counter (PC): A 5-bit register that holds the memory address of the very next instruction waiting to be executed.

Instruction Register (IR): Temporarily holds the instruction that the CPU is currently processing.

Accumulator (AC): The “action” register. Any math, data loading, or logical comparison happens inside the AC. The Memory Grid

SimHYMN features a tiny 32-byte RAM grid (addresses 00000 to 11111 in binary). Each memory slot holds an 8-bit “word”. Because space is so limited, a single 8-bit word must pull double duty—storing either a raw data value or an entire program instruction. Anatomy of a SimHYMN Instruction

Every instruction in SimHYMN is exactly 8 bits (1 byte) long and is strictly split into two parts:

[ 3-bit Op Code ]+[ 5-bit Data/Address ][ 3-bit Op Code ] plus [ 5-bit Data/Address ]

The Op Code (First 3 bits): Specifies what action the CPU should perform (e.g., 110 means ADD). Because 3 bits can only create 8 unique binary combinations (2³), SimHYMN is limited to exactly 8 instructions.

The Data/Address (Last 5 bits): Specifies where in the memory the CPU should look to find or store the data (2⁵ = 32 possible RAM slots). The 8-Instruction Vocabulary

SimHYMN can execute a surprising variety of programs using a vocabulary of just eight commands: What It Tells the CPU to Do 000 HALT Stops the simulator immediately. 001 JUMP

Forces the PC to jump directly to a specified memory address. 010 JZER

Conditional jump: If the Accumulator (AC) is exactly 0, jump to the address; otherwise, move to the next line. 011 JPOS

Conditional jump: If the Accumulator (AC) is greater than 0, jump to the address. 100 LOAD

Copies a value from a memory address and places it into the AC. 101 STOR

Takes the value currently in the AC and saves it into a memory address. 110 ADD

Pulls a value from memory, adds it to the AC, and stores the new total back in the AC. 111 SUB

Pulls a value from memory, subtracts it from the AC, and stores the result in the AC. Special “Tricks”: Input and Output

How do users pass information into or out of a SimHYMN program? The system uses a concept called Memory-Mapped I/O. The simulator steals the last two memory addresses (30 and 31 in decimal) and wires them straight to the user interface: The SimHYMN Instruction Set

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *