Coa Unit 3 Notes
Coa Unit 3 Notes
(AUTONOMOUS)
ACCREDITED BY NAAC & NBA (CSE, IT, ECE, EEE&ME)
APPROVED BY AICTE, NEW DELHI AND AFFILIATED TO JNTUK, KAKINADA
L.B.REDDY NAGAR, MYLAVARAM-521230, KRISHNA DIST., ANDHRA PRADESH, INDIA
MICRO-OPERATIONS
✓ Each instruction cycle is made up of a number of smaller units. One subdivision that we
found is fetch, indirect, execute, and interrupt, with only fetch and execute cycles
always occurring.
✓ each of the smaller cycles involves a series of steps, each of which involves the processor
registers. We will refer to these steps as micro-operations.
✓ The prefix micro refers to the fact that each step is very simple and accomplishes very
little. Micro-operations are the functional, or atomic, operations of a processor.
At the beginning of the fetch cycle, the address of the next instruction to be executed
is in the program counter (PC)
4 Step-1: Move that address to the memory address register (MAR) because this is the only
register connected to the address lines of the system bus.
Step-2: The desired address (in the MAR) is placed on the address bus, the control unit issues
a READ command on the control bus, and the result appears on the data bus and is copied
into the memory buffer register (MBR).
Step-3: Move the contents of the MBR to the instruction register (IR).
Thus, the simple fetch cycle actually consists of three steps and four
microoperations.
t1: MAR ← (PC)
t2: MBR ← Memory
PC ← (PC) + I
t3: IR ← (MBR)
Department of ECE
04-02-2021
LAKIREDDY BALI REDDY COLLEGE OF ENGINEERING
(AUTONOMOUS)
ACCREDITED BY NAAC & NBA (CSE, IT, ECE, EEE&ME)
APPROVED BY AICTE, NEW DELHI AND AFFILIATED TO JNTUK, KAKINADA
L.B.REDDY NAGAR, MYLAVARAM-521230, KRISHNA DIST., ANDHRA PRADESH, INDIA
04-02-2021
Department of ECE
LAKIREDDY BALI REDDY COLLEGE OF ENGINEERING
(AUTONOMOUS)
ACCREDITED BY NAAC & NBA (CSE, IT, ECE, EEE&ME)
APPROVED BY AICTE, NEW DELHI AND AFFILIATED TO JNTUK, KAKINADA
L.B.REDDY NAGAR, MYLAVARAM-521230, KRISHNA DIST., ANDHRA PRADESH, INDIA
11
12 Control signals within the processor: These are two types: those that cause data to be moved from
one register to another, and those that activate specific ALU functions.
Control signals to control bus: These are also of two types: control signals to memory, and control
signals to the I/O modules.
Three types of control signals are used: those that activate an ALU function, those that activate
a data path, and those that are signals on the external system bus or other external interface. All
of these signals are ultimately applied directly as binary inputs to individual logic gates.
13
The control unit receives inputs from the clock, the instruction register, and flags. With each
clock cycle, the control unit reads all of its inputs and emits a set of control signals. Control
signals go to three separate destinations:
Data paths: The control unit controls the internal flow of data. For example, on instruction fetch,
the contents of the memory buffer register are transferred to the instruction register. For each
path to be controlled, there is a switch. A control signal from the control unit temporarily opens
the gate to let data pass.
ALU: The control unit controls the operation of the ALU by a set of control signals. These signals
activate various logic circuits and gates within the ALU.
System bus: The control unit sends control signals out onto the control lines of the system bus
(e.g., memory READ).
The control unit must maintain knowledge of where it is in the instruction cycle. Using this
14 knowledge, and by reading all of its inputs, the control unit emits a sequence of control signals
that causes micro-operations to occur.
15
16
HARDWIRED IMPLEMENTATION
In a hardwired implementation, the control unit is essentially a state machine circuit. Its input logic
signals are transformed into a set of output logic signals, which are the control signals.
Control Unit Inputs
The control unit makes use of the opcode and will perform different actions for different instructions.
To simplify the control unit logic, there should be a unique logic input for each opcode. This function
can be performed by a decoder, which takes an encoded input and produces a single output. In
general, a decoder will have n binary inputs and 2n binary outputs. Each of the 2n different input
patterns will activate a single unique output.
The clock portion of the control unit issues a repetitive sequence of pulses. This is useful for measuring
the duration of micro-operations. The control unit emits different control signals at different time units
17
within a single instruction cycle. Thus, we would like a counter as input to the control unit, with a
different control signal being used for T1 and T2 and so forth. At the end of an instruction cycle, the
control unit must feed back to the counter to reinitialize it at T1.
04-02-2021
Department of ECE
LAKIREDDY BALI REDDY COLLEGE OF ENGINEERING
(AUTONOMOUS)
ACCREDITED BY NAAC & NBA (CSE, IT, ECE, EEE&ME)
APPROVED BY AICTE, NEW DELHI AND AFFILIATED TO JNTUK, KAKINADA
L.B.REDDY NAGAR, MYLAVARAM-521230, KRISHNA DIST., ANDHRA PRADESH, INDIA
18
04-02-2021
Department of ECE
LAKIREDDY BALI REDDY COLLEGE OF ENGINEERING
(AUTONOMOUS)
ACCREDITED BY NAAC & NBA (CSE, IT, ECE, EEE&ME)
APPROVED BY AICTE, NEW DELHI AND AFFILIATED TO JNTUK, KAKINADA
L.B.REDDY NAGAR, MYLAVARAM-521230, KRISHNA DIST., ANDHRA PRADESH, INDIA
19 That is, the control signal C5 will be asserted during the second time unit of both the
fetch and indirect cycles.
This expression is not complete.C5 is also needed during the execute cycle. Let us
assume that there are only three instructions that read from memory: LDA,ADD, and
AND. Now we can define C5 as
Microprogrammed Control
Control signals are generated by a program similar to machine language programs.
Control Word (CW); microroutine; microinstruction .
A control word (CW) is a word whose indiv idual bits represent the various control signals.
Each of the control steps in the control sequence of an instruction defines a unique
combination of 1s and 0s in the CW. A sequence of CWs corresponding to the control
sequence of a machine instruction constitutes the microroutine for that instruction, and
the individual control words in this microroutine are referred to as microinstructions.
The microroutines for all instructions in the instruction set of a computer are stored in a
special memory called the control store.
The control unit can generate the control signals for any instruction by sequentially reading
20 the CWs of the corresponding microroutine from the control store. To read the control
words sequentially from the control store, a micro-program counter (µPC) is used.
Every time a new instruction is loaded into the IR, the output of the block labeled "starting
address generator" is loaded into the µPC. The µPC is then automatically incremented by
the clock, causing successive microinstructions to be read from the control store. Hence,
the control signals are delivered to various parts of the processor in the correct sequence.
Department of ECE 04-02-2021
LAKIREDDY BALI REDDY COLLEGE OF ENGINEERING
(AUTONOMOUS)
ACCREDITED BY NAAC & NBA (CSE, IT, ECE, EEE&ME)
APPROVED BY AICTE, NEW DELHI AND AFFILIATED TO JNTUK, KAKINADA
L.B.REDDY NAGAR, MYLAVARAM-521230, KRISHNA DIST., ANDHRA PRADESH, INDIA
21
Fig-10: Basic organization of a
microprogrammed control unit.
22
Fig-11: Organization of the control unit to allow conditional
branching in the microprogram.
Microinstructions
✓ A straightforward way to structure microinstructions is to assign one bit position to each
control signal.
✓ However, this is very inefficient.
✓ The length can be reduced: most signals are not needed simultaneously, and many signals
are mutually exclusive.
✓ All mutually exclusive signals are placed in the same group in binary coding.
23
24
Microprogram Sequencing
26
27
04-02-2021
Department of ECE
LAKIREDDY BALI REDDY COLLEGE OF ENGINEERING
(AUTONOMOUS)
ACCREDITED BY NAAC & NBA (CSE, IT, ECE, EEE&ME)
APPROVED BY AICTE, NEW DELHI AND AFFILIATED TO JNTUK, KAKINADA
L.B.REDDY NAGAR, MYLAVARAM-521230, KRISHNA DIST., ANDHRA PRADESH, INDIA
28
29
Fig-14:Microinstruction sequencing
organization
Department of ECE 04-02-2021
LAKIREDDY BALI REDDY COLLEGE OF ENGINEERING
(AUTONOMOUS)
ACCREDITED BY NAAC & NBA (CSE, IT, ECE, EEE&ME)
APPROVED BY AICTE, NEW DELHI AND AFFILIATED TO JNTUK, KAKINADA
L.B.REDDY NAGAR, MYLAVARAM-521230, KRISHNA DIST., ANDHRA PRADESH, INDIA
30
04-02-2021
Department of ECE
LAKIREDDY BALI REDDY COLLEGE OF ENGINEERING
(AUTONOMOUS)
ACCREDITED BY NAAC & NBA (CSE, IT, ECE, EEE&ME)
APPROVED BY AICTE, NEW DELHI AND AFFILIATED TO JNTUK, KAKINADA
L.B.REDDY NAGAR, MYLAVARAM-521230, KRISHNA DIST., ANDHRA PRADESH, INDIA
31
Fig-16:Implementation of microroutine
04-02-2021
Department of ECE
LAKIREDDY BALI REDDY COLLEGE OF ENGINEERING
(AUTONOMOUS)
ACCREDITED BY NAAC & NBA (CSE, IT, ECE, EEE&ME)
APPROVED BY AICTE, NEW DELHI AND AFFILIATED TO JNTUK, KAKINADA
L.B.REDDY NAGAR, MYLAVARAM-521230, KRISHNA DIST., ANDHRA PRADESH, INDIA
Prefetching Microinstructions
One drawback of microprogrammed control is that it leads to a slower operating speed because of
the time it takes to fetch microinstructions from the control store. Faster operation is achieved if the
next microinstruction is prefetched while the current one is being executed. In this way, the execution
time can be overlapped with the fetch time.
Prefetching m icroinstructions presents some organizational difficulties. Sometimes the status flags and
the results of the currently executed microinstruction are needed to determ ine the address of the
next microinstruction. Thus, straightforward prefetching occasionally prefetches a wrong
microinstruction. In these cases, the fetch must be repeated with the correct address, which requires
more complex hardware. However, the disadvantages are minor, and the prefetching technique is
often used.
32
04-02-2021
Department of ECE