SlideShare a Scribd company logo
INSTRUCTION SET
ARCHITECTURE
1
LECTURE THREE
INSTRUCTION TYPES
2
The following are the categories of
instructions:
 Data movement
 Arithmetic
 Boolean
 Bit manipulation (shift and rotate)
 I/O
Transfer of control
Special purpose
INSTRUCTION TYPES cont…
 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, the mode of addressing for each operand
must be specified.
3
INSTRUCTION TYPES cont…
 In terms of processor action, data transfer
operations are perhaps the simplest type.
 If both source and destination are registers,
then the processor simply causes data to be
transferred from one register to another;
this is an operation internal to the
processor.
4
INSTRUCTION TYPES cont…
 If one or both operands are in memory, then the processor
must perform some or all of the following actions:
1. Calculate the memory address, based on the address
mode
2. If the address refers to virtual memory, translate from
virtual to real memory address.
3. Determine whether the addressed item is in cache.
4. If not, issue a command to the memory module.
5
Common Data Movement Operations
6
INSTRUCTION TYPES cont…
7
 Arithmetic operations include those
instructions that use integers and floating
point numbers.
 Many instruction sets provide different
arithmetic instructions for various data
sizes.
Common Arithmetic Operations
8
INSTRUCTION TYPES cont…
9
 Boolean logic instructions perform
Boolean operations, much in the same way
that arithmetic operations work.
 There are typically instructions for
performing AND, NOT, and often OR and
XOR operations.
Common Logical Operations
10
INSTRUCTION TYPES cont…
 The arithmetic shift operation treats the data as a signed
integer and does not shift the sign bit.
 On a right arithmetic shift, the sign bit is replicated into
the bit position to its right.
 On a left arithmetic shift, a logical left shift is performed
on all bits but the sign bit, which is retained.
 Rotate, or cyclic shift, operations preserve all of the bits
being operated on.
 One use of a rotate is to bring each bit successively into
the leftmost bit, where it can be identified by testing the
sign of the data (treated as a number).
11
INSTRUCTION TYPES cont…
12
INSTRUCTION TYPES cont…
13
 Bit manipulation instructions are used
for setting and resetting individual bits (or
sometimes groups of bits) within a given
data word.
 These include both arithmetic and logical
shift instructions and rotate instructions,
both to the left and to the right.
INSTRUCTION TYPES cont…
14
Input and output instructions (I/O
instructions) are used to transfer data between
the computer and peripheral devices.
The two basic I/O instructions used are the INPUT
and OUTPUT instructions.
INPUT instruction is used to transfer data from an
input device to the processor.
Examples of input devices include a keyboard or a
mouse.
INSTRUCTION TYPES cont…
15
 Input devices are interfaced with a
computer through dedicated input ports.
 Computers can use dedicated addresses to
address these ports.
 Suppose that the input port through which
a keyboard is connected to a computer
carries the unique address 1000.
INSTRUCTION TYPES cont…
16
 Execution of the instruction INPUT 1000
will cause the data stored in a specific
register in the interface between the
keyboard and the computer, call it the input
data register, to be moved into a specific
register (called the accumulator) in the
computer.
INSTRUCTION TYPES cont…
17
 Similarly, the execution of the instruction
OUTPUT 2000 causes the data stored in the
accumulator to be moved to the data output
register in the output device whose address
is 2000.
INSTRUCTION TYPES cont…
18
 Alternatively, the computer can address
these ports in the usual way of addressing
memory locations.
 In this case, the computer can input data
from an input device by executing an
instruction such as MOVE Rin, R0.
 This instruction moves the content of the
register Rin into the register R0.
INSTRUCTION TYPES cont…
19
 Similarly, the instruction MOVE R0, Rin
moves the contents of register R0 into the
register Rin, that is, performs an output
operation.
INSTRUCTION TYPES cont…
20
Control (sequencing) instructions are used to
change the sequence in which instructions are
executed.
They take the form of CONDITIONAL BRANCHING
(CONDITIONAL JUMP), UNCONDITIONAL
BRANCHING (JUMP), or CALL instructions.
A common characteristic among these instructions
is that their execution changes the program
counter (PC) value.
INSTRUCTION TYPES cont…
21
 The change made in the PC value can be
unconditional, for example, in the
unconditional branching or the jump
instructions.
 In this case, the earlier value of the PC is
