Explain the concept of microprogram sequencing and how it enables the execution of complex instructions through a sequence of microinstructions?
Explain the concept of microprogram sequencing and how it enables the execution of complex instructions through a sequence of microinstructions?
Quick answer
Microprogram sequencing means choosing the order in which microinstructions are read from the control memory. Each machine instruction is carried out by a small program of microinstructions, called a microroutine. The sequencer must start the right routine, move through it, and then go back to fetch the next instruction.
Structure
The control address register (CAR) holds the address of the microinstruction to be read. A multiplexer feeds CAR from different sources. A branch logic unit tests a status bit. An incrementer gives CAR plus one. A mapping logic converts an opcode into a starting address. A subroutine register (SBR) keeps the return address.
How the next address is found
- Sequential flow: CAR is incremented to give the next microinstruction.
- Branch: if the condition in the microinstruction is true, its address field is loaded in CAR, else CAR is incremented.
- Mapping: at the end of the fetch routine, the opcode in IR is mapped to the first address of the routine for that instruction.
- Call and return: a micro-subroutine call saves CAR plus one in SBR and jumps. A return loads SBR back in CAR.
How a complex instruction executes
Take a complex instruction such as multiply. First, the fetch microroutine reads the instruction into IR. Then the mapping logic turns the opcode into the starting address of the multiply routine. The first microinstruction is read, and its bits are sent as control signals. The next address is chosen by the sequencer. The routine may contain a loop, which repeats shift and add micro operations, with a branch microinstruction to test a counter. When the loop ends, the last microinstruction jumps back to the fetch routine.
So the complex instruction is built from many simple micro-steps: load registers, add, shift, test, and branch. No special hardware is needed for it. Only the sequence of microinstructions in the control memory is written for it.
Importance. With a good sequencer, complex instructions can be added or changed by changing only the microprogram. Common steps, such as the operand address calculation, are written once as a micro-subroutine, and shared. That is why microprogram sequencing makes execution of complex instructions possible in a clean way.
Short on time? The 1, 5 and 10 mark versions of this answer, flashcards and practice sets come with a program pass.
Up nextDesign and explain the fundamental concept of computer memory hierarchy?