Welcome to ProcVis, a program to help visualise how processors work
The interactive diagram above shows a very simple computer architecture.
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
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.
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).
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
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.
Note: Instructions with an immediate operand (e.g. the 10 in sub a 10 b) take two bytes of memory!
They are compiled to instructions in the form "sub a i b; 10;" with i showing the use of an immediate operand.
Note: To load a value from a specified address requires two instructions: first load the address into the target register, then load from the register address. e.g. "load 0x0f a; load a a" would be used to load the value at address "0x0f" into register 'a'.
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.