0% found this document useful (0 votes)
0 views

Unit 3 Organization

The document discusses various computer architecture concepts including instruction types, formats, and execution cycles, as well as the differences between hardwired and microprogrammed control. It explains the characteristics of RISC and CISC architectures, highlighting their advantages and disadvantages, and compares them in terms of instruction set, execution time, and complexity. Additionally, it covers the importance of program control and pipelining in optimizing instruction execution.

Uploaded by

akash gusain
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
0 views

Unit 3 Organization

The document discusses various computer architecture concepts including instruction types, formats, and execution cycles, as well as the differences between hardwired and microprogrammed control. It explains the characteristics of RISC and CISC architectures, highlighting their advantages and disadvantages, and compares them in terms of instruction set, execution time, and complexity. Additionally, it covers the importance of program control and pipelining in optimizing instruction execution.

Uploaded by

akash gusain
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

ChatGPT…

Exported on 11/01/2025 at 22:06:16 from ChatGPT - with SaveMyChatbot

User
Instruction types, formats, instruction cycles and sub cycles (fetch and ex-
ecute etc), micro operations, execution of a complete instruction (ex-
plain all in detailed format)

ChatGPT
1. Instruction Types:
• Data Transfer Instructions: These are used to transfer data between
registers, memory, or I/O devices. Examples include MOV (move data),
PUSH, POP, and LOAD.
• Arithmetic Instructions: These perform arithmetic operations such as
addition, subtraction, multiplication, or division. For example, ADD, SUB,
MUL, DIV.
• Logic Instructions: These perform logical operations like AND, OR,
NOT, XOR. Examples include AND, OR, XOR.
• Branch Instructions: These are used for controlling the flow of execu-
tion. Conditional or unconditional branching instructions include JUMP,
CALL, RETURN, BEQ (branch if equal).
• Control Instructions: These control the execution of the program. For
example, HALT, NOP (No Operation), and WAIT.
• Shift Instructions: These involve shifting bits in a register either left or
right. Examples are SHL (shift left), SHR (shift right).
2. Instruction Formats: Instructions are encoded in binary to be understood
by the processor. An instruction format typically includes:
• Opcode (Operation Code): Specifies the operation to be performed
(like ADD, MOV).
• Operands: These can be the addresses of data, register names, or imme-
diate values used by the operation.
• Addressing Mode: Specifies how the operand is accessed (like immedi-
ate, direct, or indirect addressing).
• Control Bits: These may be used for setting or controlling flags, or
enabling/disabling certain features.
Example: In a 32-bit instruction, you might have:
• 6 bits for opcode
• 5 bits for the destination register
• 5 bits for the source register
• 16 bits for immediate value or memory address.

1
3. Instruction Cycle and Sub-cycles: The execution of an instruction is
divided into a sequence of steps known as the instruction cycle. This cycle
is broken down into fetch, decode, and execute sub-cycles. These sub-cycles
are also sometimes referred to as micro-operations.
• Fetch Cycle:
– Step 1: The program counter (PC) holds the address of the next
instruction.
– Step 2: The CPU reads the instruction from memory (using the
address stored in the PC).
– Step 3: The instruction is transferred to the instruction register
(IR).
– Step 4: The program counter is incremented to point to the next
instruction in the memory.
• Decode Cycle:
– Step 1: The instruction in the instruction register (IR) is decoded
to determine the operation (opcode) and its operands (addresses, reg-
isters, etc.).
– Step 2: The necessary resources, such as registers or memory loca-
tions, are identified.
– Step 3: The control unit generates the appropriate signals to carry
out the operation.
• Execute Cycle:
– Step 1: The ALU or relevant hardware executes the operation as
per the decoded instruction.
– Step 2: Data is transferred, computations are performed, or I/O
operations are carried out.
– Step 3: The result is stored back into a register or memory, depend-
ing on the instruction.
4. Micro-operations: Micro-operations are basic operations or actions per-
formed on data at the micro-architecture level. These operations include:
• Register Transfer: Moving data from one register to another (e.g., R1
<- R2).
• Arithmetic Operations: Basic arithmetic like addition or subtraction
performed by the ALU.
• Logic Operations: Logical operations like AND, OR, NOT, and XOR.
• Memory Operations: Moving data from memory to a register or vice
versa.
• Control Operations: These include setting or clearing flags, changing
the program counter, or enabling/disabling certain features.
Example: For an instruction like ADD R1, R2, R3, the micro-operations might
be:

