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

Computer Architecture and Peripherals

Uploaded by

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

Computer Architecture and Peripherals

Uploaded by

thisistherobbary
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 45

4.

Instruction Sets
Unit 4 Instruction Sets
• Characteristics and Functions-machine instruction
characteristics
• Types of operands
• Characteristics of Instruction set
• Instruction format of different microprocessors
• Reduced instruction set computer (RISC).
• Complex Instruction Set Computer (CISC)
• Comparison of RISC and CISC parallel processing.

11/08/2024 05:12 PM 2
Instruction Sets
• An instruction set is a collection of instructions or
commands that a computer processor can
understand and execute.
• These instructions are represented as binary codes
that are stored in memory and are fetched by the
processor to perform a specific operation.
• Each instruction in the instruction set represents a
specific operation that the processor can perform,
such as arithmetic operations, logical operations,
memory operations, and control operations.

11/08/2024 05:12 PM 3
Instruction Sets
• The instruction set architecture (ISA) defines the
specifications and formats of the instructions in the
set, including the number of operands, the size of the
operands, and the order of execution.
• The instruction set is a fundamental component of a
computer's architecture and determines the type
and range of operations that the processor can
perform.

11/08/2024 05:12 PM 4
Elements of an Instruction
Each instruction must have elements that contain the information
required by the CPU for execution. These elements are as follows.
• Operation code: Specifies the operation to be performed (e.g.,
ADD, I/O). The operation is specified by a binary code, known as
the operation code, or opcode.
• Source operand reference: The operation may involve one or
more source operands, that is, operands that are inputs for the
operation.
• Result operand reference: The operation may produce a result.

• Next instruction reference: This tells the CPU where to fetch the
next instruction after the execution of this instruction is complete.
Cont..
The next instruction to be fetched is in main memory or, in the case of a
virtual memory system, in either main memory or secondary memory (disk).
In most cases, the next instruction to be fetched immediately follows the
current instruction. In those cases, there is no explicit reference to the next
instruction.
Source and result operands can be in one of three areas:

• Main or virtual memory: As with next instruction references, the main or

virtual memory address must be supplied.

• CPU register: With rare exceptions, a CPU contains one or more registers

that may be referenced by machine instructions. If only one register

exists, reference to it may be implicit. If more than one register exists,

then each register is assigned a unique number, and the instruction must

contain the number of the desired register.

