Addressing Sequencing in Computer Organization
The control memory is used to store the microinstructions in groups. Here each group is used to specify a routine. The control memory of each computer has the instructions which contain their micro-programs routine. These micro-programs are used to generate the micro-operations that will be used to execute the instructions. Suppose the address sequencing of control memory is controlled by the hardware. In that case, that hardware must be capable to branch from one routine to another routine and also able to apply sequencing of microinstructions within a routine. When we try to execute a single instruction of computer, the control must undergo the following steps:
We are able to transform the bits of instruction code into an address with the help of control memory where routine is located. This process can be called the mapping process. The control memory required the capabilities of address sequencing, which is described as follows:
In the above diagram, we can see a block diagram of a control memory and associative hardware, which is required for selecting the address of next microinstruction. The microinstruction is used to contain a set of bits in the control memory. With the help of some bits, we are able to start the micro-operations in a computer register. The remaining bits of microinstruction are used to specify the method by which we are able to obtain the next address.
In this diagram, we can also see that the control address register are able to recover their address with the help of four different directions. The CAR is incremented with the help of incrementer and then chooses the next instruction. The branching address will be determined in the multiple fields of microinstruction so that they can provide results in branching.
If there are status bits of microinstruction and we want to apply conditions on them, in this case, we can use conditional branching. An external address can be shared with the help of a mapping logic circuit. The return address will be saved by a special register. This saved address will be helpful when the micro-program requires returning from the subroutine. At that time, it requires the value from the unique register.
In the above diagram, the branch logic is used to provide the decision-making capabilities in the control unit. There are special bits in the system which is described by the status conditions. These bits are used to provide the parameter information such as mode bits, the sign bit, carry-out, and input or output status.
If these status bits come together with the microinstruction field, they are able to control the decision of a conditional branch, which is generated in the branch logic. Here the microinstruction field is going to specify a branch address. The multiplexer is used to implement the branch logic hardware. If the condition is met, it will be branch to the initial address. Otherwise, it will increment the address register.
If we load the branch address into the control address register from the control memory, we are able to implement the unconditional branch microinstruction. If the condition is true, it will go to the branch, which is referred to as the address from the next address field of the current microinstruction. Otherwise, it will fall through. There are various types of conditions that need to be tested: Z(zero), C(carry), O(overflow), N(negative), etc.
Mapping of Instructions
In the control memory, if the microinstruction specifies a branch to the first work, in this case, there will be a special type of branch. Here an instruction contains their micro-program routine. For this special branch, the status bits will be the bits in the operation code, which is the part of instruction.
The above image shows a type of easy mapping process which are going to convert the 4-bit operation code into the 7-bit address for control memory. In the mapping process, the 0 will be placed in the most significant bit of address. After that, the four operation code bits will be transferred. Lastly, the two least significant bits of CAR will be cleared.
With the help of this process, a micro-program will be provided to each computer instruction. The micro-program contains the capacity of four microinstructions. If less than four microinstructions are used by the routine, the location of unused memory can be used for other routines. If more than four microinstructions are used by the routine, it will use the addresses 1000000 through 1111111.
This concept can be extended to a more general mapping rule with the help of PLD (Programmable logic device) or ROM (Read-only memory).
The above image shows the mapping of address of microinstruction from the OP-code of an instruction. In the execution program, this microinstruction is the starting microinstruction.
Subroutines can be referred to as programs that are used to accomplish a particular task by the other routines. With the help of employing subroutines, we can save the microinstructions. These subroutines use the common sections of microcode, such as effective address computation. The main routine is able to get the address for the return with the help of a subroutine register. In another word, we can say that it becomes a source to transfer the address to a main routine. The register file is used to store the addresses for subroutines. These register files can be structured in a way that the register will be organized in the 'Last in first out' (LIFO) stack.