lost and execution of the program starts at a
new value specified by the instruction.
INSTRUCTION TYPES cont…
22
The change made in the PC by the branching
instruction can be conditional based on the value of
a specific flag.
Examples of these flags include the Negative (N),
Zero (Z), Overflow (V), and Carry (C).
These flags represent the individual bits of a
specific register, called the CONDITION CODE (CC)
REGISTER.
 The values of flags are set based on the results of
executing different instruction
Examples of Condition Flags
23
Transfer of Control Operations
24
ADDRESSING
25
 There are two most important addressing
issues: the types of data that can be
addressed and the various addressing
modes.
Data Types
26
 Numeric data consists of integers and floating
point values.
 Integers can be signed or unsigned and can be
declared in various lengths.
For example, in C++ integers can be short
(16 bits), int (the word size of the given
architecture), or long (32 bits).
 Floating point numbers have lengths of 32, 64, or
128 bits.
Data Types cont…
27
Nonnumeric data types consist of strings,
Booleans, and pointers.
 String instructions typically include
operations such as copy, move, search, or
modify.
Boolean operations include AND, OR, XOR,
and NOT.
Pointers are actually addresses in memory.
Address Modes
28
Addressing modes allow us to specify where the
instruction operands are located.
An addressing mode can specify a constant, a
register, or a location in memory.
Certain modes allow shorter addresses and
some allow us to determine the location of the
actual operand, often called the effective address
of the operand, dynamically.
Basic Addressing Modes
29
Immediate Addressing : the data to be
operated on is part of the instruction.
 For example, if the instruction is Load 008,
the numeric value 8 is loaded into the AC.
 The 12 bits of the operand field do not
specify an address— they specify the actual
operand the instruction requires.
Basic Addressing Modes cont…
30
 Advantage: no memory reference other
than the instruction fetch is required to
obtain the operand, thus saving one memory
or cache cycle in the instruction cycle.
 Disadvantage: is that the size of the
number is restricted to the size of the
address field, which, in most instruction sets,
is small compared with the word length.
Basic Addressing Modes cont…
31
Direct Addressing: the value to be
referenced is obtained by specifying its
memory address directly in the instruction.
 For example, the instruction is Load 008,
the data value found at memory address 008
is loaded into the AC.
Is typically quite fast because, although the
value to be loaded is not included in the
instruction, it is quickly accessible.
Basic Addressing Modes cont…
32
It is also much more flexible than immediate
addressing because the value to be loaded is whatever
is found at the given address, which may be variable.
The obvious limitation is that it provides only a limited
address space.
Register Addressing :a register, instead of memory, is
used to specify the operand.
 This is very similar to direct addressing, except that
instead of a memory address, the address field contains
a register reference.
The contents of that register are used as the operand.
Basic Addressing Modes cont…
33
Indirect Addressing: the bits in the address
field specify a memory address that is to be
used as a pointer.
 The effective address of the operand is
found by going to this memory address.
 For example, the instruction is Load 008,
the data value found at memory address 008
is actually the effective address of the
desired operand.
Basic Addressing Modes cont…
34
 Suppose we find the value 2A0 stored in
location 008.
 2A0 is the “real” address of the value we
want.
 The value found at location 2A0 is then
loaded into the AC.
Basic Addressing Modes cont…
35
 In a variation on this scheme, the operand bits
specify a register instead of a memory address,
this mode is called register indirect addressing,
works exactly the same way as indirect addressing
mode, except it uses a register instead of a
memory address to point to the data.
 For example, if the instruction is Load R1, we
would find the effective address of the desired
operand in R1.
Basic Addressing Modes cont…
36
Index addressing mode, the address of the
operand is obtained by adding a constant to the
content of a register, called the index register.
 Consider, for example, the instruction LOAD
X(Rind), Ri.
 This instruction loads register Ri with the
contents of the memory location whose address is
the sum of the contents of register Rind and the
value X.
Basic Addressing Modes cont…
37
 Index addressing is indicated in the
instruction by including the name of the
index register in parentheses and using the
symbol X to indicate the constant to be
added.
Illustration of the indexed addressing mode
38
Example
39
 Suppose we have the instruction Load 800, and
the memory and register R1 shown:
40
Tutorial
 MIPS ARCHITECTURES
 PROGRAMMING EXAMPLES (From the book
“fundamentals of computer organization”)
41

More Related Content