• I/O device: The instruction must specify (the I/O module and device for

the operation. If memory mapped I/O is used, this is just another main or
Types of Operands
• Computer instruction is a binary code that determines the micro-operations in a sequence for a

computer.

• They are saved in the memory along with the information. Each computer has its specific group

of instructions.

• They can be categorized into two elements as Operation codes (Opcodes) and Address.

• Opcodes specify the operation for specific instructions, and an address determines the registers

or the areas used for that operation.

• Operands are definite elements of computer instruction that show what information is to be

operated on. The most important general categories of data are

1. Addresses

2. Numbers

3. Characters

4. Logical data
1. Addresses:
• Addresses are nothing but a form of data. Here some calculations
must be performed on the operand reference in an instruction,
which is to determine the physical address of an instruction.

2. Numbers:
• All machine languages include numeric data types. Even in non-
numeric data processing, numbers are needed to act as counters,
field widths, etc. An important difference between numbers used in
ordinary mathematics and numbers stored in a computer is that the
latter is limited. Thus, the programmer is faced with understanding
the consequences of rounding, overflow and underflow.
3. Characters:
• A common form of data is text or character strings. While textual
data are most convenient for humans. But computers work in
binary. So, all characters, whether letters, punctuation or digits, are
stored as binary numbers. All of the characters that a computer can
use are called character sets. Here are the two common standards,
such as:

• American Standard Code for Information Interchange (ASCII)

• Unicode
4. Logical data
• Normally, each word or other addressable unit (byte, half-word, and so on)

is treated as a single unit of data. Sometimes, it is useful to consider an n-bit

unit consisting of 1-bit items of data, each item having the value 0 or 1.

When data are viewed this way, they are considered to be logical data.

• The Boolean data can only represent two values: true or false. Although

only two values are possible, they are rarely implemented as a single binary

digit for efficiency reasons. Many programming languages do not have an

explicit Boolean type, instead of interpreting 0 as false and other values as

true. Boolean data refers to the logical structure of how the language is

interpreted to the machine language. In this case, a Boolean 0 refers to the


Instruction Representation
• Within the computer, each instruction is represented by a
sequence of bits.
• The instruction is divided into fields, corresponding to the
constituent elements of the instruction.
• During instruction execution, an instruction is read into an
instruction register (IR) in the CPU.
• The CPU must be able to extract the data from the various
instruction fields to perform the required operation.
• It is difficult for both the programmer and the reader of textbooks
to deal with binary representations of machine instructions.
• Thus, it has become common
practice to use a symbolic
representation of machine
instructions.
• Opcodes are represented by
abbreviations, called
mnemonics, that indicate the
operation.
• Common examples include.
• A simple example of an instruction format is shown in the figure.

• In machine code each instruction has a unique bit pattern.


• For human consumption (programmers) a symbolic
representation of machine instructions is used.
• Opcodes are represented by abbreviations, called mnemonics,
that indicate the operation.
Parts Of Instruction Format
The parts of the instruction format are:

• 1. Addressing Mode

• The data is represented in the instruction format with the help of addressing mode

• The addressing mode is the first part of the instruction format

• The data can either be stored in the memory of a computer or it can be located in the register

of the CPU

• 2. Operation Code( OPCODE)

• The operation code gives instructions to the processor to perform the specific Operation

• The operation code is the second part of the instruction format

• 3. OPERAND

• It is the part of the instruction format that specifies the data or the address of the data

• Depending upon the processor of the computer the instruction format contains zero to three
For example, the instruction
ADD R, Y
• (R <--R + Y ) may mean add the value contained in data
location Y to the contents of register R.
• In this example, Y refers to the address of a location in
memory, and R refers to a particular register.
• Note that the operation is performed on the contents of
a location, not on its address.
Format Of Instruction
• The set of instructions that manages the operation codes is called
the format of instruction.
• The design of bits in instruction is supported by the format of
instruction.
• The length of instruction is generally preserved in multiples of
character, which is 8 bits.
• The instruction format determines the behavior and complexity of
instruction.
• Depending upon the number of addresses, the format of
instruction is of variable length.
Types of instruction format include:
• Zero(0) Address Instruction format
• One(1) Address Instruction format
• Two(2) Address Instruction format
• Three(3) Address Instruction format
1. Zero(0) Address Instruction format
• The instruction format in which there is no address
field is called zero address instruction
• In zero address instruction format, stacks are used
• In zero order instruction format, there is no operand

Example:
• Assembly language instruction – PUSH A, PUSH B etc.
• Stack transfer operation – TOS <- A, TOS <- B etc.
2. One(1) Address Instruction format
• The instruction format in which the instruction uses only one address field
is called the one address instruction format

• In this type of instruction format, one operand is in the accumulator and


the other is in the memory location

• It has only one operand

• It has two special instructions LOAD and STORE

Example:

• Assembly language instruction – LOAD C, ADD B, STORE T etc.

• Operation Register instruction – AC <- M[T], AC <- M[C] etc.


3. Two(2) Address Instruction format
• The instruction format in which the instruction uses only two address fields is

called the two address instruction format

• This type of instruction format is the most commonly used instruction format

• As in one address instruction format, the result is stored in the accumulator only,

but in two addresses instruction format the result can be stored in different

locations

• This type of instruction format has two operands

• It requires shorter assembly language instructions

Example:

• Assembly language instruction – MOV R1, A; ADD R1, B etc.


4. Three(3) Address Instruction format
• The instruction format in which the instruction uses the three

address fields is called the three address instruction format

• It has three operands

• It requires shorter assembly language instructions

• It requires more bits

Example:

• Assembly language instruction – ADD R1, A, B etc.

• Operation Register instruction – R1 <- M[A] + M[B] etc.


Instruction Type
There are several types of instructions that can be included in an instruction set. Here are

some common types of instructions:

• 1. Data transfer instructions: These instructions move data between memory and

registers or between registers. Examples of data transfer instructions include MOV

(move), LOAD, STORE, PUSH, and POP.

• 2. Arithmetic and logical instructions: These instructions perform arithmetic and

logical operations on data stored in registers or memory. Examples of arithmetic

instructions include ADD (addition), SUB (subtraction), MUL (multiplication), and DIV

(division). Logical instructions include AND, OR XOR, and NOT.

• 3. Control transfer instructions: These instructions change the sequence of execution

of instructions by transferring control to other instructions. Examples of control transfer

instructions include JMP (jump), CALL, RETURN, and LOOP.


Instruction Type
• 4. System instructions: These instructions are used to interact with the system

hardware and perform privileged operations. Examples of system instructions

include HALT (stop), RESET, and INT (interrupt).

• 5. Floating-point instructions: These instructions are used to perform

arithmetic operations on floating-point numbers. Examples of floating-point

instructions include FADD, FSUB, FMUL, and FDIV.

• The type and number of instructions included in an instruction set depend on the

intended application and the architecture of the processor. An instruction set

may include a subset of these instruction types or may include additional

specialized instructions depending on the requirements of the intended

application.
Types of Operation in Instruction Set
An instruction set architecture (ISA) may support different types of operations,

depending on the intended application and the architecture of the processor. Here

are some common types of operations that can be supported:

• Arithmetic operations: These operations perform mathematical calculations on

data stored in registers or memory. Examples include addition, subtraction,

multiplication, division, and bitwise operations.

• Logic operations: These operations perform logical operations on data stored in

registers or memory. Examples include logical AND, logical OR, logical XOR, and

logical NOT.

• Memory operations: These operations read or write data from or to memory

locations. Examples include load, store, push, and pop instructions.


Types of Operation in Instruction Set
• Control operations: These operations change the flow of execution of the

program. Examples include jump, call, return, interrupt, and halt

instructions.

• Input/output operations: These operations allow the processor to interact

with external devices, such as keyboards, displays, and storage devices.

Examples include input and output instructions, such as IN and OUT.

• Floating-point operations: These operations perform mathematical

calculations on floating-point numbers. Examples include addition,

subtraction, multiplication, and division instructions for floating-point

numbers.
Functions of Instruction Set
The instruction set architecture (ISA) is a critical component of a computer system,

and the functions of an instruction set are to define the capabilities and behavior of

the processor. Here are some of the primary functions of an instruction set:

• Define the instruction format: The instruction set defines the format of

instructions, including the opcode (operation code) and any operands required for

the instruction. This allows the processor to decode and execute instructions

correctly.

• Define the instruction set encoding: The instruction set also defines the encoding

of instructions, which determines how instructions are represented in binary

format. This includes the number of bits used for each part of the instruction and

the order in which the bits are arranged.


Functions of Instruction Set
• Provide the instruction execution semantics: The instruction set defines

the meaning and behavior of each instruction. This includes the types of

operations that can be performed, the format of operands, the order of

execution, and the effects on processor state.

• Enable the development of compilers and assemblers: An instruction set

provides a standardized interface for compilers and assemblers to generate

machine code for the processor. This allows programmers to write

programs in high-level languages, which are then translated into machine

code for execution.


Functions of Instruction Set
• Support software development tools: An instruction set enables the

development of software development tools, such as debuggers and

profilers, which are used to analyze and optimize programs running on

the processor.

• Enable backward compatibility: An instruction set can be designed to

provide backward compatibility with previous versions of the ISA. This

allows older software to run on newer processors without modification.

The functions of an instruction set are critical in determining the capabilities

and performance of a processor, and careful consideration of the instruction

set design is necessary to meet the requirements of the intended


Characteristics of Instruction set
The characteristics of an instruction set architecture (ISA) define the

capabilities and behavior of the processor. Here are some common

characteristics of an ISA:
• Word size: The word size defines the number of bits used to represent data

in the processor's registers and memory. Common word sizes include 8-bit,

16-bit, 32-bit, and 64-bit.

• Instruction set encoding: The instruction set encoding determines how

instructions are represented in binary format, including the number of bits

used for each part of the instruction and the order in which the bits are
Characteristics of Instruction set
• Number of registers: The number of registers available to the processor can

affect its performance and capabilities. More registers can reduce the need

for memory accesses, which can improve performance.

• Addressing modes: The addressing modes supported by the processor

define how the processor accesses memory to fetch or store operands for

instructions. Common addressing modes include immediate, direct,

register, indexed, and indirect.

• Endianness: Endianness defines the order in which the bytes of a multi-

byte word are stored in memory. Little-endian systems store the least

significant byte first, while big-endian systems store the most significant
Characteristics of Instruction set
• Instruction format: The instruction format defines the structure of

instructions, including the opcode (operation code) and any operands

required for the instruction.

• Instruction execution semantics: The instruction execution semantics

define the behavior of each instruction, including the types of

operations that can be performed, the format of operands, the order of

execution, and the effects on processor state.

• Special instructions: Some ISAs may include special-purpose instructions

that provide additional capabilities or performance improvements for

specific tasks.
ISA Classification
• Complex Instruction Set Computer(CISC)
• Reduced Instruction Set Computer(RISC)

11/08/2024 05:12 PM 32
Reduced Instruction Set Architecture (RISC)

The main idea behind this is to make hardware simpler by


using an instruction set composed of a few basic steps for
loading, evaluating, and storing operations just like a load
command will load data, a store command will store the data.
Complex Instruction Set Architecture (CISC)
The main idea is that a single instruction will do all loading,
evaluating, and storing operations just like a multiplication
command will do stuff like loading data, evaluating, and
storing it, hence it’s complex.
Examples :
IBM 360/370 1960-1970
VAX -11/780 1970-1980
Intel x86/Pentium 1985-present
CPU performance
• RISC: Reduce the cycles per instruction at the
cost of the number of instructions per
program.
• CISC: The CISC approach attempts to minimize
the number of instructions per program but at
the cost of an increase in the number of cycles
per instruction.
Characteristic of RISC
• Simpler instruction, hence simple instruction
decoding.
• Instruction comes undersize of one word.
• Instruction takes a single clock cycle to get
executed.
• More general-purpose registers.
• Simple Addressing Modes.
• Fewer Data types.
• A pipeline can be achieved.
Characteristic of CISC

• Complex instruction, hence complex instruction decoding.

• Instructions are larger than one-word size.

• Instruction may take more than a single clock cycle to get


executed.

• Less number of general-purpose registers as operations get


performed in memory itself.

• Complex Addressing Modes.


Example – Suppose we have to add two 8-bit numbers:

• CISC approach: There will be a single command or


instruction for this like ADD which will perform the
task.
• RISC approach: Here programmer will write the
first load command to load data in registers then it
will use a suitable operator and then it will store
the result in the desired location.
Advantages of RISC
1. Simpler instructions: RISC processors use a smaller set of simple
instructions, which makes them easier to decode and execute quickly.
This results in faster processing times.

2. Faster execution: Because RISC processors have a simpler instruction


set, they can execute instructions faster than CISC processors.

3. Lower power consumption: RISC processors consume less power


than CISC processors, making them ideal for portable devices.
Disadvantages of RISC

1. More instructions required: RISC processors require more


instructions to perform complex tasks than CISC processors.

2. Increased memory usage: RISC processors require more memory


to store the additional instructions needed to perform complex
tasks.

3. Higher cost: Developing and manufacturing RISC processors can


be more expensive than CISC processors.
Advantages of CISC
1. Reduced code size: CISC processors use complex

instructions that can perform multiple operations, reducing

the amount of code needed to perform a task.

2. More memory efficient: Because CISC instructions are more

complex, they require fewer instructions to perform complex

tasks, which can result in more memory-efficient code.

3. Widely used: CISC processors have been in use for a longer

time than RISC processors, so they have a larger user base and
Disadvantages of CISC
1.Slower execution: CISC processors take longer to execute instructions

because they have more complex instructions and need more time to

decode them.

2. More complex design: CISC processors have more complex instruction

sets, which makes them more difficult to design and manufacture.

3. Higher power consumption: CISC processors consume more power


RISC Vs. CISC
RISC CISC

Focus on software Focus on hardware

Uses both hardwired and micro-


Uses only Hardwired control unit programmed control unit

Transistors are used for storing complex


Transistors are used for more registers Instructions

Fixed sized instructions Variable sized instructions

Can perform only Register to Register Can perform REG to REG or REG to MEM
Arithmetic operations or MEM to MEM

Requires more number of registers Requires less number of registers


RISC CISC

Code size is large Code size is small

An instruction executed in a single Instruction takes more than one clock


clock cycle cycle

An instruction fit in one word. Instructions are larger than the size of
one word

Simple and limited addressing


modes. Complex and more addressing modes.

RISC is Reduced Instruction Cycle. CISC is Complex Instruction Cycle.

The number of instructions are less as The number of instructions are more
compared to CISC. as compared to RISC.
RISC CISC

It consumes the low power. It consumes more/high power.

RISC is highly pipelined. CISC is less pipelined.

RISC required more RAM. CISC required less RAM.

Here, Addressing modes are less. Here, Addressing modes are more.

You might also like