2
1. Transfer R2 to the ALU.
2. Transfer R3 to the ALU.
3. Perform addition in the ALU.
4. Transfer the result back to R1.
5. Execution of a Complete Instruction: The execution of a complete
instruction involves the steps below:
• Step 1: Fetching the Instruction: The CPU retrieves the instruc-
tion from memory based on the program counter (PC). The PC is then
incremented to point to the next instruction.
• Step 2: Decoding the Instruction: The control unit decodes the in-
struction, identifying the operation (opcode) and operands. Based on the
opcode, the control unit sends appropriate signals to various components
of the CPU (ALU, registers, memory, etc.).
• Step 3: Executing the Instruction: The CPU executes the decoded
instruction. If it’s an arithmetic operation, the ALU is involved. If it’s
a memory operation, data is moved to or from memory. If it’s a control
instruction, the program counter may change, or an interrupt may be
triggered.
• Step 4: Storing the Result: If the instruction involves computation or
data movement, the result is written back to the destination (register or
memory). The instruction cycle completes here.
In summary, the entire process from fetching an instruction to executing it
and storing the result is a highly synchronized sequence that ensures the CPU
operates efficiently. The different instruction types and formats guide how the
data and operations are handled, and the micro-operations break down each
step for precise control.

User
Hardwire and micro programmed control concept of horizontal and vertical mi-
croprogramming.

ChatGPT
Hardwired Control vs Microprogrammed Control
Hardwired Control:
• In hardwired control, the control unit (CU) uses combinational logic cir-
cuits (gates, flip-flops, decoders, etc.) to produce the control signals for
various operations based on the opcode of the instruction.
• It is a fast method for control signal generation because it directly inter-
prets the instruction via logic gates and generates control signals.

3
• However, it lacks flexibility. Any change in the instruction set or the
addition of new operations requires redesigning the control unit and the
logic circuits.
Microprogrammed Control:
• In microprogrammed control, the control unit uses a set of stored instruc-
tions (called micro-operations or microinstructions) in a control memory
(usually ROM or RAM).
• These microinstructions define the control signals for each step of exe-
cuting an instruction. Each machine instruction is broken into several
microinstructions that control various operations.
• Microprogramming is flexible and can be modified by changing the micro-
program. This allows for easier updates to the control logic, such as adding
new instructions or modifying behavior, without needing to redesign hard-
ware.

Horizontal vs Vertical Microprogramming


1. Horizontal Microprogramming:
• In horizontal microprogramming, each microinstruction is typically wide,
meaning that each control bit corresponds to a specific control signal or
operation.
• A single microinstruction can control multiple actions or states simultane-
ously, meaning many bits are used to represent the simultaneous control
of different parts of the machine.
• Example: If an instruction requires several operations like moving data,
enabling the ALU, setting flags, etc., all of these can be encoded in one mi-
croinstruction. This results in faster execution since all operations happen
at once.
• Advantages:
– Allows parallel execution of multiple control signals.
– Very fast execution as the control unit doesn’t need to decode multi-
ple microinstructions for a single instruction.
• Disadvantages:
– The microinstructions become very wide (large in size), increasing
the complexity of memory usage.
– More control lines are required, making the hardware more complex.
Example of Horizontal Microinstruction:
Microinstruction: | ALU_OP | MEM_READ | MEM_WRITE | LOAD_REG | INCREMENT_PC |
Control Signals: | 1 | 0 | 1 | 1 | 1 |
In this example, all operations occur simultaneously: ALU operation, memory
read, memory write, register load, and program counter increment.
2. Vertical Microprogramming:

4
• Vertical microprogramming uses more compact microinstructions, where
each microinstruction is smaller in size, and individual control signals are
encoded using fewer bits.
• Instead of controlling all operations in one step, the microinstruction refers
to a sequence of operations (steps) or micro-operations, meaning that more
microinstructions are needed to carry out a complex task.
• Example: If an instruction requires multiple actions, multiple microin-
structions will be used in sequence, where each microinstruction controls
a specific part of the operation at a time.
• Advantages:
– The microinstruction memory is smaller since each microinstruction
is more compact.
– More flexible because it’s easier to add new operations without re-
quiring a large increase in instruction width.
• Disadvantages:
– Execution is slower because more microinstructions are needed for
each machine instruction.
– Increased complexity in decoding and sequencing of microinstruc-
tions.
Example of Vertical Microinstruction:
Microinstruction 1: | LOAD_REG | ALU_OP |
Microinstruction 2: | MEM_READ | INCREMENT_PC |
Here, multiple microinstructions are required to sequentially execute a complex
operation, and each microinstruction only does part of the work.

