S 00000000 Instruction Register S E I 00000000 Program Counter Control Unit Foo Bar S E 00000000 General Register A S E 00000000 General Register B S 00000000 Math Register T1 S 00000000 Math Register T2 ALU S 00000000 Address Register S E RAM Op Code Zero Sign Clock Run Program Run Instruction Step Clock Delay (ms) Reset
Hello!

Welcome to ProcVis, a program to help visualise how processors work

The interactive diagram above shows a very simple computer architecture.

Registers

The small rectangles are registers, these all store an eight digit (eight bit) binary number. The value they are storing at any time is written on them. Each register has up to three control inputs labeled 'S', 'E', and 'I' for Set, Enable, and Increment respectively. When a register has the 'Set' control active it will store the value currently on the data-bus. The 'Enable' control does the opposite, making the register put its value onto the data-bus. Finally, the 'Increment' control is only used by the program counter and causes it to increment (add 1 to) its stored value.

Tip: Click on the registers to cycle between decimal, hex, and binary representations

Control Unit

The large rectangle on the left, labeled Control Unit (CU), is responsible for decoding the instructions and sending signals to the other components telling them what to do each clock cycle. This includes sending the Set/Enable signals for the registers and ram, and the op-codes for the ALU.

ALU

The odd shaped block in the middle labeled ALU is the "Arithmetic and Logic Unit". This is responsible for performing any calculations wanted by the program. When given an op-code on its three control lines from the CU, the ALU takes the values stored in registers T1 and T2, performs the corresponding calculation with them, and outputs the result onto the data-bus. There are four extra lines going from the ALU into the Control Unit which carry some extra data about the output. These are called the "Flags", and show if the maths resulted in a value of Zero, the Sign bit was high (i.e. the result is less than zero), if there was a potential Overflow (e.g. two positive numbers added resulted in a negative), and if the Carry of the output was high (e.g. addition of unsigned numbers was greater than eight bits).

RAM

The large block on the right is computer's memory, called Random Access Memory or RAM as we are able to access any part of it at all times. This memory can be read or written to using the data-bus and Set/Enable control lines. To control where we write to in the memory we set an address in the address register, which tells the RAM where we would like to read from or write to. As with the registers, when the 'Set' control is active the memory at the specified address is set to the value on the data-bus, and with the 'Enable' control the value at the address is written to the data-bus.

Tip: Click on the address numbers next to each input to cycle between decimal, hex, binary, and text representations


Programming

The computer is initially loaded with a program that performs the multiplication 3×5 and stores the result at address 0x03 before entering an infinite loop. To see how this works use the buttons on the Clock. Fast-forward through to run through the entire program without stopping, use play to run through to the next instruction, or use the step button to advance one clock cycle at a time. To change the numbers being multiplied, change the value in 0x02 (initially 3) and 0x05 (initially 5). Make sure to reset the program beforehand by refreshing the page!

If you wish to play around further, the contents of the RAM can be edited by typing new values into each address. You can cycle the display mode between text, signed decimal, hexadecimal, and binary by clicking the address number.

When running, components will light up Red when being read from and Blue when being written to. The bus lines will change from blue to yellow when active for the data-bus and from red to cyan for control lines.

The shown "computer" uses an eight bit architecture, with the following instructions:
Operands to the instruction are in the form $i and $r. $r must be either 'a' or 'b' referring to general use registers a and b. $i can be 'a', 'b' or 'i' indicating to use instead the value immediately following the instruction. For convenience, when typing instructions immediate values can be given in-line (e.g. add a 1 a) and will be converted to the actual instructions on assembly (e.g. add a i a; 1).

If you have any feedback about this please email benjft.procvis@gmail.com.

You can also create a post here if you find any bugs/issues with the program.