# Architectural breakdown: Buses and Registers

In this post I’ll continue to try and explain away the various bits of the architecture that will make up my relay computer project — this time it’s buses and registers. Here again is the architecture I’ll be building against (from the Harry Porter Relay Computer):

Buses are simply a set of wires that connect up the various parts of a computer. As each wire can carry 1 bit it therefore takes 8 wires to carry 8 bits. In this architecture the data bus is 8 bits wide and the address bus (which I’ll go in to further in the next post on the memory) is 16 bits wide. You can only have a single value on a bus at the same time so any part of the computer that needs to talk to another part has to wait its turn for the bus to become free. It’s worth noting though that because the data and address bus are physically separate you can have different values on each without problem. In the diagram above the data bus is shown as a thick line on the left and the address bus is the thick line on the right. In real life, of course, there would be as many wires as there are bits but to simplify the diagram they’re shown as a single thick line.

Registers hold a binary value for use when performing calculations and moving data around. They are typically very fast (compared to storing things in memory) but there’s a fixed number of them. Most registers are available for general use and can be read from as well as written to but some special purpose registers are read only or write only. Looking at the system architecture diagram above the registers are shown as rectangles down the middle of the diagram. In this architecture there are eight ‘general purpose’ registers (A, B, C, D, M1, M2, X and Y) which can hold 8 bits each and can be set from or loaded onto the data bus (shown by the double headed arrow to the data bus). Four of the ‘general purpose’ registers (M1, M2, X and Y) combine together in pairs to act as a single 16-bit register (M and XY). The XY register can be set from or loaded onto the address bus while the M register can only be loaded onto the address bus (not set from it). Although these are all ‘general purpose’ registers and can be used for any purpose by the computer programmer some have a special meaning in certain situations: B and C feed the Arithmetic Logic Unit (ALU - I’ll cover this in a later post); M1 and M2 are typically used to set the current memory address via M (again, I’ll talk about memory later).