basic processing unit own notes
basic processing unit own notes
INTRODUCTION
Instruction Set Processor
SOME FUNDAMENTAL CONCEPTS:-
Q) How to execute and process a set of instruction given?
To execute a program, the instruction is first fetched one at a time and performs the operations
specified.
Instructions are fetched from successive memory locations until the jump or branch instruction is
occurred.
Processor keeps track of the memory location containing the next instruction that is to be fetched
using the program counter.
After fetching an instruction, the contents of the program counter are updated to point the next
instruction of the sequence.
A branch instruction may load different value to the program counter.
Another key register in the processor is the instruction register.
Q) What are the steps the processor has to perform in order to execute an instruction?
Fetch the contents of memory location pointed by the program counter. The contents of this location
are interpreted as instruction that is to be executed. They are loaded to IR.
IR <- [PC]
Assuming that the memory is byte addressable, increment the contents of the program counter by 4.
PC <- [PC] + 4
Carrying out the instructions specified by the instruction register.
Q) Draw a single bus organisation of the Datapath inside a inside a processor?
Q) Add the contents of register R1 to those of register R2 and store in the result in register R3?
R1 out, Yin
R2 out, Select Y, Add, Zin
Zout, R3in
Q) Explain how can we execute these programs?
The programs or instructions that are given in certain steps are activated respectively for the
duration of the clock cycle corresponding to the next step. All other instructions other than the
instructions mentioned in the step are inactive.
Hence step is R1out, Yin therefore , R1out = Yin = 1 that causes the contents of this register to be
transferred over the data bus.
The contents of R2 are gated onto the bus and hence to the input B.
The function performed by ALU depends on the signals applied to its control lines.
In this case, Add line is set to 1, causing the output of the ALU to be the sum of two numbers at the
inputs A & B.
The sum is loaded into register Z because its input control signal is activated.
The contents of register Z are transferred to the destination register R3.
This last transfer cannot be carried out during step 2 because only one register output can be
connected to the bus during any clock cycle.
Q) What is the function of ALU?
ALU can perform eight different operations, three control signals would suffice to specify the required
operation.
FETCHING A WORD FROM MEMORY
Q) How to fetch a word from memory?
To fetch a word or an information from the memory, first the processor has to specify the address of
the memory location where the information is stored and request a read operation.
This applies whether the information to be fetched represents an instruction in a program or an
operand specified by an instruction.
MDR has four control signals: MDRin and MDR out is used for the internal bus
MDRinE and MDRoutE are used for the external bus.
A three input multiplexer can be used with the memory bus data line that is connected to the third
input.
This input is selected when MDRinE = 1.
A second tri-state gate is controlled by MDRoutE can be used to connect the output of the flip-flop to
the memory bus.
EXTRA POINTS
During the Read & Write operations, the timing of internal processor operations must be co ordinated
with the response of the addressed device on the memory bus.
The processor completes one data transfer in one clock cycle.
The speed of operation of the addressed device varies with the device.
Modern processor includes a cache memory on the same chip as the processor.
A cache will respond to a memory read request in one clock cycle.
When a cache miss occurs the request is forwarded in to the main memory which introduces a delay of
several clock cycles.
A read or write request may also be intended for a register in a memory-mapped I/O device.
Such I/O registers are not cached, so their accesses always take a number of clock cycles.
Whatever we request whether it is a read or write operation, the data will be inside MDR and from here
the data will be transferred to the corresponding devices.
Suppose we have a data A which contains data 10, it will first go to MDR and then to register R1 and to
do this once we read the data and store the data in MDR and to complete the total process a control
signal will be used and the function is known as Memory- Function- Completed (MFC) control.
If MFC = 1 then we get to know that the specific work has been completed and then the processor will
transfer the data from MDR to other location.
Q) What are the actions needed to execute the instruction Move(R1), R2:
The actions needed to execute the instruction Move(R1), (R2):-
Suppose we have the data 10 which is stored in 100th location of register R1. Therefore according to
the first step the MAR operation will be performed which will read the data from the register.
MAR <- [R1]
Start the Read operation on the memory bus.
Suppose the data given is stored in the Instruction Register IR. The data from the instruction register
goes to the instruction decoder or control logic as output and the decoder will tell what operation to
perform.
So at first we have to take the data from Program Counter (PC) to MARin and we know that MARin is
COMPUTER ORGANISATION AND ARCHITECTURE Page 5
So at first we have to take the data from Program Counter (PC) to MARin and we know that MARin is
used to read the instruction or operand in an operation. Then we have to go to program counter to
update it as pc holds the address of next instruction. The data comes in MDR and to perform any
arithmetic and logic operations, we have to go to ALU.
Execution Of Complete Instruction In Computer Architecture- Hindi
Three ports
There are two outputs allowing the contents of two different registers to be accessed simultaneously and
their contents placed on buses A and B. The third port allows the data on bus C to be loaded into a third
register during the same clock cycle.
Buses A & B :- transfer source operands to the A & B inputs of the ALU, where the arithmetic and logic
operation maybe performed. The result is transferred to destination through the bus C.
Using the incrementor eliminated the need to add 4 to the PC using the main ALU.
The source for the constant 4 can be useful for the other address such as the memory address in
LoadMultiple and StoreMultiple instructions.
The decoder/ encoder block in the figure is a combinational circuit that generated the
required control outputs, depending on the state of all its inputs.
The step decoder provides a separate signal line of each step, or time slot, in the
control sequence.
Similarly the output of the instruction decoder consists of a separate line for each
machine instruction.
COMPUTER ORGANISATION AND ARCHITECTURE Page 7
machine instruction.
For any instruction loaded in the IR, one of the output lines INS1 through INSm is set
to 1 and all other lines are set to 0.
Zin = T1 + T6.ADD + T4.BR+…..
End = T7.ADD + T5.BR+ (T5.N + T4.N bar).BRN+….
A single cache stores both instructions and data. The processor is connected to the
system bus and hence to the rest of the computer by means of a bus interface.
MICROPROGRAMMED CONTROL
Q) For the given the control sequence for execution of the instruction Add(R3),R1 then make the
microinstruction of the same?
PCout, MARin, Read, Select4, Add, Zin
Zout, Pcin, Yin, WMFC
MDRout, Irin
R3out, MARin, Read
R1out, Yin, WMFC
MRDout, Select Y, Add, Zin
Zout, R1in, End
The figure explains the basic organization of a micro programmed control unit.
Q) Mention the micro routine for the branch instruction Branch < 0?
Q) Draw the flowchart for the organization of the control unit to allow conditional branching in the
micro program?
In the control unit the micro program counter is incremented every time a new micro instruction is
fetched from the microprogram except in the following situations:-
When a new instruction is loaded in IR, the micro program counter is loaded with the starting address
COMPUTER ORGANISATION AND ARCHITECTURE Page 10
When a new instruction is loaded in IR, the micro program counter is loaded with the starting address
of the micro routine for that instruction.
When a branch instruction is encountered and the branch condition is satisfied, the micro program
counter is loaded with the branch address.
When an End micro instruction is encountered, the micro program counter is loaded with the address
of the first control word in the micro routine for the instruction fetch cycle.
MICRO INSTRUCTIONS: