0% found this document useful (0 votes)
2 views13 pages

Chapter 2

The document provides an overview of computer instruction architecture, detailing the components of instructions, types of instructions, micro instruction formats, and the fetch and execution cycle. It distinguishes between hardwired and micro-programmed control units, explaining their design principles, advantages, and limitations. Understanding these concepts is essential for software developers and computer architects to effectively utilize and optimize computer systems.

Uploaded by

madanmadhu818
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views13 pages

Chapter 2

The document provides an overview of computer instruction architecture, detailing the components of instructions, types of instructions, micro instruction formats, and the fetch and execution cycle. It distinguishes between hardwired and micro-programmed control units, explaining their design principles, advantages, and limitations. Understanding these concepts is essential for software developers and computer architects to effectively utilize and optimize computer systems.

Uploaded by

madanmadhu818
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

1.

Introduction
Instructions are fundamental building blocks in computer systems that dictate the operations to
be performed by the hardware. They serve as commands or directives that guide the computer's
behavior. Each instruction represents a specific operation, such as data manipulation, control
flow, or communication.
Components of an instruction: opcode, operands, and addressing modes:
An instruction consists of several components that provide information about the desired
operation:
Opcode (Operation Code): It represents the specific operation to be performed. The opcode
determines the type of operation, such as arithmetic, logic, data transfer, or control.
Operands: Operands are the data or addresses on which the operation is performed. They can be
constants, variables, memory locations, or registers.
Addressing Modes: Addressing modes define how the operands are accessed or addressed.
Common addressing modes include immediate addressing, direct addressing, indirect addressing,
and indexed addressing.
Instruction formats: fixed-length and variable-length instructions:
Instruction formats define the structure and layout of instructions in memory. Two common
formats are:
Fixed-Length Instructions: In this format, instructions have a predetermined length, usually
specified by the architecture. Each field of the instruction format has a fixed position and size,
simplifying the decoding process.
Variable-Length Instructions: In this format, instructions can have varying lengths. The length of
the instruction is typically encoded within the instruction itself. Variable-length instructions
allow for more compact code representation and support a larger instruction set.
Examples of common instructions in computer architectures:
Different computer architectures have their own instruction sets and formats. Here are some
examples of common instructions:
Arithmetic Instructions: Addition, subtraction, multiplication, and division operations on data.
Logical Instructions: Boolean operations such as AND, OR, and NOT.
Data Transfer Instructions: Move data between memory locations and registers.
Control Flow Instructions: Branching and jumping instructions to alter the program's flow based
on conditions or predefined locations.
Load and Store Instructions: Load data from memory into registers or store data from registers
into memory.
Input/Output Instructions: Perform input/output operations to communicate with external
devices.
These examples represent a subset of the instructions found in computer architectures. The
specific instructions available depend on the architecture and its intended purpose.
Understanding the basic concept of instructions is essential for both software developers and
computer architects. It forms the foundation for writing programs, designing instruction sets, and
optimizing the performance of computer systems. By comprehending the role of instructions and
their components, developers can effectively utilize the capabilities of a given architecture and
create efficient and functional software.

2. Categorization of instructions based on their functionality


Instructions in computer architectures can be categorized into different types based on their
intended functionality. These types provide a systematic way to classify and understand the
operations performed by instructions. Here are some common instruction types:
a) Data Transfer Instructions: These instructions facilitate the movement of data between
memory locations and registers. They are used to load data from memory into registers or
store data from registers into memory. Examples include load, store, move, and exchange
instructions.

b) Arithmetic and Logical Instructions: These instructions perform mathematical and


logical operations on data. Arithmetic instructions include addition, subtraction,
multiplication, and division. Logical instructions perform Boolean operations such as
AND, OR, XOR, and NOT. These instructions are essential for numerical computations,
data manipulation, and decision-making processes.

c) Control Flow Instructions: Control flow instructions dictate the flow of execution in a
program. They allow for conditional branching and looping, enabling decision-making
and repetition. Branch instructions alter the program's flow based on conditions or
predefined locations, while jump instructions transfer control to a specific location.
Control flow instructions play a crucial role in implementing conditional statements,
loops, and function calls.

