CONTROL UNIT
UNIT-2
Mohammad Asif Iqbal
Assistant Professor,
Deptt of ECE,
JETGI, Barabanki
“Instruction set architecture is the
structure of a computer that a
machine language programmer
(or a compiler) must understand
to write a correct (timing
independent) program for that
machine” –IBM introducing 360
(1964)
Instructions Definition
An instruction is an order given to a computer
processor by a computer program.
At lowest level, each instruction is a sequence of
0s and 1s that describes a physical operations the
computer has to perform, such as (add);
And depending on the particular instruction type,
the specification of special storage areas called
register.
Elements of a machine
instructionsEach instruction must contain the information required by the processor
for execution.
Operation
fetch
Instruction
operation
decoding
Operand
address
calculation
Operand
fetch
Data
operation
Operand
address
calculation
Operand
store
Instruction
address
calculation
Instruction complete,
fetch next instruction
Multiple
operands
Multiple
results
Continue…
1. Operation code: specifies the operation to be performed(e.g.
add, I/O). The operation is specify by a binary code known as
operation code, or opcode.
2. Source operand reference: The operation may involve one or
more source operands, that is, operands that are input for the
operation
3. Result operand reference: The operation may produce a result.
4. Next instruction reference: This tells the processor where to
fetch the next instruction after the execution of this instruction is
complete.
Types of instructions
Consider a high-level language instruction that could be expressed in a language such
as BASIC or FORTRAN, For example,
X = X + Y
This statement instruct
the computer to add the
value stored in Y to the
value stored in X and put
the result in X. how
might this be
accomplished with
machine instructions?
Lets assume that the variable X & Y corresponds to locations 513 and
514. if we assume a simple set of machine instructions, this operation
could be accomplished with three instructions
1. Load a register with the contents of memory location 513.
2.Add the contents of memory location 514 to the register.
3.Store the contents of the register in memory location 513.
High level
language
Machine
language
Thus the set of Machine instructions must be sufficient
to express any of the instructions from a high level
language
Thus keeping in mind the previous discussion we can
categorize instruction type as follows:
1. Data processing: Arithmetic & logic instructions
2. Data storage: Memory instructions
3. Data movement: I/O instructions
4. Control: Test and branch instructions
Instruction cycles and subcycles (fetch and execute etc)
1
2
3
4
5
6
ALU
+1
Instruction
decoder
Program
counter Memory
Address
Register
Memory Buffer
Register
Current
Instruction
Register
Op-code Operand
Accumulator
Data Bus
Address
Bus
Main Memory
0000 0000 0000 0011
0101 0000 0000 0110
FETCH
MAR ← [PC]
0000 0000 0000 0011
PC ← [PC] + 1
0000 0000 0000 0100
MBR ← memory
content
0101 0000 0000 0110
0101 0000 0000 0110
CIR ← [MBR]
Decode Unit
Opcode operand Instruction
……….. ………..
0101 Address load
………... …………
0000 0000 0110
0100 0000 0110 0101
0100 0000 0110 0101
Register Transfers
Suppose we have to transfer the contents of a register R1
to the register R4.
This can be accomplished as follows
•Enable the output of register R1 by setting R1out to 1.
this places the contents of R1 on the processor bus.
•Enable the input of register R4 by setting R4in to 1. this
loads data from the processor bus into register R4.
R1out
R4in
Register Transfers….
Ri(in) = 0
Ri(in) = 1 Ri(out) = 0
= Off
Ri(out) = 1
= On
Performing an arithmetic or logic operation
Suppose we have to add the contents of
register R1 to those of R2 and store the
result in register R3. Suggest the steps
required.
1. R1out, Yin
2. R2out, Select Y, Add, Zin
3. Zout, R3in
Fetching a word from memory
Continued….
4. Load MDR from the memory bus
3. Wait for the MFC response from the memory
As an example of a read operation, consider the instruction Move
(R1), R2. Following are the steps required to execute this
instruction are:
1. MAR → [R1]
2. Start a Read operation on the memory bus
5. [R2]→MDR
•The response time of each memory access varies (cache miss,
memory-mapped I/O,…).
•To accommodate this, the processor waits until it receives an
indication that the requested operation has been completed
(Memory-Function-Completed, MFC).
Timing
Assume MAR
is always available
on the address lines
of the memory bus.
1Step
Clock
MARin
MAR ← [R1]
Read
2
Will cause the bus interface circuit to send
a read command, MR on the bus
Address
MR
MDRinE
Data
MFC
3
MDRout
3. MDRout, R2in
1. R1out,MARin,
Read
2. MDRinE, WMFC
N.B.- here we
have reduced
the steps, now
these are three
only.
Storing a Word in Memory
DO IT BY YOUR
OWN
Execution of a complete Instruction
REFER TO
SLIDE NO 7.
THANK YOU!

