Co Unit2 Part2
Co Unit2 Part2
Co Unit2 Part2
HARDWIRED CONTROL
Hardwired control is a method of control unit design (Figure). The control-signals are
generated by using logic circuits such as gates, flip-flops, decoders etc. Decoder / Encoder
Block is a combinational-circuit that generates required control-outputs depending on state of
all its inputs. Instruction decoder decodes the instruction loaded in the IR. If IR is an 8 bit
register, then instruction decoder generates 28(256 lines); one for each instruction. It consists
of a separate output-lines INS1 through INSm for each machine instruction. According to code
in the IR, one of the output-lines INS1 through INSm is set to 1, and all other lines are set to 0.
Step-Decoder provides a separate signal line for each step in the control sequence. Encoder
gets the input from instruction decoder, step decoder, external inputs and condition codes. It
uses all these inputs to generate individual control-signals: Yin, PCout, Add, End and so on.
For example (Figure 7.12), Zin=T1+T6.ADD+T4.BR; This signal is asserted during time-slot T1
for all instructions during T6 for an Add instruction. During T4 for unconditional branch
instruction, when RUN=1, counter is incremented by 1 at the end of every clock cycle. When
RUN=0, counter stops counting. After execution of each instruction, end signal is generated.
End signal resets step counter. Sequence of operations carried out by this machine is
determined by wiring of logic circuits, hence
the name “hardwired”.
Advantage: Can operate at high speed.
Disadvantages: 1) Since no. of instructions/control-lines is often in hundreds, the complexity
of control unit is very high.
2) It is costly and difficult to design.
3) The control unit is inflexible because it is difficult to change the design.
HARDWIRED CONTROL VS MICROPROGRAMMED CONTROL
Attribute Hardwired Control Microprogrammed Control
Micro programmed control is a
Hardwired control is a control
control mechanism to generate
mechanism to generate control-
control-signals by using a memory
Definition signals by using gates, flip- flops,
called control store (CS), which
decoders, and other
contains the control-
digital circuits.
signals.
Speed Fast Slow
Control functions Implemented in hardware. Implemented in software.
Not flexible to accommodate new More flexible, to accommodate new
Flexibility system specifications or new system specification or new
instructions. instructions redesign is required.
Ability to handle Easier.
large or complex Difficult.
instruction sets
Ability to support Easy.
Operating systems& Very difficult.
diagnostic features
Design process Complicated. Orderly and systematic.
Applications Mostly RISC microprocessors. Mainframes, some microprocessors.
Instruction set size Usually under 100 instructions. Usually over 100 instructions.
2K to 10K by 20-400
ROM size -
bit microinstructions.
Chip area efficiency Uses least area. Uses more area.
Diagram
MICROPROGRAMMED CONTROL
Microprogramming is a method of control unit design (Figure). Control-signals are
generated by a program similar to machine language programs. Control Word(CW) is a word
whose individual bits represent various control-signals (like Add, PCin). Each of the control-
steps in control sequence of an instruction defines a unique combination of 1s & 0s in CW.
Individual control-words in microroutine are referred to as microinstructions (Figure).
A sequence of CWs corresponding to control-sequence of a machine instruction
constitutes the microroutine. The microroutines for all instructions in the instruction-set of a
computer are stored in a special memory called the Control Store (CS). Control-unit generates
control-signals for any instruction by sequentially reading CWs of corresponding microroutine
from CS. µPC is used to read CWs sequentially from CS. (µPC Microprogram Counter).
Every time new instruction is loaded into IR, o/p of Starting Address Generator is loaded into
µPC. Then, µPC is automatically incremented by clock; causing successive microinstructions
to be read from CS. Hence, control-signals are delivered to various parts of processor in correct
sequence.
Advantages
• It simplifies the design of control unit. Thus it is both, cheaper and less error prone implement.
• Control functions are implemented in software rather than hardware.
• The design process is orderly and systematic.
• More flexible, can be changed to accommodate new system specifications or to correct the
design errors quickly and cheaply.
• Complex function such as floating point arithmetic can be realized efficiently.
Disadvantages
• A microprogrammed control unit is somewhat slower than the hardwired control unit, because
time is required to access the microinstructions from CM.
• The flexibility is achieved at some extra hardware cost due to the control memory and its
access circuitry.
Microinstructions
A simple way to structure microinstructions is to assign one bit position to each
control-signal required in the CPU. There are 42 signals and hence each microinstruction will
have 42 bits.
Drawbacks of microprogrammed control:
1) Assigning individual bits to each control-signal results in long microinstructions because the
number of required signals is usually large.
2) Available bit-space is poorly used because only a few bits are set to 1 in any given
microinstruction.
Solution: Signals can be grouped because
1) Most signals are not needed simultaneously.
2) Many signals are mutually exclusive. E.g. only 1 function of ALU can be activated at a time.
For ex: Gating signals: IN and OUT signals (Figure); Control-signals: Read, Write; ALU
signals: Add, Sub, Mul, Div, Mod.
Grouping control-signals into fields requires a little more hardware because decoding-
circuits must be used to decode bit patterns of each field into individual control-signals.
Advantage: This method results in a smaller control-store (only 20 bits are needed to store the
patterns for the 42 signals)
Microprogram Sequencing
The task of microprogram sequencing is done by microprogram sequencer. Two important
factors must be considered while designing the microprogram sequencer,
1) The size of the microinstruction &
2) The address generation time.
The size of the microinstruction should be minimum so that the size of control memory
required to store microinstructions is also less. This reduces the cost of control memory. With
less address generation time, microinstruction can be executed in less time resulting better
throughout. During execution of a microprogram the address of the next microinstruction to be
executed has 3 sources:
1) Determined by instruction register.
2) Next sequential address &
3) Branch.
Microinstructions can be shared using microinstruction branching.
Disadvantage of microprogrammed branching:
1) Having a separate microroutine for each machine instruction results in a large total number
of microinstructions and a large control-store.
2) Execution time is longer because it takes more time to carry out the required branches.
Consider the instruction Add src,Rdst ;which adds the source-operand to the contents
of Rdst and places the sum in Rdst. Let source-operand can be specified in following addressing
modes
a) Indexed b) Autoincrement c) Autodecrement d) Register indirect & e) Register direct
Each box in the chart corresponds to a microinstruction that controls the transfers and
operations indicated within the box. The microinstruction is located at the address indicated by
the octal number (001,002).
Branch Address Modification Using Bit-Oring
The branch address is determined by ORing particular bit or bits with the current
address of microinstruction. Eg: If the current address is 170 and branch address is 171 then
the branch address can be generated by ORing 01(bit 1), with the current address. Consider the
point labelled in the figure. At this point, it is necessary to choose between direct and indirect
addressing modes. If indirect-mode is specified in the instruction, then the microinstruction in
location 170 is performed to fetch the operand from the memory. If direct-mode is specified,
this fetch must be bypassed by branching immediately to location 171. The most efficient way
to bypass microinstruction 170 is to have bit-ORing of current address 170 & branch address
171.