UNIT-3
-processor : generally called as the central processing unit (CPU) or micro functional
unit (MPU)
-program :is a set of instructions performing a meaningful task .
-instruction : is command to the processor and is executed by carrying out a sequence
of sub operations.
- A typical processing unit consists of : PC,IR,ID,MAR,MDR .
-Fundamental Concepts:
● The processor fetches one instruction at a time and performs the operation specified.
● Instructions are fetched from successive memory locations until a branch or a jump
instruction is encountered.
● The processor keeps track of the address of the memory location containing the next
instruction to be fetched using Program Counter(PC).
-Executing an Instruction:
-to execute this instruction requires the following action:
1-fetch the instruction . 2- fetch the first operand . 3- perform the addition .4-load the
result.
-to execute an instruction the processor has to performing the following three
steps:
● Fetch the contents of the memory location pointed to by the PC.
● The contents of this location are loaded into the IR (fetch phase).○ IR ← [[PC]]
● Assuming that the memory is byte addressable, increment the contents of the PC by 4 (fetch
phase).○ PC ← [PC] + 4
● Carry out the actions specified by the instruction in the IR (execution phase).
-Branch Instructions: A branch instruction replaces the contents of PC with the branch
target
address, which is usually obtained by adding an offset X given in the branch instruction.
-design the control unit : the control unit is classified into two categories:
1-hardwired control . 2- microprogrammed control .
-Hardwired control :A hardwired control is a mechanism of producing control
signals using Finite State Machines (FSM) appropriately. It is designed as a sequential
logic circuit. The final circuit is constructed by physically connecting the components
such as gates, flip flops, and drums. Hence, it is named a hardwired controller.
advantages :
1. Fast ( because the control signals are generated by using combinational circuit
(C.C)
2. Performance is high compared with M.C.U .
Disadvantages : - 1- Control signal required by the cpu is more complex .2-
Modifications are very difficult .3- Difficult to correct mistakes or add new features in
existing.
- Microprogrammed control:It uses a sequence of micro instructions in the Micro-
programming
language .
Features : -
1. It acts as a midway between hardware and software .
2. It generates a set of control signals
3. It is easy to design ,test and implement
4. It is flexible to modify.
-types of Microprogrammed control :
1-horizontal Microprogrammed control unit : the control signals are represented in
the decoded binary format that is bit CS .
2- vertical Microprogrammed control unit : the control signals are represented in the
encoded binary format .
-Control signal : -It is a group of bits used to select a path in a multiplexer or decoder
or air .
-Control variable : - Binary variables specify u operation .
-Control word : -A string of i’s and o’s represent control variables .
-Control memory :-Memory contains contra words .
-Control address register : - Specifies address of next u instruction .
-Control buffer register : -Send signal to the sequence logic and whatever the data
sends to internal and external bits in the form of i’s and o’s .
Pipelining :
- It is a process of communication of instruction from the process through a pipeline
- Pipelining is a technique where multiple instructions are overlapped during
an execution pipeline divided into stages and these stages are connected
with one another to form a pipe-like structure
-Pipeline processor : consisting of a sequential ,linear list of segments .
-Types of Pipeline :
1-arithmetic Pipeline : arithmetic Pipeline are usually found in most of the
computers ,they are used for floating point operation multiplication of fixed pintes
numbers.
2-instruction Pipeline : reads instructions from the memory while previous instructions
are being executed in other segments of the pipeline .
- pipeline conflicts : 1- time variations . 2- data hazard .3- branching . 4- interrupts .5-
data dependency .
-advantages of pipelining :
1-the cycle time of the processor is reduced.
2-it increases the throughput of the system .
3-it makes the system reliable.
-disadvantages of pipelining : -
- The design of pipelined processors is complex and costly to manufacture .
- The instructure latency is more . (latency - delay).
-pipelining hazard : 1- data hazard . 2- structural hazard .3-control hazard or
instruction hazards
.
-Data hazards: -
- A data hazard is a situation in which a pipeline is stalled because the data
to be operated on one delayed for some reason
Types of data hazard :
1- read after write (RAW) : it occurs when value produced by an instruction is required
by a subsequent instruction .
2-write after read (WAR): it occurs when the output register of an instruction is used
right after reading by the previous instruction .
3- write after write (WAW):it occurs when the output register of an instruction is used for
write after written by previous instruction
4-read after read (RAR)::it occurs when the instructions are both read from the same
register.
-handling data hazard : 1-forwarding . 2-code reordering. 3- stall insertion.
-control hazard or instruction hazard : control hazards are called branch hazards and
caused by branch instruction .