instruction

  • 1.
    CONTROL UNIT UNIT-2 Mohammad AsifIqbal Assistant Professor, Deptt of ECE, JETGI, Barabanki
  • 2.
    “Instruction set architectureis the structure of a computer that a machine language programmer (or a compiler) must understand to write a correct (timing independent) program for that machine” –IBM introducing 360 (1964) Instructions Definition An instruction is an order given to a computer processor by a computer program. At lowest level, each instruction is a sequence of 0s and 1s that describes a physical operations the computer has to perform, such as (add); And depending on the particular instruction type, the specification of special storage areas called register.
  • 3.
    Elements of amachine instructionsEach instruction must contain the information required by the processor for execution. Operation fetch Instruction operation decoding Operand address calculation Operand fetch Data operation Operand address calculation Operand store Instruction address calculation Instruction complete, fetch next instruction Multiple operands Multiple results
  • 4.
    Continue… 1. Operation code:specifies the operation to be performed(e.g. add, I/O). The operation is specify by a binary code known as operation code, or opcode. 2. Source operand reference: The operation may involve one or more source operands, that is, operands that are input for the operation 3. Result operand reference: The operation may produce a result. 4. Next instruction reference: This tells the processor where to fetch the next instruction after the execution of this instruction is complete.
  • 5.
    Types of instructions Considera high-level language instruction that could be expressed in a language such as BASIC or FORTRAN, For example, X = X + Y This statement instruct the computer to add the value stored in Y to the value stored in X and put the result in X. how might this be accomplished with machine instructions? Lets assume that the variable X & Y corresponds to locations 513 and 514. if we assume a simple set of machine instructions, this operation could be accomplished with three instructions 1. Load a register with the contents of memory location 513. 2.Add the contents of memory location 514 to the register. 3.Store the contents of the register in memory location 513. High level language Machine language Thus the set of Machine instructions must be sufficient to express any of the instructions from a high level language
  • 6.
    Thus keeping inmind the previous discussion we can categorize instruction type as follows: 1. Data processing: Arithmetic & logic instructions 2. Data storage: Memory instructions 3. Data movement: I/O instructions 4. Control: Test and branch instructions
  • 7.
    Instruction cycles andsubcycles (fetch and execute etc) 1 2 3 4 5 6 ALU +1 Instruction decoder Program counter Memory Address Register Memory Buffer Register Current Instruction Register Op-code Operand Accumulator Data Bus Address Bus Main Memory 0000 0000 0000 0011 0101 0000 0000 0110 FETCH MAR ← [PC] 0000 0000 0000 0011 PC ← [PC] + 1 0000 0000 0000 0100 MBR ← memory content 0101 0000 0000 0110 0101 0000 0000 0110 CIR ← [MBR] Decode Unit Opcode operand Instruction ……….. ……….. 0101 Address load ………... ………… 0000 0000 0110 0100 0000 0110 0101 0100 0000 0110 0101
  • 8.
    Register Transfers Suppose wehave to transfer the contents of a register R1 to the register R4. This can be accomplished as follows •Enable the output of register R1 by setting R1out to 1. this places the contents of R1 on the processor bus. •Enable the input of register R4 by setting R4in to 1. this loads data from the processor bus into register R4. R1out R4in
  • 9.
    Register Transfers…. Ri(in) =0 Ri(in) = 1 Ri(out) = 0 = Off Ri(out) = 1 = On
  • 10.
    Performing an arithmeticor logic operation Suppose we have to add the contents of register R1 to those of R2 and store the result in register R3. Suggest the steps required. 1. R1out, Yin 2. R2out, Select Y, Add, Zin 3. Zout, R3in
  • 11.
    Fetching a wordfrom memory
  • 12.
    Continued…. 4. Load MDRfrom the memory bus 3. Wait for the MFC response from the memory As an example of a read operation, consider the instruction Move (R1), R2. Following are the steps required to execute this instruction are: 1. MAR → [R1] 2. Start a Read operation on the memory bus 5. [R2]→MDR •The response time of each memory access varies (cache miss, memory-mapped I/O,…). •To accommodate this, the processor waits until it receives an indication that the requested operation has been completed (Memory-Function-Completed, MFC).
  • 13.
    Timing Assume MAR is alwaysavailable on the address lines of the memory bus. 1Step Clock MARin MAR ← [R1] Read 2 Will cause the bus interface circuit to send a read command, MR on the bus Address MR MDRinE Data MFC 3 MDRout 3. MDRout, R2in 1. R1out,MARin, Read 2. MDRinE, WMFC N.B.- here we have reduced the steps, now these are three only.
  • 14.
    Storing a Wordin Memory DO IT BY YOUR OWN
  • 15.
    Execution of acomplete Instruction REFER TO SLIDE NO 7.
  • 16.