CPU Microcode Animation

This microcode animator demonstrates how the microcode can direct the CPU functions. By setting switches to connect registers to the internal CPU bus, the processor can execute instructions.

The table of check boxes below represents the microcode store or the read-only microcode memory inside the processor. Each box controls one switch that can connect a register to the internal CPU bus. When the check box is selected or "true", the switch is closed and the value from the register is put on the bus or the value on the bus is copied to the register. When a check box is clear or "false", the switch is open and the register and bus are disconnected.

A closed switch is represented with and an open switch is represented with .

The Arithmetic Logic Unit or ALU performs the math functions (such as add, subtract, increment, etc.) and logical functions (such as AND, OR, etc.). For single operand functions such as increment and decrement, the ALU operates on the value on the internal bus. For two operand functions such as add and subtract, one operand comes from the bus and the other comes from the operand register. A data value must be copied into the operand register before executing a binary ALU operation. The results of the ALU operation can be copied into the result register if this switch is closed.

The memory system can read or write to RAM. Because the memory system usually is much slower than the CPU microstep execution, it is necessary to wait for a memory read or write to complete. After issuing a read or write, the microcode must perform a memory wait to assure the memory system has had time to copy the requested data into the Memory Data Register. To read a value from memory, the address desired must be copied into the Memory Address Register. The memory function is set to read. In a following step the memory function must be set to wait. After that the value in the Memory Data Register can be copied to the bus and to its desired location. To write a value to memory, the address must be placed in the Memory Address Register and the data in the Memory Data Register before a write.

Enter the microcode program into the table below or select an example and then press the Step Microcode button to execute each line of the microcode.

Your Browser Does Not Support Canvas

bus→IR IRadr→bus result→bus bus→ALU bus→oprnd bus → PC PC→bus bus→R1 R1→bus bus→R2 R2→bus bus→MAR bus→MBR MBR→bus ALU func Mem func