Download as pdf or txt
Download as pdf or txt
You are on page 1of 13

EE2016 Microprocessor Theory & Lab

Aug – Nov 2021


Week6: EUCL & PFCL
(Adapted from PPT by Prof. Ashok Jhunjhunwala)

Dr. R. Manivasakan, ONG, TeNeT Group, IIT, Madras


Manual Execution of a Program

Manual execution of program (not automated)
– We manually identify the next instruction to be executed, drive
the EU using the right control signals

Automation is done by CU.
– Uses the PC (part of CU) to hold address of next instruction to
be executed.
– And also the PFCL would also automatically track the next
instruction to be executed even of the sequence is out of order
– No human intervention is needed
– Automatic
16/08/21 Dr. R. Manivasakan, EE2016F21, MuP: The 2
ory & Lab, OCEAN Lab, EED, IITM
Control Unit Design

● We have designed an EU so far and learned how to control EU using


control lines: we, the human being interpreting the program,
generate control signals and drive the EU
● Now, let us learn how to automate the program to drive the EU

16/08/21 Dr. R. Manivasakan, EE2016F21, MuP: The 3


ory & Lab, OCEAN Lab, EED, IITM
We have so far learned ......
● How to design EU of a processor?
● How to drive EU using Control Signals?
● Running an assembly program
– involves generating the appropriate control signals given a program (and
instructions thereof)
– The generated control signals now drive the EU
– Normally the program is executed in sequence
– Occasionally change sequence (program flow) as per the outcome of previous
instruction(s)
● Next we will learn
– How to automate the controller (so far a human being was a controller) using a
Control Unit and Program Memory

16/08/21 Dr. R. Manivasakan, EE2016F21, MuP: The 4


ory & Lab, OCEAN Lab, EED, IITM
Control Unit
● Control unit (CU) uses a Program to control/drive the operation of the
Execution unit (EU) of the processor

– Each program instruction (Execution Unit Control Instruction or EUCI) is executed as


a series of steps in sequence driven by a state machine
● Drives data-flow and ALU instructions by driving Control signal of EU
● We can say that the control unit takes charge of running the given program, all by itself:
Automates the execution of a program

– Program is normally executed in Sequence, but some instructions can modify the
flow of the program (Program Flow Control Instruction) – rather the outcome of
some instructions (conditional statements) might alter the course of the program

● CU Components: Program Counter (PC), Instruction Decoder (ID), Execution


Unit Control Logic (EUCL) and Program Flow Control Logic (PFCL)

16/08/21 Dr. R. Manivasakan, EE2016F21, MuP: The 5


ory & Lab, OCEAN Lab, EED, IITM
Instructions and Programs
● Programs are sequence of instructions
– to achieve a task
– Each instruction requires the microprocessor to execute a primitive function
– Communicate with the processor through instructions
● Each instruction has
– Opcode: Operation Opcode Operand1 Operand2 Operand3
– Operands: The data that would be required to execute the instruction. The number of operands
required depends on the opcode of the instruction
● Program: An organized list of instructions that, when executed, causes the processor to
behave in a predetermined manner to accomplish a task
● Instructions in a program can be broadly categorized as
– Execution unit control instructions: controls the execution unit
– Program flow control instructions: Alter flow of the program depending on Flag bits
● Processor Instruction Set: defined by the manufacturer

16/08/21 Dr. R. Manivasakan, EE2016F21, MuP: The 6


ory & Lab, OCEAN Lab, EED, IITM
Program Memory (PM)
● PM is used to store a program
– Each instruction of the program
in PM is stored at consecutively Instruction opcode

addressable locations Data Lines of program


memory
● Address lines of PM helps fetch Program Memory
next instruction to be executed
from the memory Instruction operands

● Data Lines of PM gives opcode


and the operand
Address Lines

16/08/21 Dr. R. Manivasakan, EE2016F21, MuP: The 7


ory & Lab, OCEAN Lab, EED, IITM
Program Counter (PC)
● PC holds the address of the next
instruction to be executed and Instruction opcode

drives the address lines of PM Data Lines of program


memory
● Instructions are usually fetched Program Memory

sequentially from memory


(hence PC is usually Instruction operands

incremented after each


instruction is executed) Address Lines

– but program flow
control instructions might change Program
Counter New instruction address
the sequence by loading a new
value in PC Inc

16/08/21 Dr. R. Manivasakan, EE2016F21, MuP: The 8


ory & Lab, OCEAN Lab, EED, IITM
Example State Machine: ADD R4, R5
● Instruction: ADD R4, R5
– R4 = R4 + R5
– Uses ALU to add the values stored in registers R4 & R5 and store the result
in R4
– If ALU uses only mapped input and output registers
● State machines perform the task of moving values to and from the mapped registers

● Mapped Registers Case: State Machine Steps


– Get values of R4 and R5 in R0 and R1 respectively
– Set ALU control signals to ADD
– Copy value from R2 to R4
16/08/21 Dr. R. Manivasakan, EE2016F21, MuP: The 9
ory & Lab, OCEAN Lab, EED, IITM
EUCL, PUCL and Instruction Decoder
● An Instruction Decoder EUCL
decodes the op-code and
drives the state machine
corresponding to the op-
code Instruction opcode

– Execution Unit Control Logic State


Machines
(EUCL): issues control signals
for the execution unit

Instruction Decoder
PFCL

16/08/21 Dr. R. Manivasakan, EE2016F21, MuP: The 10


ory & Lab, OCEAN Lab, EED, IITM
Putting CU Together
Control Unit
Execution
Unit
Operand / EUCI
Operand Address
Program
Memory
Instruction
Parser
Instruction
Decoder
Control Instruction ALU
Op-Code Control
Operand
EUCL Function
PFCL Lines

PFCI ALU
Instruction Eg. JMP, RJMP, BRNE
Address
(for Fetch) Status
Data Out of sequence
Register Flags
Memory execution In-sequence
Execution (PC++)
Stack
MAR PC
Operand
Operand
Fetch
Address

16/08/21 Dr. R. Manivasakan, EE2016F21, MuP: The 11


ory & Lab, OCEAN Lab, EED, IITM
Class on 13.9.21

16/08/21 Dr. R. Manivasakan, EE2016F21, MuP: The 12


ory & Lab, OCEAN Lab, EED, IITM
Class on 14.9.21

16/08/21 Dr. R. Manivasakan, EE2016F21, MuP: The 13


ory & Lab, OCEAN Lab, EED, IITM

You might also like