Comparison between Horizontal and Vertical Microprogramming

Horizontal Vertical
Feature Microprogramming Microprogramming
Instruction Width Wide, many bits for Narrow, fewer bits for
simultaneous control encoding operations
signals
Execution Speed Faster execution, since Slower execution due to
multiple operations are sequential
handled in one step microinstructions
Hardware Complexity High, requires many Low, uses compact
control lines and wide microinstructions and
microinstructions less control lines
Memory Usage High memory usage Low memory usage due
because of wide to compact
microinstructions microinstructions

5
Horizontal Vertical
Feature Microprogramming Microprogramming
Flexibility Less flexible, harder to More flexible, easy to
modify (requires modify or add new
redesigning hardware) instructions
Cost Higher cost due to Lower cost due to
hardware complexity simpler hardware

Execution Process in Microprogramming:


1. Fetch the Machine Instruction: The machine instruction is fetched
from memory.
2. Decode the Instruction: The instruction is decoded, and the control
unit identifies the corresponding microprogram.
3. Execute Microinstructions: The microinstructions are fetched sequen-
tially from the control memory and executed.
4. Control Signals: Each microinstruction sets the appropriate control sig-
nals for different components (ALU, memory, registers).
5. Completion: After all microinstructions are executed, the machine in-
struction completes.

Conclusion:
• Hardwired Control is faster but lacks flexibility and requires redesign
for any modification.
• Microprogrammed Control is more flexible and easier to modify but
slower compared to hardwired control due to the need for sequential fetch-
ing and execution of microinstructions.
• Horizontal Microprogramming provides faster execution with
more complex hardware, while Vertical Microprogramming uses
more memory-efficient, compact microinstructions at the cost of slower
execution.

User
Program Control, Reduced Instruction Set Computer, CISC, RISC vs CISC, Pipelin-
ing.

ChatGPT
Program Control:
Program control refers to the method by which the flow of execution in a com-
puter system is managed. It typically involves the following components:
1. Program Counter (PC): Keeps track of the address of the next instruc-
tion to be fetched from memory.

6
2. Instruction Register (IR): Holds the current instruction being exe-
cuted.
3. Control Unit (CU): Decodes the fetched instruction and sends appro-
priate control signals to execute it.
4. Branch Instructions: These instructions (like JUMP, CALL, BRANCH) alter
the flow of execution, making decisions based on conditions or jumping to
a new location in memory.
5. Interrupts: An interrupt temporarily suspends the current execution
flow to handle a higher-priority task.
Program control ensures that instructions are fetched, decoded, executed, and
the next instruction is appropriately chosen, either sequentially or based on
conditional logic.

Reduced Instruction Set Computer (RISC):


RISC is an architecture that uses a small set of simple, highly optimized instruc-
tions. The key characteristics of RISC are:
1. Simple Instructions: Instructions are simple and usually execute in one
clock cycle.
2. Fixed Instruction Length: Instructions have a fixed length (usually 32
bits), simplifying decoding.
3. Load/Store Architecture: Only load and store instructions access
memory, while arithmetic and logical operations are performed only on
registers.
4. Few Addressing Modes: RISC processors use fewer addressing modes
to simplify hardware.
5. Large Number of Registers: RISC architectures tend to have many
general-purpose registers to avoid memory access.
Advantages:
• Faster instruction execution due to simplicity.
• Easier to pipeline as the instructions are uniform.
• High efficiency for repetitive tasks (e.g., vector processing).
Disadvantages:
• More instructions may be needed to perform complex tasks (since opera-
tions like memory access are restricted).
• The compiler needs to optimize the use of registers efficiently.
Examples: ARM, MIPS, SPARC.

7
Complex Instruction Set Computer (CISC):
CISC is an architecture designed with a large set of instructions that can execute
complex operations in a single instruction. Key characteristics include:
1. Complex Instructions: CISC processors have a rich set of instructions,
some of which can perform multiple operations (like ADD, SUB, LOAD, STORE
in one instruction).
2. Variable Instruction Length: Instructions can have different lengths
(e.g., 8, 16, 32 bits), making decoding more complex.
3. Memory-to-Memory Operations: CISC allows operations directly be-
tween memory locations, not just registers.
4. Fewer Registers: CISC processors typically have fewer registers com-
pared to RISC processors.
5. Microcode: CISC processors often use microcode to implement complex
instructions, which is stored in control memory.
Advantages:
• More powerful instructions, meaning fewer instructions are needed for
complex operations.
• Can reduce the need for high-level code optimization because of the ability
to directly manipulate memory.
• Often results in more compact programs.
Disadvantages:
• Slower execution due to complex instructions requiring multiple clock cy-
cles.
• Harder to pipeline efficiently due to the complexity of instructions.
• More complex hardware and control logic.
Examples: x86, VAX.

RISC vs CISC:
Here’s a comparison of RISC and CISC:

RISC (Reduced CISC (Complex


Instruction Set Instruction Set
Feature Computer) Computer)
Instruction Set Simple, small set of Large, complex set of
instructions instructions
Instruction Length Fixed (usually 32 bits) Variable (8, 16, 32 bits)
Execution Time Usually one clock cycle Multiple clock cycles
per instruction per instruction

8
RISC (Reduced CISC (Complex
Instruction Set Instruction Set
Feature Computer) Computer)
Pipelining Easy to pipeline, as Harder to pipeline due
instructions are simple to complex instructions
and uniform
Memory Access Load/Store architecture Can perform
(only load/store access memory-to-memory
memory) operations
Registers Large number of Fewer registers
registers
Complexity Simpler hardware, More complex hardware
easier to implement and due to rich instruction
optimize set
Code Size Larger, since each Smaller, as instructions
instruction is simple and can perform multiple
needs more instructions operations
Examples ARM, MIPS, SPARC x86, VAX, Intel 80x86

Summary:
• RISC emphasizes speed by using a small, simple set of instructions that
execute in a single cycle. It is highly efficient in tasks that require repeti-
tive processing.
• CISC focuses on reducing the number of instructions by making each
instruction more powerful, allowing it to perform complex tasks in one
instruction but at the cost of slower execution and more complex hardware.

Pipelining:
Pipelining is a technique used in modern processors to improve instruction
throughput by overlapping the execution of multiple instructions. The idea
is to divide the execution of an instruction into several stages, where different
instructions can be processed simultaneously at different stages.
Pipeline Stages:
1. Fetch: The instruction is fetched from memory.
2. Decode: The instruction is decoded to determine what operation is to
be performed.
3. Execute: The ALU performs the operation (e.g., arithmetic or logical).
4. Memory Access: If needed, memory is accessed (e.g., loading data from
memory).
5. Write-back: The result of the operation is written back to the register
file or memory.

9
Advantages of Pipelining:
• Increased Throughput: Multiple instructions can be in different stages
of execution simultaneously, improving overall performance.
• Better Resource Utilization: The CPU can use its components more
efficiently since different stages are handled concurrently.
Disadvantages of Pipelining:
• Data Hazards: If an instruction depends on the result of a previous
instruction, it can cause delays.
• Control Hazards: Branching instructions (e.g., JUMP, BRANCH) can dis-
rupt the pipeline and cause performance degradation.
• Complexity: The control unit becomes more complex as it needs to
manage hazards and ensure that instructions are executed in the right
order.
Types of Hazards:
1. Data Hazards: Occur when an instruction depends on the result of a
previous instruction.
• Example: A load instruction followed by an instruction that uses the
value from that load.
2. Control Hazards: Occur due to branching or jumping, which disrupts
the sequential flow of instructions.
• Example: A conditional branch instruction might cause the CPU to
fetch the wrong instruction.
3. Structural Hazards: Occur when there aren’t enough resources (e.g.,
memory ports) to handle the required operations simultaneously.

Conclusion:
• Program control ensures the correct flow of instructions, utilizing the
program counter, control unit, and branch instructions to manage execu-
tion.
• RISC focuses on simplicity and speed with a small set of simple instruc-
tions, while CISC provides a larger, more complex set of instructions to
perform tasks in fewer steps, but at the cost of performance.
• Pipelining increases CPU throughput by overlapping the stages of in-
struction execution, though it introduces challenges like hazards that need
to be managed.

10

You might also like