d) Floating-Point Instructions: Floating-point instructions are designed specifically for


performing operations on floating-point numbers. These instructions handle the
representation and manipulation of decimal numbers, which are commonly used in
scientific and engineering computations.
e) String and Vector Instructions: String and vector instructions are used for manipulating
strings and performing operations on vectors of data elements. They enable efficient
processing of character strings and arrays of data elements by applying operations
simultaneously to multiple elements.
Examples of instruction types and their usage in programming:
Let's consider a simple programming scenario to illustrate the usage of different instruction
types:
Suppose we have a program that calculates the sum of a list of numbers. The program reads the
numbers from an input file, performs the addition operation, and displays the result. Here's how
different instruction types would be used:
Data Transfer Instructions: Load instructions would be used to fetch the numbers from memory
into registers. Store instructions would be used to store the final result back into memory or
display it on the output device.
Arithmetic Instructions: Addition instructions would be used to perform the sum operation on the
numbers loaded into registers. These instructions add the values of the operands and store the
result in a designated register.
Control Flow Instructions: Branch instructions would be used to check if there are more numbers
to be processed. If so, the program would loop back to the beginning to read the next number.
Once all numbers have been processed, a jump instruction may be used to transfer control to the
display routine.
Floating-Point Instructions: If the numbers in the list are floating-point numbers, floating-point
arithmetic instructions would be used to perform the addition operation with proper precision
and handling of decimal values.
By using a combination of these instruction types, the program can effectively read, process, and
display the sum of the numbers. The specific instructions and their operands would depend on
the architecture and the programming language being used.
Understanding the different instruction types is crucial for software developers as it enables them
to choose the appropriate instructions to achieve desired functionality efficiently. It also allows
for optimization techniques, such as loop unrolling or parallel execution, by leveraging the
specific features and capabilities of the instruction set architecture.

3. Micro Instruction Formats


Definition and purpose of micro instructions: Micro instructions are low-level instructions that
control the operations of the control unit within a computer's processor. They provide a detailed
step-by-step sequence of microoperations that need to be executed to carry out higher-level
instructions. Micro instructions play a crucial role in implementing the control unit's
functionality and coordinating the execution of various components within the processor.
a) Structure and organization of micro instructions: Micro instructions typically have a
fixed structure and organization that specifies the microoperations to be performed. The
structure of micro instructions can vary depending on the architecture and design of the
processor. However, they generally consist of the following components:

b) Micro Operation Fields: These fields represent individual microoperations that need to
be executed during each microinstruction. Examples of micro operations include loading
data into registers, performing arithmetic operations, controlling multiplexers, and
updating control signals.

c) Control Signals: Control signals are used to activate specific components or circuits
within the processor. They are encoded in the micro instruction to coordinate the
execution of various tasks, such as enabling or disabling registers, selecting data paths,
initiating memory operations, and controlling input/output devices.

d) Next Address Field: This field specifies the address of the next micro instruction to be
executed. It determines the control flow within the microprogram, allowing for
conditional branching and looping.

e) Encoding and representation of micro instructions: Micro instructions are encoded


using a specific format that allows them to be easily interpreted and executed by the
control unit. The encoding scheme may vary depending on the processor architecture, but
it typically involves representing each micro operation and control signal as binary
values.

There are different encoding schemes used for micro instructions, including:
a) Vertical Microcode: In vertical microcode encoding, each bit position in the micro
instruction represents a specific control signal or micro operation. The encoding scheme
allows for a high level of flexibility and granularity in specifying the microoperations.

b) Horizontal Microcode: In horizontal microcode encoding, each micro operation is


represented as a sequence of control signals across multiple bits. This encoding scheme
provides a more compact representation of micro instructions but may require more
complex decoding circuitry.
Micro instructions are typically stored in a microprogram control memory (MCM) or microcode
ROM. The microprogram sequencer fetches the micro instructions sequentially or based on
control flow instructions, and the control unit executes the specified microoperations.
The structure and encoding of micro instructions are critical for the efficient execution of the
control unit. They provide the necessary control signals and operations to coordinate the
functioning of the processor's components and ensure proper execution of higher-level
instructions.
It's important to note that micro instructions are specific to microcoded control units, and not all
processors or architectures utilize microcode for control unit implementation. Some processors
use hardwired control units or a combination of microcode and hardwired control to achieve
efficient instruction executio

