Module 5
Module 5
Fundamental Concepts
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.
Processor keeps track of the address of the memory location containing the next instruction to be fetched
using Program Counter (PC).
Instruction Register (IR): When an instruction is fetched, it is placed in the instruction register
The sequence of operations involved in processing an instruction constitutes an instruction cycle, which
can be subdivided into 3 major phases:
o Fetch cycle
o Decode cycle
o Execute cycle
Executing an Instruction
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).
The registers Y, Z and Temp are used only by the processor unit for temporary storage during the
execution of some instructions.
These registers are never used for storing data generated by one instruction for later use by another
instruction.
The programmer cannot access these registers.
The IR and the instruction decoder are integral parts of the control circuitry in the processing unit.
All other registers and the ALU are used for storing and manipulating data.
The data registers, ALU and the interconnecting bus is referred to as data path.
Register R0 through R(n-1) are the processor registers.
The number and use of these register vary considerably from processor to processor.
These registers include general purpose registers and special purpose registers such as stack pointer,
index registers and pointers.
These are 2 options provided for A input of the ALU.
The multiplexer (MUX) is used to select one of the two inputs.
It selects either output of Y register or a constant number as an A input for the ALU according to the
status of the select input.
It selects output of Y when select input is 1 (select Y) and it selects a constant number when select input
is 0(select C) as an input A for the multiplier.
The constant number is used to increment the contents of program counter.
For the execution of various instructions processor has to perform one or more of the following basic
operations:
o Transfer a word of data from one processor register to another or to the ALU.
o Perform the arithmetic or logic operations on the data from the processor registers and store the
result in a processor register.
o Fetch a word of data from specified memory location and load them into a processor register.
o Store a word of data from a processor register into a specified memory location.
REGISTER TRANSFERS
Each register has input and output gating and these gates are controlled by corresponding control signals.
The input and output gates are nothing but the electronic switches which can be controlled by the control signals
. When signal is 1, the switch is ON and when the signal is 0, the switch is OFF.
Example
Suppose we wish to transfer the contents of register R1 to register R4. This can be accomplished as follows
Enable the output of registers R1 by setting R1out to 1. This places the contents of R1 on the processor
bus.
Enable the input of register R4 by setting R4out to 1. This loads data from the processor bus into register
R4.
All operations and data transfers within the processor take place within time periods defined by the processor
clock.
The control signals that govern a particular transfer are asserted at the start of the clock cycle.
Move (R1), R2
MAR← [R1]
Start a Read operation on the memory bus
Wait for the MFC response from the memory
Load MDR from the memory bus
R2← [MDR]
The output of MAR is enabled all the time.
Thus the contents of MAR are always available on the address lines of the memory bus.
When a new address is loaded into MAR, it will appear on the memory bus at the beginning of the next
clock cycle.
A read control signal is activated at the same time MAR is loaded.
This means memory read operations requires three steps, which can be described by the signals being
activated as follows
R1out, MAR in, Read
MDRinE, WMFC
MDRout,R2in.
Single bus only one data word can be transferred over the bus in a clock cycle.
This increases the steps required to complete the execution of the instruction.
To reduce the number of steps needed to execute instructions, most commercial process provide multiple internal paths
that enable several transfer to take place in parallel.
3 buses are used to connect registers and the ALU of the processor.
All general purpose registers are shown by a single block called register file.
There are 3 ports, one input port and two output ports.
So it is possible to access data of three register in one clock cycle, the value can be loaded in one
register from bus C and data from two register can be accessed to bus A and bus B.
Buses A and B are used to transfer the source operands to the A and B inputs of the ALU.
After performing arithmetic or logic operation result is transferred to the destination operand over bus C.
To increment the contents of PC after execution of each instruction to fetch the next instruction, separate
unit is provided. This unit is known as incrementer.
Incrementer increments the contents of PC accordingly to the length of the instruction so that it can
point to next instruction in the sequence.
The incrementer eliminates the need
Let us consider the execution of instruction, Add R1. R2, R3
This instruction adds the contents of registers R2 and the contents of register R1and stores the result in
R1.
With 3 bus organization control steps required for execution of instruction Add R1,R2, R3 are as
follows:
1. PCout, MARin
2. MARout, MDRinM, Read
3. MDRoutP, IRin
4. R2out, R3out, Add, R1in
Step 1: The contents of PC are transferred to MAR through bus B.
Step 2: The instruction code from the addressed memory location is read into MDR.
Step 3: The instruction code is transferred from MDR to IR register. At the beginning of step 4, the instruction
decoder interprets the contents of the IR. This enables the control circuitry to activate the control signals for step
4, which constitute the execution phase.
Step 4: two operands from register R2 and register R3 are made available at A and B inputs of ALU through bus A
and bus B.
These two inputs are added by activation of Add signal and result is stored in R1 through bus C