03 Intruction Exec
03 Intruction Exec
03 Intruction Exec
Instruction Execution(RTL)
Somanath Tripathy
IIT Patna
This Class
• Instruction Execution
– Micro operation
• Register Transfer Language (RTL)
Software Abstraction
int sum(int x, int y) 0x401040 <sum>: 0x55
{ 0x89
int t = x+y; C
0xe5
return t; 0x8b
} 0x45
_sum: 0x0c
assembly 0x03
pushl %ebp
movl %esp,%ebp 0x45
movl 12(%ebp),%eax 0x08
addl 8(%ebp),%eax 0x89
movl %ebp,%esp 0xec
popl %ebp machine 0x5d
ret code 0xc3
3
How to perform a Task?
• Task/ Program is a sequence of steps
– For each step, an arithmetic or logical operation is done
• For each operation, a different set of control signals is
needed
• Hardwired
– Connect to a particular hardware component
– Hardwired systems are inflexible
• Micro-program
– General purpose hardware can do different tasks, given
correct control signals
– Instead of re-wiring, supply a new set of control signals
Example of Program Execution
Ex. Let The processor has
a single data register AC
Let the PC content is 300
16-bit Instruction has 4-bit
opcode and 12-bit operand field
Decode&Exec
IO
Data
Buffers d1
-- d2
--
--
------
Different types of Actions
• Data Transfer
– processor-memory
– Processor I/O
• Data processing
– Arithmetic or logical operation on data
• Control
– Alteration of sequence of operations
– e.g. jump
• Combination of above
Register Transfer Language
• Digital systems are composed of modules
– constructed from digital components,
• registers, decoders, arithmetic elements, and control logic
• MICROOPERATION:
– Elementary operation performed during a single clock pulse, on
the information stored in one or more registers
• operation ex.: shift, count, clear, load, add,...
RTL:
• A symbolic language for describing
the internal organization of digital
computers with
• The set of registers it contains
and their functions Registers ALU
• The sequence of (R) (f)
microoperations performed on
the binary information stored
• The control that initiates the
sequence of microoperations 1 clock cycle
RTL
• RTL:
– Can also be used to facilitate the design process of digital systems
Representation of a transfer(parallel) R2 R1
Load
R2 Clock
n
R1
• The outputs of the source must have a path to the inputs of the destination
• The destination register has a parallel load capability
Hardware Implementation
Representation of a controlled(conditional) transfer P: R2 R1
Condition(p=1) which determines when the transfer is to occur
If (p=1) then (R2 R1)
Control P Load
Block diagram R2 Clock
Circuit
n
R1
t t+1
Clock
Timing diagram
Load
Transfer occurs here
Bus and Memory Transfer
• Bus is a path(of a group of wires) over which
information is transferred, from any of several
sources to any of several destinations.
From a register to bus: BUS <- R
Bus lines
Bus lines
From bus to a register : R <- BUS
Load
Reg. R0 Reg. R1 Reg. R2 Reg. R3
z D0 D1 D2 D3
Select 2x4 E (enable)
w
Decoder
Memory Transfer
Memory Read
AR
unit Write
DR
RTL:?
Instruction Cycle State Diagram
Thanks