4. Fetch and Execution Cycle


The fetch and execution cycle, also known as the instruction cycle or machine cycle, is a
fundamental process in computer systems that enables the execution of instructions stored in
memory. It involves retrieving instructions from memory, decoding them, and executing the
corresponding operations.
The fetch and execution cycle typically consists of the following steps:
a) Instruction Fetch (IF): During this step, the control unit fetches the next instruction
from the memory based on the program counter (PC), which holds the address of the
instruction to be fetched. The control unit sends the memory address to the memory unit,
and the instruction is retrieved and stored in the instruction register (IR) within the
processor.

b) Instruction Decode (ID): In this step, the control unit decodes the fetched instruction
stored in the IR. It determines the opcode, which specifies the operation to be performed,
and identifies the operands or addresses associated with the instruction.

c) Operand Fetch (OF): If the instruction requires accessing data from memory or
registers, the control unit fetches the required operands during this step. The operands
may be memory locations or values stored in registers. The control unit coordinates the
data transfer and ensures that the operands are available for the subsequent execution
step.

d) Execute (EX): In this step, the control unit performs the actual operation specified by the
fetched instruction. It activates the necessary circuits and control signals to execute the
instruction. This may involve arithmetic and logical operations, data manipulation,
control flow changes, or other specified tasks depending on the instruction.

e) Write Back (WB): If the executed instruction produces a result that needs to be stored,
the control unit writes the result back to the appropriate location, such as a register or
memory location. This step ensures that the changes made during the execution are
appropriately recorded and can be used by subsequent instructions.
The control unit plays a critical role in coordinating the fetch and execution cycle. It generates
the necessary control signals to fetch instructions, decode them, and execute the required
operations. The control unit synchronizes the activities of other components, such as the ALU
(Arithmetic and Logic Unit), registers, and memory, to ensure the proper execution of each
instruction.
The control unit utilizes the microinstructions stored in the microprogram control memory
(MCM) or microcode ROM to guide the fetch and execution cycle. It interprets the
microinstructions and generates the appropriate control signals to activate the necessary
components and perform the required operations.
By repeating the fetch and execution cycle, the computer system can continuously execute a
sequence of instructions, allowing for the execution of complex programs and tasks. The control
unit's role in coordinating the fetch and execution cycle is crucial for the proper functioning and
efficient execution of instructions in a computer system.

5. Hardwired Control Unit


A hardwired control unit is a type of control unit in computer architecture that uses dedicated
hardware circuits to generate control signals and coordinate the execution of instructions. Unlike
microprogrammed control units that rely on stored microinstructions, hardwired control units are
designed using combinational logic circuits and finite-state machines.
The design principles of a hardwired control unit involve mapping the instruction set architecture
(ISA) of the computer to a set of control signals that activate the necessary components and
perform the required operations for each instruction. The control unit is designed to interpret the
opcode of an instruction and generate control signals accordingly.
The implementation of a hardwired control unit involves the following steps:
a) Instruction Decoding: The control unit receives the fetched instruction and decodes its
opcode to determine the instruction type and the required control signals. The control unit
uses combinational logic circuits to analyze the opcode and generate control signals
based on predefined mappings.

b) Control Signal Generation: Based on the decoded opcode, the control unit activates the
necessary control signals to perform the desired operation. These control signals control
various components of the computer system, including the ALU, registers, memory, and
input/output devices. The control signals ensure that the proper operations are executed in
synchronization with the fetch and execution cycle.
c) Control Signal Distribution: The control signals generated by the control unit are
distributed to the relevant components of the computer system through control buses.
These buses transmit the control signals to the appropriate modules, enabling them to
carry out the required tasks. The control signal distribution ensures that the instructions
are executed accurately and in the correct sequence.

d) Finite-State Machine Design: A hardwired control unit often utilizes finite-state