PPTX
Lec 10 Assembly Language in computer organization and Assembly language .pptx
PPT
microprocessor and microcontroller notes ppt
PPTX
instruction sets (1).pptx
PPTX
module 3 instruction set and control unit
PPTX
PPT
addressingmodes8051.ppt
PPTX
Module 3.1_Instruction Types and Addressing modes.pptx
PPTX
Unit-1_Processor_Basic Cpu_Organization.pptx
Lec 10 Assembly Language in computer organization and Assembly language .pptx
microprocessor and microcontroller notes ppt
instruction sets (1).pptx
module 3 instruction set and control unit
addressingmodes8051.ppt
Module 3.1_Instruction Types and Addressing modes.pptx
Unit-1_Processor_Basic Cpu_Organization.pptx

Similar to Computer organization and Architecture-UDOM (20)

PPT
Lecture_4__8051_Instruction_Set__Rv01.ppt
PPT
COA Chapter 3 final edited*Minimum 40 characters required.ppt
PDF
8051 instruction set
PPT
ch 3_The CPU_modified.ppt of central processing unit
PDF
Lecture 4 (8051 instruction set) rv01
PPT
(246431835) instruction set principles (2) (1)
PPT
Microcontroller instruction set
PDF
BISWAJIT ADHIKARI_28101623024_PC EE 602.pdf
PPTX
Mastering Assembly Language: Programming with 8086
PDF
COMPUTER ORGANIZATION NOTES Unit 2
PPTX
instruction format.pptx
PPTX
Computer organization and architecture
PPT
8051 instruction_set.ppt
DOCX
PDF
Instruction execution cycle _
PPT
unit-3-L1.ppt
PPT
Addressing modes of 8051
PPTX
computer organisation and architecture Module 2.pptx
PDF
Lecture6.pdf computer architecture for computer science
PPT
instruction_set_8051_microcontroller.ppt
Lecture_4__8051_Instruction_Set__Rv01.ppt
COA Chapter 3 final edited*Minimum 40 characters required.ppt
8051 instruction set
ch 3_The CPU_modified.ppt of central processing unit
Lecture 4 (8051 instruction set) rv01
(246431835) instruction set principles (2) (1)
Microcontroller instruction set
BISWAJIT ADHIKARI_28101623024_PC EE 602.pdf
Mastering Assembly Language: Programming with 8086
COMPUTER ORGANIZATION NOTES Unit 2
instruction format.pptx
Computer organization and architecture
8051 instruction_set.ppt
Instruction execution cycle _
unit-3-L1.ppt
Addressing modes of 8051
computer organisation and architecture Module 2.pptx
Lecture6.pdf computer architecture for computer science
instruction_set_8051_microcontroller.ppt
Ad

Recently uploaded (20)

PPTX
master seminar digital applications in india
PPTX
Lesson notes of climatology university.
PPTX
History, Philosophy and sociology of education (1).pptx
PPTX
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
PDF
What if we spent less time fighting change, and more time building what’s rig...
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PPTX
202450812 BayCHI UCSC-SV 20250812 v17.pptx
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PDF
Weekly quiz Compilation Jan -July 25.pdf
PPTX
Cell Types and Its function , kingdom of life
PDF
A systematic review of self-coping strategies used by university students to ...
PDF
LNK 2025 (2).pdf MWEHEHEHEHEHEHEHEHEHEHE
PDF
Paper A Mock Exam 9_ Attempt review.pdf.
PDF
Updated Idioms and Phrasal Verbs in English subject
PDF
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
PDF
Practical Manual AGRO-233 Principles and Practices of Natural Farming
DOC
Soft-furnishing-By-Architect-A.F.M.Mohiuddin-Akhand.doc
PDF
Microbial disease of the cardiovascular and lymphatic systems
PPTX
UV-Visible spectroscopy..pptx UV-Visible Spectroscopy – Electronic Transition...
PDF
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
master seminar digital applications in india
Lesson notes of climatology university.
History, Philosophy and sociology of education (1).pptx
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
What if we spent less time fighting change, and more time building what’s rig...
Final Presentation General Medicine 03-08-2024.pptx
202450812 BayCHI UCSC-SV 20250812 v17.pptx
2.FourierTransform-ShortQuestionswithAnswers.pdf
Weekly quiz Compilation Jan -July 25.pdf
Cell Types and Its function , kingdom of life
A systematic review of self-coping strategies used by university students to ...
LNK 2025 (2).pdf MWEHEHEHEHEHEHEHEHEHEHE
Paper A Mock Exam 9_ Attempt review.pdf.
Updated Idioms and Phrasal Verbs in English subject
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
Practical Manual AGRO-233 Principles and Practices of Natural Farming
Soft-furnishing-By-Architect-A.F.M.Mohiuddin-Akhand.doc
Microbial disease of the cardiovascular and lymphatic systems
UV-Visible spectroscopy..pptx UV-Visible Spectroscopy – Electronic Transition...
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
Ad

