Computer
Architecture
Lecture 08
Instruction Set
Instructor: Sultana Jahan Soheli
Assistant Professor , ICE, NSTU
Reference Books
• Computer Organization and
Architecture:
Designing for Performance- William
Stallings
(8th Edition)
– Any later edition is fine
Machine Instruction
Characteristics
• Instructions it executes
• The collection of different instructions
that the processor can execute is referred to
as the processor’s instruction set
• 4 Basic elements of an machine instruction
– Operation code
– Source operand reference
– Result operand reference
– Next instruction reference
Elements of a Machine Instruction
• 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
processor where to fetch the next instruction after
the execution of this instruction is complete
Elements of a Machine Instruction
• The address of the next instruction could be either-
– real address or
– a virtual address
• Depends on architecture
• Source and result operands can be in one of four areas:
• Main or virtual memory: As with next instruction references, the main
or virtual memory address must be supplied
• Processor register: With rare exceptions, a processor 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 name or number, and the instruction must contain
the number of the desired register
Elements of a Machine Instruction
• Immediate: The value of the operand is contained in a field
in
the instruction being executed
• 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 virtual
memory address
Instruction Representation
• Each instruction is represented by a sequence of bits, within
a
computer
• The instruction is divided into fields, corresponding to
the constituent elements of the instruction
• Opcodes are represented by abbreviations, called
mnemonics, that indicate the operation
• Some common examples-
ADD Addition
SUB Subtraction
DIV Division
LOAD Load data from memory
STOR Store data to memory
Instruction Representation
• Operands are also represented
symbolically
• Example: ADD R, Y
Instruction Types
• A typical high level instruction
– X = X + Y
• How is it done in low level/machine language?
• A computer should have a set of instructions that allows the user
to formulate any data processing task
• The set of machine instructions must be sufficient to express any of
the instructions from a high-level language
• Basic types-
– Arithmetic instructions
– Logic (Boolean) instructions
– memory instructions
– I/O instructions
– Test instructions
– Branch instructions
Number of Addresses
• Arithmetic and logic instructions will require the most operands
• Virtually all arithmetic and logic operations are either unary (one
source operand) or binary (two source operands)
• Thus, we would need a maximum of two addresses to reference
source operands
• The result of an operation must be stored, suggesting a third
address, which defines a destination operand
• Finally, after completion of an instruction, the next instruction must
be fetched, and its address is needed
• Zero-address instructions are applicable to a special memory
organization,
called a stack
• Fewer addresses per instruction result in instructions that are
more primitive, requiring a less complex processor
Number of Addresses
• The design trade-offs involved in choosing the number of addresses
per instruction are complicated by other factors
• There is the issue of whether an address references a memory location
or a register
• Because there are fewer registers, fewer bits are needed for a
register reference
• Also, as we shall see in the next chapter, a machine may offer a variety
of addressing modes, and the specification of mode takes one or more
bits
• With one-address instructions, the programmer generally has
available only one general-purpose register, the accumulator
• With multiple-address instructions, it is common to have multiple
general
purpose registers
Instruction Set Design
• Most fundamental issues include-
• Operation repertoire: How many and which operations to provide,
and how complex operations should be
• Data types: The various types of data upon which operations
are performed
• Instruction format: Instruction length (in bits), number of addresses,
size of various fields, and so on
• Registers: Number of processor registers that can be referenced
by instructions, and their use
• Addressing: The mode or modes by which the address of an operand
is
specified
Types of Operands
• Important general categories
are-
– Addresses
– Numbers
– Characters
– Logical data
Types of Operations
• General types-
– Data transfer
– Arithmetic
– Logical
– Conversion
– I/O
– System control
– Transfer of control
• Data Transfer: The data transfer instruction must specify several things
– First, the location of the source and destination operands must be specified
– Each location could be memory, a register, or the top of the stack
– Second, the length of data to be transferred must be indicated
– Third, as with all instructions with operands, the mode of addressing for each operand
must be specified
Types of Operations
• System Control
– System control instructions are those that can be executed only while the processor is
in a certain privileged state or is executing a program in a special privileged area
of memory
– Typically, these instructions are reserved for the use of the operating system
• Transfer of Control
• Why required?
1. In the practical use of computers, it is essential to be able to execute
each instruction more than once and perhaps many thousands of times
– It may require thousands or perhaps millions of instructions to
implement an application
– This would be unthinkable if each instruction had to be written out separately
– If a table or a list of items is to be processed, a program loop is needed
– One sequence of instructions is executed repeatedly to process all the data
Types of Operations
2. Virtually all programs involve some decision making
– We would like the computer to do one thing if one condition holds, and
another thing if another condition holds
– For example, a sequence of instructions computes the square root of
a number
– At the start of the sequence, the sign of the number is tested
– If the number is negative, the computation is not performed, but an
error
condition is reported
3. To compose correctly a large or even medium-size
computer program is an exceedingly difficult task
– It helps if there are mechanisms for breaking the task up into smaller
pieces
that can be worked on one at a time
• Most common transfer-of-control operations found in instruction
sets: branch, skip, and procedure call
Branch Instructions
• A branch instruction, also called a jump instruction, has as one of
its operands the address of the next instruction to be executed
• Most often, the instruction is a conditional branch instruction
• That is, the branch is made (update program counter to equal
address specified in operand) only if a certain condition is met
• Otherwise, the next instruction in sequence is executed
(increment program counter as usual)
• A branch instruction
in
unconditional branch
• Two ways of doing this:
which the branch is always taken is an
– First, most machines provide a 1-bit or multiple-bit condition code that is set as
the
result of some operations
– This code can be thought of as a short user-visible register
– BRP X : Branch to location X if result is
positive
– BRN X :Branch to location X if result is
negative
Branch Instructions
• Another approach that can be used with a three-address instruction format is
to perform a comparison and specify a branch in the same instruction
• For example-
• BRE R1, R2, X :Branch to X if contents of R1 = contents of R2
Fig: Branch
Instructions
Skip Instructions
• The skip instruction includes an implied address
• Typically, the skip implies that one instruction
be skipped; thus, the implied address equals
the address of the next instruction plus
one instruction length
• Because the skip instruction does not require
a destination address field, it is free to do
other things
• A typical example is the increment-and-skip-
if- zero (ISZ) instruction
Procedure Call Instructions
• A procedure is a self contained computer program that is
incorporated into a larger program
• At any point in the program the procedure may be
invoked, or called
• Used because of-
– Economy and
– Modularity
• The procedure mechanism involves two basic instructions:
• A call instruction that branches from the present location
to the procedure, and a return instruction that returns
from the procedure to the place from which it was called
– Both of these are forms of branching instructions
Procedure Call Instructions
• Important points:
– A procedure can be called from more
than one
location
– A procedure call can appear in a procedure
• This allows the nesting of procedures to an
arbitrary
depth
– Each procedure call is matched by a return in the
called program
Computer Org Architecture_Lecture 08.pptx
Addressing Techniques
• Depends on trade-off between address range
and/or addressing flexibility, and the number of memory
references in the instruction and/or the complexity of
address calculation
1) Immediate
2) Direct
3) Indirect
4) Register
5) Register indirect
6) Displacement
7) Stack
Addressing Techniques
Addressing Techniques
Addressing Techniques
Addressing Techniques
• Virtually all computer architectures provide
more than one
of these addressing modes
– Often, different opcodes will use different addressing modes
– Also, one or more bits in the instruction format can be used as
a
mode field
• Effective address (EA): In a system without
virtual memory, the effective address will be
either a main memory address or a register
• In a virtual memory system, the effective
address is a virtual address or a register
• The actual mapping to a physical address is
a function of the memory management unit
Thank
you!

More Related Content

PPTX
Computer Architecture Lecture slide 2. course se 222
PPTX
Instruction-Sets-2.pptx
PPT
COA Chapter 3 final edited*Minimum 40 characters required.ppt
PPTX
ITEC582-Chapter 12.pptx
PPTX
Part Four The CPU architecture in .pptx
PPT
Frist slider share
PPT
ch 3_The CPU_modified.ppt of central processing unit
PPTX
COA SEMINAfrdreewqfeeerttfwsreeeeewwR.pptx
Computer Architecture Lecture slide 2. course se 222
Instruction-Sets-2.pptx
COA Chapter 3 final edited*Minimum 40 characters required.ppt
ITEC582-Chapter 12.pptx
Part Four The CPU architecture in .pptx
Frist slider share
ch 3_The CPU_modified.ppt of central processing unit
COA SEMINAfrdreewqfeeerttfwsreeeeewwR.pptx

Similar to Computer Org Architecture_Lecture 08.pptx (20)

PPTX
Lecture 3 instruction set
PPTX
instruction sets (1).pptx
PPTX
Computer architecture instruction formats
PPTX
computer organisation and architecture Module 2.pptx
PPTX
Microprocessors-based systems (under graduate course) Lecture 6 of 9
PDF
Ec 252 ec-252-l10-instruction sets and addressing modes
PPTX
instruction
PPTX
Computer organizations and assembly language
PPTX
Microprocessor design course and Lecture 4
PPTX
instruction format.pptx
PDF
Ch12- instruction sets- char & funct.pdf
PPT
coa Chapter 2 final edited*Minimum 40 characters required.ppt
PPTX
Instruction codes
PPTX
module 3 instruction set and control unit
PPT
IS 139 Lecture 6
PPT
10 Instruction Sets Characteristics
PPTX
Presentation2.pptx vtu computer organization and architectural
PPTX
Lecture004BasicsofthedProcessor (1).pptx
PPTX
Computer Organization and Design.pptx
PPTX
lecture3-instructionset-120307014407-phpapp01.pptx
Lecture 3 instruction set
instruction sets (1).pptx
Computer architecture instruction formats
computer organisation and architecture Module 2.pptx
Microprocessors-based systems (under graduate course) Lecture 6 of 9
Ec 252 ec-252-l10-instruction sets and addressing modes
instruction
Computer organizations and assembly language
Microprocessor design course and Lecture 4
instruction format.pptx
Ch12- instruction sets- char & funct.pdf
coa Chapter 2 final edited*Minimum 40 characters required.ppt
Instruction codes
module 3 instruction set and control unit
IS 139 Lecture 6
10 Instruction Sets Characteristics
Presentation2.pptx vtu computer organization and architectural
Lecture004BasicsofthedProcessor (1).pptx
Computer Organization and Design.pptx
lecture3-instructionset-120307014407-phpapp01.pptx
Ad

Recently uploaded (20)

PPT
Basics Of Pump types, Details, and working principles.
PDF
ST MNCWANGO P2 WIL (MEPR302) FINAL REPORT.pdf
PDF
Module 1 part 1.pdf engineering notes s7
PDF
BTCVPE506F_Module 1 History & Theories of Town Planning.pdf
PDF
The Journal of Finance - July 1993 - JENSEN - The Modern Industrial Revolutio...
PDF
Engineering Solutions for Ethical Dilemmas in Healthcare (www.kiu.ac.ug)
PDF
CBCN cam bien cong nghiep bach khoa da năng
PPTX
Hardware, SLAM tracking,Privacy and AR Cloud Data.
PPTX
INTERNET OF THINGS - EMBEDDED SYSTEMS AND INTERNET OF THINGS
PPT
Unit - I.lathemachnespct=ificationsand ppt
PPTX
MODULE 3 SUSTAINABLE DEVELOPMENT GOALSPPT.pptx
PPTX
22ME926Introduction to Business Intelligence and Analytics, Advanced Integrat...
PPTX
L1111-Important Microbial Mechanisms.pptx
PDF
25AF1191PC303 MODULE-1 CHAIN SURVEYING SEMESTER III SURVEYING
PPT
Module_1_Lecture_1_Introduction_To_Automation_In_Production_Systems2023.ppt
PDF
Application of smart robotics in the supply chain
PPTX
sub station Simple Design of Substation PPT.pptx
PPTX
Unit IILATHEACCESSORSANDATTACHMENTS.pptx
PDF
Recent Trends in Network Security - 2025
PDF
Introduction to Machine Learning -Basic concepts,Models and Description
Basics Of Pump types, Details, and working principles.
ST MNCWANGO P2 WIL (MEPR302) FINAL REPORT.pdf
Module 1 part 1.pdf engineering notes s7
BTCVPE506F_Module 1 History & Theories of Town Planning.pdf
The Journal of Finance - July 1993 - JENSEN - The Modern Industrial Revolutio...
Engineering Solutions for Ethical Dilemmas in Healthcare (www.kiu.ac.ug)
CBCN cam bien cong nghiep bach khoa da năng
Hardware, SLAM tracking,Privacy and AR Cloud Data.
INTERNET OF THINGS - EMBEDDED SYSTEMS AND INTERNET OF THINGS
Unit - I.lathemachnespct=ificationsand ppt
MODULE 3 SUSTAINABLE DEVELOPMENT GOALSPPT.pptx
22ME926Introduction to Business Intelligence and Analytics, Advanced Integrat...
L1111-Important Microbial Mechanisms.pptx
25AF1191PC303 MODULE-1 CHAIN SURVEYING SEMESTER III SURVEYING
Module_1_Lecture_1_Introduction_To_Automation_In_Production_Systems2023.ppt
Application of smart robotics in the supply chain
sub station Simple Design of Substation PPT.pptx
Unit IILATHEACCESSORSANDATTACHMENTS.pptx
Recent Trends in Network Security - 2025
Introduction to Machine Learning -Basic concepts,Models and Description
Ad

Computer Org Architecture_Lecture 08.pptx

  • 1. Computer Architecture Lecture 08 Instruction Set Instructor: Sultana Jahan Soheli Assistant Professor , ICE, NSTU
  • 2. Reference Books • Computer Organization and Architecture: Designing for Performance- William Stallings (8th Edition) – Any later edition is fine
  • 3. Machine Instruction Characteristics • Instructions it executes • The collection of different instructions that the processor can execute is referred to as the processor’s instruction set • 4 Basic elements of an machine instruction – Operation code – Source operand reference – Result operand reference – Next instruction reference
  • 4. Elements of a Machine Instruction • 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 processor where to fetch the next instruction after the execution of this instruction is complete
  • 5. Elements of a Machine Instruction • The address of the next instruction could be either- – real address or – a virtual address • Depends on architecture • Source and result operands can be in one of four areas: • Main or virtual memory: As with next instruction references, the main or virtual memory address must be supplied • Processor register: With rare exceptions, a processor 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 name or number, and the instruction must contain the number of the desired register
  • 6. Elements of a Machine Instruction • Immediate: The value of the operand is contained in a field in the instruction being executed • 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 virtual memory address
  • 7. Instruction Representation • Each instruction is represented by a sequence of bits, within a computer • The instruction is divided into fields, corresponding to the constituent elements of the instruction • Opcodes are represented by abbreviations, called mnemonics, that indicate the operation • Some common examples- ADD Addition SUB Subtraction DIV Division LOAD Load data from memory STOR Store data to memory
  • 8. Instruction Representation • Operands are also represented symbolically • Example: ADD R, Y
  • 9. Instruction Types • A typical high level instruction – X = X + Y • How is it done in low level/machine language? • A computer should have a set of instructions that allows the user to formulate any data processing task • The set of machine instructions must be sufficient to express any of the instructions from a high-level language • Basic types- – Arithmetic instructions – Logic (Boolean) instructions – memory instructions – I/O instructions – Test instructions – Branch instructions
  • 10. Number of Addresses • Arithmetic and logic instructions will require the most operands • Virtually all arithmetic and logic operations are either unary (one source operand) or binary (two source operands) • Thus, we would need a maximum of two addresses to reference source operands • The result of an operation must be stored, suggesting a third address, which defines a destination operand • Finally, after completion of an instruction, the next instruction must be fetched, and its address is needed • Zero-address instructions are applicable to a special memory organization, called a stack • Fewer addresses per instruction result in instructions that are more primitive, requiring a less complex processor
  • 11. Number of Addresses • The design trade-offs involved in choosing the number of addresses per instruction are complicated by other factors • There is the issue of whether an address references a memory location or a register • Because there are fewer registers, fewer bits are needed for a register reference • Also, as we shall see in the next chapter, a machine may offer a variety of addressing modes, and the specification of mode takes one or more bits • With one-address instructions, the programmer generally has available only one general-purpose register, the accumulator • With multiple-address instructions, it is common to have multiple general purpose registers
  • 12. Instruction Set Design • Most fundamental issues include- • Operation repertoire: How many and which operations to provide, and how complex operations should be • Data types: The various types of data upon which operations are performed • Instruction format: Instruction length (in bits), number of addresses, size of various fields, and so on • Registers: Number of processor registers that can be referenced by instructions, and their use • Addressing: The mode or modes by which the address of an operand is specified
  • 13. Types of Operands • Important general categories are- – Addresses – Numbers – Characters – Logical data
  • 14. Types of Operations • General types- – Data transfer – Arithmetic – Logical – Conversion – I/O – System control – Transfer of control • Data Transfer: The data transfer instruction must specify several things – First, the location of the source and destination operands must be specified – Each location could be memory, a register, or the top of the stack – Second, the length of data to be transferred must be indicated – Third, as with all instructions with operands, the mode of addressing for each operand must be specified
  • 15. Types of Operations • System Control – System control instructions are those that can be executed only while the processor is in a certain privileged state or is executing a program in a special privileged area of memory – Typically, these instructions are reserved for the use of the operating system • Transfer of Control • Why required? 1. In the practical use of computers, it is essential to be able to execute each instruction more than once and perhaps many thousands of times – It may require thousands or perhaps millions of instructions to implement an application – This would be unthinkable if each instruction had to be written out separately – If a table or a list of items is to be processed, a program loop is needed – One sequence of instructions is executed repeatedly to process all the data
  • 16. Types of Operations 2. Virtually all programs involve some decision making – We would like the computer to do one thing if one condition holds, and another thing if another condition holds – For example, a sequence of instructions computes the square root of a number – At the start of the sequence, the sign of the number is tested – If the number is negative, the computation is not performed, but an error condition is reported 3. To compose correctly a large or even medium-size computer program is an exceedingly difficult task – It helps if there are mechanisms for breaking the task up into smaller pieces that can be worked on one at a time • Most common transfer-of-control operations found in instruction sets: branch, skip, and procedure call
  • 17. Branch Instructions • A branch instruction, also called a jump instruction, has as one of its operands the address of the next instruction to be executed • Most often, the instruction is a conditional branch instruction • That is, the branch is made (update program counter to equal address specified in operand) only if a certain condition is met • Otherwise, the next instruction in sequence is executed (increment program counter as usual) • A branch instruction in unconditional branch • Two ways of doing this: which the branch is always taken is an – First, most machines provide a 1-bit or multiple-bit condition code that is set as the result of some operations – This code can be thought of as a short user-visible register – BRP X : Branch to location X if result is positive – BRN X :Branch to location X if result is negative
  • 18. Branch Instructions • Another approach that can be used with a three-address instruction format is to perform a comparison and specify a branch in the same instruction • For example- • BRE R1, R2, X :Branch to X if contents of R1 = contents of R2 Fig: Branch Instructions
  • 19. Skip Instructions • The skip instruction includes an implied address • Typically, the skip implies that one instruction be skipped; thus, the implied address equals the address of the next instruction plus one instruction length • Because the skip instruction does not require a destination address field, it is free to do other things • A typical example is the increment-and-skip- if- zero (ISZ) instruction
  • 20. Procedure Call Instructions • A procedure is a self contained computer program that is incorporated into a larger program • At any point in the program the procedure may be invoked, or called • Used because of- – Economy and – Modularity • The procedure mechanism involves two basic instructions: • A call instruction that branches from the present location to the procedure, and a return instruction that returns from the procedure to the place from which it was called – Both of these are forms of branching instructions
  • 21. Procedure Call Instructions • Important points: – A procedure can be called from more than one location – A procedure call can appear in a procedure • This allows the nesting of procedures to an arbitrary depth – Each procedure call is matched by a return in the called program
  • 23. Addressing Techniques • Depends on trade-off between address range and/or addressing flexibility, and the number of memory references in the instruction and/or the complexity of address calculation 1) Immediate 2) Direct 3) Indirect 4) Register 5) Register indirect 6) Displacement 7) Stack
  • 27. Addressing Techniques • Virtually all computer architectures provide more than one of these addressing modes – Often, different opcodes will use different addressing modes – Also, one or more bits in the instruction format can be used as a mode field • Effective address (EA): In a system without virtual memory, the effective address will be either a main memory address or a register • In a virtual memory system, the effective address is a virtual address or a register • The actual mapping to a physical address is a function of the memory management unit