machines to control the sequencing of instructions. Finite-state machines provide a
systematic approach to capturing the control flow and sequencing of operations. The
control unit's design includes state registers and combinational logic circuits that
transition between states based on the current instruction and the machine's current state.
One advantage of hardwired control units is their speed and efficiency. Since the control signals
are generated directly by hardware circuits, there is no need for interpretation or decoding of
microinstructions, resulting in faster execution of instructions. Additionally, hardwired control
units are typically simpler in design and have a lower hardware cost compared to
microprogrammed control units.
However, one limitation of hardwired control units is their lack of flexibility. Any changes or
updates to the instruction set architecture or the control signals require modifications to the
hardware circuits, which can be time-consuming and expensive. This lack of flexibility makes
hardwired control units less adaptable to evolving instruction sets or complex architectures.
Overall, hardwired control units provide a fast and efficient means of generating control signals
and coordinating the execution of instructions in a computer system. Their design and
implementation involve mapping the instruction set architecture to control signals using
combinational logic circuits and finite-state machines. While they lack flexibility, they excel in
speed and simplicity, making them suitable for many computing applications.

6. Micro-programmed Control Unit


A micro-programmed control unit is a type of control unit in computer architecture that uses
microcode to control the execution of instructions. Microcode is a low-level, machine-readable
code that defines the sequence of microinstructions needed to execute a particular instruction.
The concept of microcode involves breaking down complex instructions into a series of simpler
microinstructions. Each microinstruction corresponds to a specific control signal or sequence of
control signals that activate the necessary components of the computer system to perform a
particular operation. Microinstructions are stored in a control memory or microstore.
The microprogram sequencer is responsible for fetching and executing the microinstructions
stored in the control memory. It maintains the sequencing and control flow of the microprogram,
ensuring that the microinstructions are executed in the correct order. The microprogram
sequencer typically includes a program counter and control logic to determine the next
microinstruction to be fetched and executed.
The execution of an instruction in a micro-programmed control unit involves the following steps:
a) Instruction Fetch: The microprogram sequencer fetches the microinstruction
corresponding to the opcode of the instruction being executed. The microinstruction is
fetched from the control memory and loaded into the microinstruction register.

b) Microinstruction Execution: The microinstruction contains control signals that are used
to activate the necessary components of the computer system. These control signals
coordinate the operations of the ALU, registers, memory, and input/output devices,
ensuring that the instruction is executed correctly.

c) Sequencing: After executing a microinstruction, the microprogram sequencer determines


the next microinstruction to be executed. This determination is based on the control logic
and the current state of the microprogram sequencer. The sequencer may branch to
different microinstructions based on conditional branches or jump instructions within the
microprogram.
Micro-programmed control units offer flexibility and ease of modification compared to
hardwired control units. Since the control logic is stored in microcode, modifications to the
instruction set architecture or control signals can be made by simply updating the microcode
stored in the control memory. This allows for easier adaptation to new instruction sets and
architectures.
However, micro-programmed control units can be slower compared to hardwired control units
due to the extra step of fetching and executing microinstructions. The additional layer of
interpretation and control signal generation introduces some overhead. Nevertheless, advances in
microarchitecture and optimization techniques have significantly improved the performance of
micro-programmed control units.
In summary, a micro-programmed control unit uses microcode to control the execution of
instructions. Microcode defines the sequence of microinstructions needed to execute instructions,
and the microprogram sequencer fetches and executes these microinstructions. While micro-
programmed control units provide flexibility and ease of modification, they may introduce some
performance overhead compared to hardwired control units.
7. Control Memory
Control memory, also known as microstore or control store, is a specialized memory component
in a computer system that stores microinstructions used by a micro-programmed control unit. It
is a key element in the execution of instructions and plays a crucial role in controlling the
operation of the computer system.
The purpose of control memory is to store the microinstructions that define the sequence of
control signals needed to execute each instruction. Each microinstruction corresponds to a
specific operation or control action required to perform a particular step of an instruction.
Control memory acts as a lookup table that provides the control signals necessary to coordinate
the various components of the computer system during instruction execution.
The organization and structure of control memory can vary depending on the specific
architecture and design of the computer system. Generally, control memory is implemented as a
read-only memory (ROM) or a random-access memory (RAM). ROM-based control memories
are often used in micro-programmed control units due to their non-volatile nature and ease of
implementation.
Control memory is organized in such a way that each microinstruction is stored at a specific
memory location or address. The address of the desired microinstruction is provided by the
microprogram sequencer, which selects the appropriate memory location based on the current
instruction being executed.
The structure of control memory involves defining the format and layout of each
microinstruction. This includes specifying the number and arrangement of control fields within a
microinstruction, which correspond to specific control signals or control actions. Control fields
are used to activate or deactivate various components of the computer system, such as registers,
arithmetic logic units (ALUs), memory units, and input/output (I/O) devices.
During the execution of an instruction, the micro-programmed control unit retrieves the
microinstruction from control memory based on the address provided by the microprogram
sequencer. The microinstruction is then decoded to extract the control signals required for the
current step of the instruction. These control signals are then used to coordinate the operations of
the computer system, ensuring that the instruction is executed correctly.
The storage and retrieval of microinstructions from control memory are typically performed
using address decoding and multiplexing techniques. Address decoding involves translating the
address provided by the microprogram sequencer into the appropriate memory location within
the control memory. Multiplexers are used to select the desired control fields from the retrieved
microinstruction based on the current state of the instruction execution.
In summary, control memory is a specialized memory component that stores microinstructions
used by a micro-programmed control unit. It provides the control signals necessary to coordinate
the operation of the computer system during instruction execution. Control memory is organized
and structured to store and retrieve microinstructions based on the address provided by the
microprogram sequencer, enabling the correct sequencing and activation of control signals for
each instruction step.

