2.4 CONCEPT OF INSTRUCTION
"The entire set of
instructions that can be
executed by the processor
directly, through the logic
in hardware, form the
instruction set of the
processor. An instruction
tells the processor what
task is to be performed and
what micro-operations need
to be completed to perform
the task"
The CPU is a semiconductor integrated circuit chip consisting of a large number of
transistors. In personal computers, the CPU is also referred by the term Microprocessor.
Every CPU is capable of performing certain instructions (known as machine instruction).
Modern CPUs have the logic built in to perform 400-550 machine instructions. The
machine instructions that a CPU can execute demonstrates its capability. Every processor
is capable of performing certain operations. An instruction refers to an operation that can
be performed by the processor directly. The entire set of instructions that can be executed
by the processor directly, through the logic in hardware, form the instruction set of the
processor. An instruction tells the processor what task is to be performed and what microoperations need to be completed to perform the task. Every instruction execution requires
execution of a set of arithmetic and logical operations (micro-operations). The size and
format of the instruction varies with different processors.
"The opcode specifies the
operation to be
performed and the
operands provide the data
on which the operation is
to be performed "
Every instruction is comprised of two parts: opcode and operands. The opcode specifies
the operation to be performed and the operands provide the data on which the operation is
to be performed. To understand the concept of instruction more clearly let us assume a
simple hypothetical computer which the capability to perform eight different operations.
Every operation is specified by a unique opcode as given in Table 2.2.
Let us further assume that our computer can process only two-digit decimal numbers, i.e.
there can be a maximum of two operands each of a maximum of two digits. Thus the
computer can add or subtract numbers containing a maximum of two digits. A simple
instruction can thus be written as a combination of an opcode and its associated operands.
Opcode is denoted by its unique binary code. The operands are decimal digits and
therefore also need to be converted to binary code system to pass them as operands to the
processor. Suppose BCD code is used to represent the operands. Then following are
examples of some valid instructions on the processor:
Instruction Effect
0001001001100100101 93 + 25
10110000101 Complement 85
0110010010100000101 25 / 05
In the first instruction, the first three bits represent the opcode and the remaining sixteen
bits represent the two operands each a two digit decimal number expressed using BCD
code. The opcode for addition as described in the table is 000 and the BCD codes for
9,3,2 and 5 are 1001, 0011, 0010 and 0101 respectively. Thus the instruction
0001001001100100101 represents 93 + 25. Similarly, in the second instruction, first
three bits represent the opcode and the remaining eight bits specify the operand to
perform the operation. However, this is the case of a very simple hypothetical computer.
Real world processors are much more complex and capable of performing more than 500
machine instructions. Further they can take their operands in a number ways: directly,
from registers, from memory etc. Moreover, modern processors can perform calculations
on large numbers. Thus an instruction in a modern CPU could easily comprise more than
50 bits.
"The control unit is responsible for overall control and coordination of instruction execution"
Execution of a machine instruction on modern processors involves a complex sequence
of operations with multiple cycles. One instruction cycle typically involves Fetch,
Decode, Execute and Write back cycles. During Fetch cycle the instruction is fetched
from memory. During Decode cycle the instruction is processed by the control unit of the
CPU, which generate the set of micro-operations and timing signals required to execute
the instruction. The micro-operations are then executed during Execute cycle to complete
the instruction and any results generated are then written back to memory during Write
back cycle. An instruction cycle may also involve one or more operand fetch cycles. The
control unit is responsible for overall control and coordination of instruction execution. It
generates the set of micro-operations either through a hard wired logic or with the help of
micro program sequencer. Executing a program therefore involves executing a large
number of machine instructions, where every machine instruction execution requires
executing several micro-operations.
2.5 ELEMENTS OF CPU AND THEIR ROLE
The CPU is a complex IC chip having millions of transistors. As mentioned earlier, a
CPU has three major identifiable parts: Control Unit (CU), Arithmetic & logic Unit
(ALU) and a set of Registers. The CPU chip is interfaced with other components of the
computer through a system bus (printed wires on the mother board) which has three sets of wires forming Control Bus, Data Bus and Address Bus. Figure 2.4 presents the
components of a CPU :
CPU has a set of Registers which is used to store some data temporarily. Register lies above Cache and Main memory in memory hierarchy of the system. The registers in CPU perform two roles:
- User-visible registers: used to store temporary data items and other user accessible information useful for machine or assembly language programmers.
- Control & Status Registers: used by control unit to control and coordinate the operation of the processor.
The Control Unit of
the processor is that
unit which controls and
coordinates the
execution of
instructions by the
processor
The Control Unit of the processor is that unit which controls and coordinates the
execution of instructions by the processor. It is responsible for defining and controlling
the instruction cycle. In essence, it causes things to happen in the processor. It issues
control signals external to the processor to cause data exchange with memory and I/O
modules. It also issues control signals internal to the processor to move data between
registers, to cause the ALU to perform a specified function, and to regulate other internal
operations. It generates timing signals and initiates the Fetch cycle of instruction
execution. When the instruction is fetched, it generates the sequence of micro-operations
which need to be executed in order to execute the instruction. CU also generates timing
signals for executing set of micro-operations. There are three different ways in which CU
can generate these micro-operations: through a hardwired logic, by reading a
programmable Array (PLA) table or by reading a Programmable Read Only Memory
(PROM).x
Notes-The microprogram
control has a control
memory (a PROM
chip) which stores
the sequence of
micro-operations
In hardwired control, the mapping between machine instruction and consequent microoperations to be generated is permanently wired within the processor. It is relatively
faster way although it cannot be modified. In PLA control the sequence of microoperations to be generated for executing an instruction is stored as a PLA table. In Micro
program control, the logic of the control unit is specified by a microprogram.
Microprogram specifies the micro-operations. The microprogram control has a control
memory (a PROM chip) which stores the sequence of micro-operations. As a general rule
processors having smaller instruction set (such as RISC processors) have hard wired
control logic whereas microprogram control is used in processors having larger
instruction set. Most of the modern CISC processors use microprogram control.
The Arithmetic and Logic Unit is that part of the CPU that actually performs arithmetic
and logical operations on data. The CU, CPU registers and memory help in bringing the
data into the ALU and then taking the results back. Figure 2.5 presents the ALU inputs
and outputs.
Data are presented to ALU in registers and the results are also stored in registers.
Accumulator is one such register which is very frequently used during the ALU
operation. ALU has many other registers such as flags and status register, which indicate
information about the operation and its result. ALU has logic implemented to perform
operations like addition, multiplication, division, shifting, complement etc. The
operations are performed on represented numbers, both integer and floating point
numbers.
Modern processors nowadays have two identifiable trends which improve their
performance to a much higher level. These are use of on chip Cache memory and having
more than one processor core on the same IC chip. Cache memory is a fast
semiconductor memory which can be used to temporarily store instructions and data that
are frequently referred by the processor. By having frequently referred instructions and
data available in the processor, the wait cycles introduced due to memory references are
minimized and hence the processor performance improves a lot. Another modern
technique of having more than one processor core on the same IC chip tries to perform
the execution of instructions in parallel and hence the performance of the processor
improves a lot.
👉Check Your Progress 3 इस प्रश्नों का उत्तेर कमेंट में दे |
1) Choose the best alternative:
(a) A machine instruction consists of ……………………
(i) ALU (ii) Operator (iii) Opcode & Operands (iv) CU
(b) Executing an instruction involves execution of several……………….
(i) micro-operations (ii) programs (iii) control signals
(c) ALU is responsible for …………….
(i) generating control signals (ii) microprogram sequencing
(iii) arithmetic & logic
(d) The hardwired control unit is ……………..
(i) permanent, non-modifiable (ii) made of PROM (iii) erasable
(e) CPU has following two kinds of registers……………
(i) user-visible & control (ii) program counter & flags (iii) ALU & CU
2) Briefly explain the sub cycles involved in execution of a machine instruction.
…………………………………………………………………………………………
…………………………………………………………………………………………
………………………………………………………………………………………….
3) What are the different ways of designing the control unit of a processor?
…………………………………………………………………………………………
…………………………………………………………………………………………
………………………………………………………………………………………….
4) List the two key technological trends seen in modern processors for improving
performance.
…………………………………………………………………………………………
…………………………………………………………………………………………
………………………………………………………………………………………….
0 Comments