Unit II
Unit II
Unit II
• CPU Architecture
• Register Organization
• Instruction cycle
• Instruction Formats
2. Data Register
• Used only to hold the data
• Can not be used in calculation of operand address
3. Address registers
• Segment Pointers: Points to base address of the segment
• Index Registers :index address
• Stack Pointer
User-register variables continued..
• 4. Conditional Codes: CC
• Partially visible to the user
• Referred as flag
• Instruction Fetch:
• Fetches instruction from memory
• PC co-ordinates fetching of Instructions
• IR holds the instruction being executed
• 1st at 300 and then at 301,302,303,304
Instruction Execution
• Fetched instruction is stored in IR
• Some null
states.
• Some states
visited more
than once
Different states in Instruction cycle
• Instruction Address Calculation(iac):
• Determine address of the next instruction to be executed
• If instruction of 16 bits and memory organization of 16 bits then add 1 to
previous address.
• If memory is organized as 8 bits, then add 2 to the previous address
• Operand fetch (of): Fetch the operand from memory or read it in from
I/O.
• Operand store (os): Write the result into memory or out to I/O.
Instruction Cycle with Interrupts
Machine Instructions
• The operation of a processor –determined by the instruction it
executes
• Instruction Set: Collection of different instructions processor can
handle
• Instruction Format:
• Each instruction must contain the information required by the processor for
execution
• Elements of Machine Instruction:
• Operation Code(opcode):
• specifies the operation to be performed
• Binary code representing the operation of instruction is an opcode
• e.g. ADD,I/O
Elements of Machine Instruction
• Source operands:
• Operation may involve one or more source operands
• Operands are input to the operation
• ADD→ Add
• SUB→ Subtract
• MUL→ Multiply
• DIV→ Divide
• LOAD→Load data from memory
• STORE→Store data to memory
Instruction format
• Operands are also represented Symbolically
• A simple program would
• accept this symbolic input
• convert opcodes and operand references to binary form
• construct binary machine instructions.
• Today most programs use high-level language
• ADD R,Y
However, symbolic machine language remains a useful tool for describing
machine instructions.
Instruction Types Memory
Address
Data
• X=X+Y 514 Y
Current opcode
Control unit … Control
… Signals
Addressing mode
CLOCK
Control Unit Design
• Machine Language Instructions------------------>Set
Control unit
of Control Signals.
2. Microprogrammed
• Control signals are stored as bit patterns in a ROM, inside the control unit
• Modern design technique
Micro-programmed Control Unit
Hardwired Control Unit
Decoder
T1
Each dot represents a
T2 circuit that generates one
or more control signals
T3
Timing
Signals
T4
T5
T6
Instructions
A hardwired control unit
• uses a fixed set of logic gates and circuits to execute instructions.
• The control signals for each instruction are hardwired into the
control unit,
• The control unit has a dedicated circuit for each possible
instruction
• The control hardware can be viewed as a
• state machine that changes from one state to another in every clock cycle,
• depends on the contents of the instruction register, the condition codes,
and the external inputs.
• The sequence of the operation carried out by this machine is
determined by the wiring of the logic elements
The step Decoder
provides separate
signal line for each
Step, or time slot in
Control sequence.
• Control words are stored in memory with each word having a unique
address.
• The address field gives the address of the next control word to be executed
if a certain condition is True.
Horizontal Microinstruction
• One bit for the internal processor control line
• One bit for the system bus control line
• Condition field indicates when branching should be initiated
• Address: address of next control word
• To execute this microinstruction:
• turn on all the control lines indicated by a 1-bit
• turn off all the control lines indicated by a 0-bit
• If the condition field indicates a false condition, execute the next
microinstruction in the sequence
• If the condition indicated by the condition bits is true, the next
microinstruction to be executed is indicated in the address field
Microinstructions arranged in control memory
• Concise representation
• Each microinstruction executed
sequentially
• Each routine ends with a jump or
branch
• Execute cycle→indicates ADD,AND will
be executed next
• Fetch, indirect, execute,Interrupt
Microprogrammed Control Unit
• Microinstructions→ Control Memory
• Control address register→ Address of next
instruction to be read
• Control Buffer register → Read Instruction
• Sequencing Logic→ Loads the control address
register and issues read command
• Lower decoder → only in vertical
microinstructions
• In horizontal: each bit indicates one control sig
• In vertical: a code is used for each
microinstruction
• This lower decoder translates this code into
individual control signals
RISC and CISC Architecture
RISC CISC
• Reduced Instruction Set • Complex Instruction Set
computer computer
• It uses only hardwired control • It uses both hardwired and
unit/ microprogrammed control unit
• An instruction is executed in a • Instruction may take more than
single clock cycle. one clock cycle
• An instruction can fit in one • Instructions are larger than the
word. size of one word
• Code size is large. • Code size is small
• The program written for the • The program written for the CISC
RISC requires more space in requires less space in memory
memory.
RISC CISC
• The execution time for RISC is • The execution time for CISC is
very short longer
• RISC requires more RAM as • CISC requires a minimum
compared to CISC amount of RAM
• Software Centric design • Hardware-centric design
• Complexity lies in the compiler • Complexity lies in the processor
• Few addressing modes • 8-10 different addressing modes
• Few instructions(30-40) • 100-300 instructions
• Instructions are executed in • Instructions are executed
parallel (pipeline) sequentially
• Ex. ARM processors • Ex. AMD processors
mPM: Microprogra
memory
mPC: Micrprogramm
Control Unit
CPU Architectures
CPU Architectures
• Von Neumann • Harvard
• It is a theoretical design based on • It is based on modern computer
a stored program concept architecture.
• It uses the same physical memory • It uses separate memory
address for both instructions and addresses for instructions and data
data • Processor needs one clock cycle to
• A processor needs two clock cycles execute an instruction
to execute an instruction • Complex control unit design due to
• Simple control unit design separate buses