CO - 7th UNIT
CO - 7th UNIT
CO - 7th UNIT
Write the complete control sequence for the instruction : Move (Rs),Rd
• This instruction copies the contents of memory-location pointed to by Rs into Rd. This is a memory read
operation. This requires the following actions
→ fetch the instruction
→ fetch the operand (i.e. the contents of the memory-location pointed by Rs).
→ transfer the data to Rd.
• The control-sequence is written as follows
1) PCout, MARin, Read, Select4, Add, Zin
2) Zout, PCin, Yin, WMFC
3) MDRout, IRin
4) Rs, MARin, Read
5) MDRinE, WMFC
6) MDRout, Rd, End
BRANCHING INSTRUCTIONS
• Control sequence for an unconditional branch instruction is as follows:
1) PCout, MARin, Read, Select4, Add, Zin
2) Zout, PCin, Yin, WMFC
3) MDRout, IRin
4) Offset-field-of-IRout, Add, Zin
5) Zout, PCin, End
• The processing starts, as usual, the fetch phase ends in step3.
• In step 4, the offset-value is extracted from IR by instruction-decoding circuit.
• Since the updated value of PC is already available in register Y, the offset X is gated onto the bus, and an
addition operation is performed.
• In step 5, the result, which is the branch-address, is loaded into the PC.
• The offset X used in a branch instruction is usually the difference between the branch target-address and the
address immediately following the branch instruction. (For example, if the branch instruction is at location 1000
and branch target-address is 1200, then the value of X must be 196, since the PC will be containing the address
1004 after fetching the instruction at location 1000).
• In case of conditional branch, we need to check the status of the condition-codes before loading a new value into
the PC.
e.g.: Offset-field-of-IRout, Add, Zin, If N=0 then End
If N=0, processor returns to step 1 immediately after step 4.
If N=1, step 5 is performed to load a new value into PC.
Note:
To execute instructions, the processor must have some means of generating the control signals needed in the
proper sequence. There are two approaches for this purpose:
1) Hardwired control and 2) Microprogrammed control.
Microinstruction
• The microprogram requires several branch microinstructions which perform no useful operation. Thus, they
detract from the operating speed of the computer.
• Solution: Include an address-field as a part of every microinstruction to indicate the location of the next
microinstruction to be fetched. (This means every microinstruction becomes a branch microinstruction).
• The flexibility of this approach comes at the expense of additional bits for the address-field.
• Advantage: Separate branch microinstructions are virtually eliminated. There are few limitations in assigning
addresses to microinstructions. There is no need for a counter to keep track of sequential addresse. Hence, the
μPC is replaced with a μAR (Microinstruction Address Register). {which is loaded from the next-address field in
each microinstruction}.
• The next-address bits are fed through the OR gate to the μAR, so that the address can be modified on the basis
of the data in the IR, external inputs and condition-codes.
• The decoding circuits generate the starting-address of a given microroutine on the basis of the opcode in the IR.