8. Sequencing and Execution


In a micro-programmed control unit, the sequencing process refers to the order in which
microinstructions are executed to perform the desired operations. It involves the control flow and
branching within the microcode to ensure the correct execution of instructions.
The sequencing process begins with the microprogram sequencer, which is responsible for
generating the addresses of microinstructions to be executed. The sequencer keeps track of the
current address and determines the next address based on the control signals and conditions
present in the microinstruction being executed.
Control flow within the microcode is determined by conditional branching instructions. These
instructions allow for decision-making based on specific conditions or flags within the computer
system. The branching mechanism in the microcode enables the control unit to deviate from the
linear sequence of microinstructions and jump to different addresses within the control memory.
Conditional branching instructions typically involve comparing the status of certain registers or
flags with predefined values and making a decision based on the result. For example, an
instruction might specify that if a particular register is equal to zero, the control should branch to
a specific address, while if the register is not equal to zero, the control should continue with the
next microinstruction in the sequential order.
The execution of micro instructions involves activating the appropriate control signals and
coordinating the various components of the computer system to perform specific operations.
Each microinstruction corresponds to a control action that activates or deactivates certain
components, such as registers, ALUs, memory units, or I/O devices.
During execution, the microinstructions are decoded to extract the control signals required for
the current step. These control signals are then applied to the respective components to perform
the desired operations. For example, a microinstruction might specify the transfer of data from
one register to another, the addition of two numbers in the ALU, or the retrieval of data from
memory.
The execution of microinstructions is typically performed in a sequential manner, following the
control flow defined by the microcode. However, branching instructions allow for conditional or
unconditional jumps to different addresses, enabling the control unit to modify the sequential
execution path.
It is important to note that the microcode within a micro-programmed control unit is specific to a
particular computer architecture or instruction set. The microcode is designed to ensure that the
execution of instructions follows the desired behavior and produces the expected results.
In summary, sequencing and execution in a micro-programmed control unit involve the control
flow and branching within the microcode. The microprogram sequencer generates addresses of
microinstructions to be executed, and conditional branching instructions enable the control unit
to make decisions and alter the execution path. The execution of microinstructions activates
control signals and coordinates the components of the computer system to perform specific
operations, ensuring the desired behavior and functionality of the instruction set.

9. Conclusion
In this chapter, we explored the basic concepts of instructions and their significance in computer
execution. We discussed the components of an instruction, including the opcode, operands, and
addressing modes. Furthermore, we examined different instruction formats, such as fixed-length
and variable-length instructions, which are commonly used in computer architectures.
Additionally, we delved into instruction types and their categorization based on functionality,
including data transfer, arithmetic and logical operations, and control flow. We provided
examples of these instruction types and discussed their usage in programming.
Moreover, we explored micro instruction formats and their role in controlling the execution of
instructions. We discussed the structure, organization, encoding, and representation of micro
instructions, which play a crucial role in the micro-programmed control unit.
Furthermore, we examined the fetch and execution cycle, which is a fundamental process in
computer systems. We provided an overview of this cycle and explained the step-by-step process
of fetching and executing instructions. Additionally, we highlighted the crucial role of the control
unit in coordinating and managing the fetch and execution cycle.
We also discussed hardwired control units and micro-programmed control units. We explored the
design principles and implementation of hardwired control units, as well as the generation of
control signals. Furthermore, we delved into micro-programmed control units, exploring the
concept of microcode and its role in controlling instruction execution. We also discussed the
function of the microprogram sequencer in executing micro instructions.
Additionally, we explored control memory, its purpose, organization, and structure. We discussed
how micro instructions are stored and retrieved from control memory, which is a crucial
component of the micro-programmed control unit.
Lastly, we examined the sequencing and execution process in a micro-programmed control unit.
We explained the sequencing process, control flow, and branching in microcode execution. We
also discussed how micro instructions are executed to perform desired operations.
Understanding these concepts is vital for comprehending the inner workings of a computer
system and its control mechanisms. By grasping the fundamental concepts of instructions,
control units, and execution cycles, individuals can gain insights into the functioning and design
principles of computer architectures.

Question Bank
2 Mark Questions
1. What is the role of the control unit in a computer system?
2. Define opcode and explain its significance in an instruction.
3. What are the different components of a micro instruction?
4. Briefly explain the concept of addressing modes in instruction execution.
5. What is the purpose of control memory in a micro-programmed control unit?
6. Define the term "hardwired control unit" and provide an example.
7. What is the function of the program counter in the CPU?
8. Differentiate between fixed-length and variable-length instruction formats.
9. Explain the role of the ALU in performing arithmetic and logical operations.
10. What is the purpose of the microprogram sequencer in a micro-programmed control unit?

5 Mark Questions
1. Discuss the components of an instruction and their respective roles in the execution of a
computer program.
2. Compare and contrast hardwired control units and micro-programmed control units in
terms of design and implementation.
3. Explain the process of instruction fetching and execution in a computer system,
highlighting the role of the control unit.
4. Describe the concept of addressing modes and provide examples of different addressing
modes used in instruction execution.
5. Discuss the significance of instruction types in computer architecture and provide
examples of instruction types in different programming languages.
6. Explain the purpose and organization of control memory in a micro-programmed control
unit.
7. Compare and contrast fixed-length and variable-length instruction formats, discussing
their advantages and disadvantages.
8. Describe the role of the microprogram sequencer in a micro-programmed control unit and
explain its function in executing micro instructions.
9. Discuss the role of the program counter (PC) in the CPU and its importance in the fetch
and execution cycle.
10. Explain the function of the ALU in performing arithmetic and logical operations, and
discuss its impact on overall computer performance.
10 Mark Questions
1. Compare and contrast hardwired control units and micro-programmed control units in
terms of their design principles, implementation, and advantages/disadvantages.
2. Discuss the role of the control unit in a computer system, including its functions in
instruction execution, control signals generation, and coordination of the fetch and
execution cycle.
3. Explain the fetch and execution cycle in a computer system, providing a step-by-step
description of the process and highlighting the involvement of the control unit.
4. Describe the different components of an instruction and their respective roles in the
execution of computer programs, illustrating with examples.
5. Discuss the concept of addressing modes and their significance in instruction execution,
providing examples of different addressing modes and their usage in programming.
6. Explain the importance of instruction types in computer architecture, categorizing them
based on functionality and discussing their impact on program execution and overall
system performance.
7. Describe the purpose and organization of control memory in a micro-programmed control
unit, including the storage and retrieval of micro instructions.
8. Discuss the role of the microprogram sequencer in a micro-programmed control unit,
explaining its function in executing micro instructions and controlling the instruction
flow.
9. Explain the role of the program counter (PC) in the CPU, detailing its function in the
fetch phase of the fetch and execution cycle and its impact on program flow.
10. Discuss the function of the ALU in a computer system, explaining its role in performing
arithmetic and logical operations, and its impact on overall system performance and
efficiency.

You might also like