Computer organization and Architecture-UDOM

  • 2. INSTRUCTION TYPES 2 The following are the categories of instructions:  Data movement  Arithmetic  Boolean  Bit manipulation (shift and rotate)  I/O Transfer of control Special purpose
  • 3. INSTRUCTION TYPES cont…  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, the mode of addressing for each operand must be specified. 3
  • 4. INSTRUCTION TYPES cont…  In terms of processor action, data transfer operations are perhaps the simplest type.  If both source and destination are registers, then the processor simply causes data to be transferred from one register to another; this is an operation internal to the processor. 4
  • 5. INSTRUCTION TYPES cont…  If one or both operands are in memory, then the processor must perform some or all of the following actions: 1. Calculate the memory address, based on the address mode 2. If the address refers to virtual memory, translate from virtual to real memory address. 3. Determine whether the addressed item is in cache. 4. If not, issue a command to the memory module. 5
  • 6. Common Data Movement Operations 6
  • 7. INSTRUCTION TYPES cont… 7  Arithmetic operations include those instructions that use integers and floating point numbers.  Many instruction sets provide different arithmetic instructions for various data sizes.
  • 9. INSTRUCTION TYPES cont… 9  Boolean logic instructions perform Boolean operations, much in the same way that arithmetic operations work.  There are typically instructions for performing AND, NOT, and often OR and XOR operations.
  • 11. INSTRUCTION TYPES cont…  The arithmetic shift operation treats the data as a signed integer and does not shift the sign bit.  On a right arithmetic shift, the sign bit is replicated into the bit position to its right.  On a left arithmetic shift, a logical left shift is performed on all bits but the sign bit, which is retained.  Rotate, or cyclic shift, operations preserve all of the bits being operated on.  One use of a rotate is to bring each bit successively into the leftmost bit, where it can be identified by testing the sign of the data (treated as a number). 11
  • 13. INSTRUCTION TYPES cont… 13  Bit manipulation instructions are used for setting and resetting individual bits (or sometimes groups of bits) within a given data word.  These include both arithmetic and logical shift instructions and rotate instructions, both to the left and to the right.
  • 14. INSTRUCTION TYPES cont… 14 Input and output instructions (I/O instructions) are used to transfer data between the computer and peripheral devices. The two basic I/O instructions used are the INPUT and OUTPUT instructions. INPUT instruction is used to transfer data from an input device to the processor. Examples of input devices include a keyboard or a mouse.
  • 15. INSTRUCTION TYPES cont… 15  Input devices are interfaced with a computer through dedicated input ports.  Computers can use dedicated addresses to address these ports.  Suppose that the input port through which a keyboard is connected to a computer carries the unique address 1000.
  • 16. INSTRUCTION TYPES cont… 16  Execution of the instruction INPUT 1000 will cause the data stored in a specific register in the interface between the keyboard and the computer, call it the input data register, to be moved into a specific register (called the accumulator) in the computer.
  • 17. INSTRUCTION TYPES cont… 17  Similarly, the execution of the instruction OUTPUT 2000 causes the data stored in the accumulator to be moved to the data output register in the output device whose address is 2000.
  • 18. INSTRUCTION TYPES cont… 18  Alternatively, the computer can address these ports in the usual way of addressing memory locations.  In this case, the computer can input data from an input device by executing an instruction such as MOVE Rin, R0.  This instruction moves the content of the register Rin into the register R0.
  • 19. INSTRUCTION TYPES cont… 19  Similarly, the instruction MOVE R0, Rin moves the contents of register R0 into the register Rin, that is, performs an output operation.
  • 20. INSTRUCTION TYPES cont… 20 Control (sequencing) instructions are used to change the sequence in which instructions are executed. They take the form of CONDITIONAL BRANCHING (CONDITIONAL JUMP), UNCONDITIONAL BRANCHING (JUMP), or CALL instructions. A common characteristic among these instructions is that their execution changes the program counter (PC) value.
  • 21. INSTRUCTION TYPES cont… 21  The change made in the PC value can be unconditional, for example, in the unconditional branching or the jump instructions.  In this case, the earlier value of the PC is lost and execution of the program starts at a new value specified by the instruction.
  • 22. INSTRUCTION TYPES cont… 22 The change made in the PC by the branching instruction can be conditional based on the value of a specific flag. Examples of these flags include the Negative (N), Zero (Z), Overflow (V), and Carry (C). These flags represent the individual bits of a specific register, called the CONDITION CODE (CC) REGISTER.  The values of flags are set based on the results of executing different instruction
  • 24. Transfer of Control Operations 24
  • 25. ADDRESSING 25  There are two most important addressing issues: the types of data that can be addressed and the various addressing modes.
  • 26. Data Types 26  Numeric data consists of integers and floating point values.  Integers can be signed or unsigned and can be declared in various lengths. For example, in C++ integers can be short (16 bits), int (the word size of the given architecture), or long (32 bits).  Floating point numbers have lengths of 32, 64, or 128 bits.
  • 27. Data Types cont… 27 Nonnumeric data types consist of strings, Booleans, and pointers.  String instructions typically include operations such as copy, move, search, or modify. Boolean operations include AND, OR, XOR, and NOT. Pointers are actually addresses in memory.
  • 28. Address Modes 28 Addressing modes allow us to specify where the instruction operands are located. An addressing mode can specify a constant, a register, or a location in memory. Certain modes allow shorter addresses and some allow us to determine the location of the actual operand, often called the effective address of the operand, dynamically.
  • 29. Basic Addressing Modes 29 Immediate Addressing : the data to be operated on is part of the instruction.  For example, if the instruction is Load 008, the numeric value 8 is loaded into the AC.  The 12 bits of the operand field do not specify an address— they specify the actual operand the instruction requires.
  • 30. Basic Addressing Modes cont… 30  Advantage: no memory reference other than the instruction fetch is required to obtain the operand, thus saving one memory or cache cycle in the instruction cycle.  Disadvantage: is that the size of the number is restricted to the size of the address field, which, in most instruction sets, is small compared with the word length.
  • 31. Basic Addressing Modes cont… 31 Direct Addressing: the value to be referenced is obtained by specifying its memory address directly in the instruction.  For example, the instruction is Load 008, the data value found at memory address 008 is loaded into the AC. Is typically quite fast because, although the value to be loaded is not included in the instruction, it is quickly accessible.
  • 32. Basic Addressing Modes cont… 32 It is also much more flexible than immediate addressing because the value to be loaded is whatever is found at the given address, which may be variable. The obvious limitation is that it provides only a limited address space. Register Addressing :a register, instead of memory, is used to specify the operand.  This is very similar to direct addressing, except that instead of a memory address, the address field contains a register reference. The contents of that register are used as the operand.
  • 33. Basic Addressing Modes cont… 33 Indirect Addressing: the bits in the address field specify a memory address that is to be used as a pointer.  The effective address of the operand is found by going to this memory address.  For example, the instruction is Load 008, the data value found at memory address 008 is actually the effective address of the desired operand.
  • 34. Basic Addressing Modes cont… 34  Suppose we find the value 2A0 stored in location 008.  2A0 is the “real” address of the value we want.  The value found at location 2A0 is then loaded into the AC.
  • 35. Basic Addressing Modes cont… 35  In a variation on this scheme, the operand bits specify a register instead of a memory address, this mode is called register indirect addressing, works exactly the same way as indirect addressing mode, except it uses a register instead of a memory address to point to the data.  For example, if the instruction is Load R1, we would find the effective address of the desired operand in R1.
  • 36. Basic Addressing Modes cont… 36 Index addressing mode, the address of the operand is obtained by adding a constant to the content of a register, called the index register.  Consider, for example, the instruction LOAD X(Rind), Ri.  This instruction loads register Ri with the contents of the memory location whose address is the sum of the contents of register Rind and the value X.
  • 37. Basic Addressing Modes cont… 37  Index addressing is indicated in the instruction by including the name of the index register in parentheses and using the symbol X to indicate the constant to be added.
  • 38. Illustration of the indexed addressing mode 38
  • 39. Example 39  Suppose we have the instruction Load 800, and the memory and register R1 shown:
  • 40. 40
  • 41. Tutorial  MIPS ARCHITECTURES  PROGRAMMING EXAMPLES (From the book “fundamentals of computer organization”) 41