SlideShare a Scribd company logo
1 of 29
It is the mark of an educated mind to be able to entertain
a thought without accepting it.
Aristotle
What is computer?
 an electronic device for storing and processing data,
typically in binary form, according to instructions given to it in
variable program.
Computer
 because computers are controlled by programs written for
them, this makes them very versatile because their operation
can be changed simply by changing the program.
PROGRAM – is a set of INSTRUCTIONS that cause a
computer to perform a given task.
*each instruction affect the memory and the accumulator ,
a register with in a control unit that contains that basic
operand used in each instruction.
WHAT IS AN INSTRUCTION SET?
• The complete collection of instructions that are
understood by a CPU
• Machine language: binary representation of operations
and (addresses of) arguments
• Assembly language: mnemonic representation for
humans, e.g.,
OP A,B,C (meaning A <- OP(B,C))
COMPUTER INSTRUCTION
An instruction consist of two parts , Op code and
address.
OP CODE – tells the computer what to do if
encounters an instruction.
ADDRESS – is the memory location involved
 The total number of instructions and the types
and formats of the operands determine the
length of an instruction.
Instruction Symbol Explanation
LOAD (M) (A)
The contents of memory
(at the address specified in
the instruction) are written
to the accumulator.
STORE (A) (M)
The contents of the
accumulator are written in
the memory.
ADD (A) + (M) (A)
The contents of memory
are added to the
accumulator. The results go
to the accumulator.
SUB (A) – (M) (A)
The contents of memory
are subtracted to the
accumulator. The results go
to the accumulator.
SOME COMMON INSTRUCTION
ELEMENTS OF AN INSTRUCTION
 Operation code (op code)
Do this: ADD, SUB, MPY, DIV, LOAD,
STOR
 Source operand reference
To this: (address of) argument of op, e.g.
register, memory location
 Result operand reference
Put the result here (as above)
 Next instruction reference (often implicit)
When you have done that, do this: BR
COMPUTER INSTRUCTION
SET
• The shorter the instruction, the faster the time that it
can be fetched and decoded.
• Shorter instructions are better than longer ones:
(i) take up less space in memory
(ii) transferred to the CPU faster
• A machine with 2^N instructions must require at least
N-bit to encode all the op-codes.
INSTRUCTION CYCLE STATE
DIAGRAM
OP-CODE ENCODING
 1. Block-code technique
 To each of the 2K
instructions a unique binary
bit pattern of length K is assigned.
 An K-to-2K
decoder can then be used to decode
all the instructions. For example,
3-to-8
decoder3-bit Op-code
instruction 0
instruction 1
instruction 2
instruction 3
instruction 4
instruction 5
instruction 6
instruction 7
OP-CODE ENCODING
 2. Expanding op-code technique
 Consider an 4+12 bit instruction with a 4-bit op-code and three 4-
bit addresses.
 It can at most encode 16 three-address instructions.
 If there are only 15 such three-address instructions, then one of the
unused op-code can be used to expand to two-address, one-address
or zero address instructions
 Again, this expanded op-code can encode at most 16 two-address
instructions. And if there are less than 16 such instructions, we can
expand the op-code further.
Op-code Address 1 Address 2 Address 3
1 1 1 1 Op-code Address 1 Address 2
1 1 1 1 1 1 1 1 Op-code Address 1
1 1 1 1 1 1 1 1 1 1 1 1 Op-code
OPCODE ENCODING
 Note that the three address fields may not
necessarily be used to encode a three-address
operand; they can be used as a single 12-bit one-
address operand.
 Can have some part of the op-code to specify the
instruction format and/or length.
 if there are few two-address instructions, we may
attempt to make them shorter instead and to use the
first two bits to indicate the instruction length, e.g.,
10 means two-address and 11 means three address.
OP-CODE ENCODING
 Huffman encoding
 Given the probability of occurrences of each instruction,
it is possible to encode all the instructions with minimal
number of bits, and with the following property:
Fewer bits are used for most frequently used instructions
and more for the least frequently used ones.
1
1/4
1/2
1/8 1/8 1/4 1/2
1/16 1/16 1/16 1/16 1/8 1/8 1/4 1/4
LOADSTOSHIFT NOTJUMPHALT AND ADD
1
10
0
1
0
101010
10
11100110100011001000010000
OPCODE ENCODING,
HUFFMAN CODES
 Huffman encoding algorithm:
 1. Initialize the leaf nodes each with a probability of an
instruction. All nodes are unmarked.
 2. Find the two unmarked nodes with the smallest values
and mark them. Add a new unmarked node with a value
equal to the sum of the chosen two.
 3. Repeat step (2) until all nodes have been marked except
the last one, which has a value of 1.
 4. The encoding for each instruction is found by tracing the
path from the unmarked node (the root) to that instruction.
 may mark branches arbitrarily with 0, 1
OPCODE ENCODING,
HUFFMAN CODES
• Advantage:
– minimal number of bits
• Disadvantage:
– must decode instructions bit-by-bit, (can be slow).
– to decode, must have a logical representation of the encoded
tree, and follow branches as you decipher bits
– Fact is, most decoding is done in parallel
– Gives a speed advantage
ADDRESSING MODES
Immediate
Direct
Indirect
Register
Displacement (Indexed)
Stack
IMMEDIATE ADDRESSING
Operand is part of instruction
Operand = address field
e.g., ADD #5
Add 5 to contents of accumulator
5 is operand
No memory reference to fetch data
Fast
Limited range
DIRECT ADDRESSING
 Address field contains address of operand
 Effective address (EA) = address field (A)
 e.g., ADD A
Add contents of cell A to accumulator
Look in memory at address A for
operand
 Single memory reference to access data
 No additional calculations needed to work
out effective address
 Limited address space (length of address
field)
DIRECT ADDRESSING DIAGRAM
Address AOpcode
Instruction
Memory
Operand
INDIRECT ADDRESSING
Memory cell pointed to by address
field contains the address of the
operand
EA = (A)
Look in A, find effective address and
look there for operand
E.g. ADD (A)
Add content of cell pointed to by content
of A to accumulator
INDIRECT ADDRESSING DIAGRAM
Address AOpcode
Instruction
Memory
Operand
Pointer to operand
REGISTER ADDRESSING
Operand is held in register
named in address field
EA = R
Limited number of registers
Very small address field needed
Shorter instructions
Faster fetch
DISPLACEMENT
ADDRESSING
EA = A + (R)
Address field holds two values
A = base value
R = register that holds
displacement
or vice versa
See segmentation
STACK ADDRESSING
Operand is (implicitly) on top
of stack
e.g.
ADDPop top two items from
stack and add and push result
on top
ADDRESSING MODES
 inherent
 an op-code indicates the address of its operand
CLI ; clear the interrupt flag
 immediate
 an instruction contains or immediately precedes its
operand value
ADD #250, R1 % R1 := R1 + 250;
 Absolute/Direct
 an instruction contains the memory address of its
operand
ADD 250, R1 % R1 := R1 + *(250);
 register
 an instruction contains the register address of its
ADDRESSING MODES
 register indirect
 the register address in an instruction specifies the
address of its operand
ADD @R2, @R1 % *R1 := *R1 + *R2;
 auto-decrement or auto-increment
 The contents of the register is automatically
decremented or incremented before or after the
execution of the instruction
MOV (R2)+, R1 % R1 := *(R2); R2 := R2 + k;
MOV -(R2), R1 % R2 := R2 - k; R1 := *(R2);
ADDRESSING MODES
 indexed
 an offset is added to a register to give the address of the
operand
MOV 2(R2), R1 % R1 := R2[2];
 base-register
 a displacement is added to an implicit or explicit base
register to give the address of the operand
 relative
 same as base-register mode except that the instruction
pointer is used as the base register
ADDRESSING MODES
 Indirect addressing mode in general also applies to
absolute addresses, not just register addresses; the
absolute address is a pointer to the operand.
 The offset added to an index register may be as
large as the entire address space. On the other
hand, the displacement added to a base register is
generally much smaller than the entire address
space.
 The automatic modification (i.e., auto-increment or
auto-decrement) to an index register is called
autoindexing.
 Relative addresses have the advantage that the
code is position-independent.
INSTRUCTION TYPES
 Instructions, of most modern computers, may be
classified into the following six groups:
 Data transfer (40% of user program instructions)
MOV, LOAD
 Arithmetic
ADD, SUB, DIV, MUL
 Logical
AND, OR, NOT, SHIFT, ROTATE
 System-control
Test-And-Set
 I/O
Separate I/O space input/output

More Related Content

What's hot

Chapter 4 programming concepts III
Chapter 4  programming concepts IIIChapter 4  programming concepts III
Chapter 4 programming concepts IIISHREEHARI WADAWADAGI
 
Assembly language programming
Assembly language programming Assembly language programming
Assembly language programming Gaurav Takrani
 
Chapter 3 INSTRUCTION SET AND ASSEMBLY LANGUAGE PROGRAMMING
Chapter 3 INSTRUCTION SET AND ASSEMBLY LANGUAGE PROGRAMMINGChapter 3 INSTRUCTION SET AND ASSEMBLY LANGUAGE PROGRAMMING
Chapter 3 INSTRUCTION SET AND ASSEMBLY LANGUAGE PROGRAMMINGFrankie Jones
 
Addressing modes
Addressing modesAddressing modes
Addressing modesAJAL A J
 
11 instruction sets addressing modes
11  instruction sets addressing modes 11  instruction sets addressing modes
11 instruction sets addressing modes Sher Shah Merkhel
 
11 instruction sets addressing modes
11  instruction sets addressing modes 11  instruction sets addressing modes
11 instruction sets addressing modes Wasif Naeem
 
Assembler directives and basic steps ALP of 8086
Assembler directives and basic steps ALP of 8086Assembler directives and basic steps ALP of 8086
Assembler directives and basic steps ALP of 8086Urvashi Singh
 
Different types of Addressing.cao
Different types of Addressing.caoDifferent types of Addressing.cao
Different types of Addressing.caoUmme habiba
 
Operand and Opcode | Computer Science
Operand and Opcode | Computer ScienceOperand and Opcode | Computer Science
Operand and Opcode | Computer ScienceTransweb Global Inc
 
Lecture 4 assembly language
Lecture 4   assembly languageLecture 4   assembly language
Lecture 4 assembly languagePradeep Kumar TS
 
Instruction Set Architecture (ISA)
Instruction Set Architecture (ISA)Instruction Set Architecture (ISA)
Instruction Set Architecture (ISA)Gaditek
 

What's hot (18)

Chapter 4 programming concepts III
Chapter 4  programming concepts IIIChapter 4  programming concepts III
Chapter 4 programming concepts III
 
Assembly language programming
Assembly language programming Assembly language programming
Assembly language programming
 
Chapter 3 INSTRUCTION SET AND ASSEMBLY LANGUAGE PROGRAMMING
Chapter 3 INSTRUCTION SET AND ASSEMBLY LANGUAGE PROGRAMMINGChapter 3 INSTRUCTION SET AND ASSEMBLY LANGUAGE PROGRAMMING
Chapter 3 INSTRUCTION SET AND ASSEMBLY LANGUAGE PROGRAMMING
 
Addressing modes
Addressing modesAddressing modes
Addressing modes
 
11 instruction sets addressing modes
11  instruction sets addressing modes 11  instruction sets addressing modes
11 instruction sets addressing modes
 
Assembly language part I
Assembly language part IAssembly language part I
Assembly language part I
 
11 instruction sets addressing modes
11  instruction sets addressing modes 11  instruction sets addressing modes
11 instruction sets addressing modes
 
Chapter 3 programming concepts-ii
Chapter 3  programming concepts-iiChapter 3  programming concepts-ii
Chapter 3 programming concepts-ii
 
Assembler directives and basic steps ALP of 8086
Assembler directives and basic steps ALP of 8086Assembler directives and basic steps ALP of 8086
Assembler directives and basic steps ALP of 8086
 
Chapter 5 programming concepts iv
Chapter 5  programming concepts ivChapter 5  programming concepts iv
Chapter 5 programming concepts iv
 
addressing modes
addressing modesaddressing modes
addressing modes
 
Different types of Addressing.cao
Different types of Addressing.caoDifferent types of Addressing.cao
Different types of Addressing.cao
 
ADDRESSING MODE
ADDRESSING MODEADDRESSING MODE
ADDRESSING MODE
 
Operand and Opcode | Computer Science
Operand and Opcode | Computer ScienceOperand and Opcode | Computer Science
Operand and Opcode | Computer Science
 
Lecture5(1)
Lecture5(1)Lecture5(1)
Lecture5(1)
 
Lecture 4 assembly language
Lecture 4   assembly languageLecture 4   assembly language
Lecture 4 assembly language
 
Assembly Language -I
Assembly Language -IAssembly Language -I
Assembly Language -I
 
Instruction Set Architecture (ISA)
Instruction Set Architecture (ISA)Instruction Set Architecture (ISA)
Instruction Set Architecture (ISA)
 

Similar to Compreport

Instruction set (prasenjit dey)
Instruction set (prasenjit dey)Instruction set (prasenjit dey)
Instruction set (prasenjit dey)Prasenjit Dey
 
Addressing modes/Addressing Mode with illustration/ Addressing mode in 8086
Addressing modes/Addressing Mode with illustration/ Addressing mode in 8086Addressing modes/Addressing Mode with illustration/ Addressing mode in 8086
Addressing modes/Addressing Mode with illustration/ Addressing mode in 8086samirbharat77
 
ADDRESSING MODES.pptx
ADDRESSING MODES.pptxADDRESSING MODES.pptx
ADDRESSING MODES.pptxKajalOberoi1
 
ITEC582-Chapter 12.pptx
ITEC582-Chapter 12.pptxITEC582-Chapter 12.pptx
ITEC582-Chapter 12.pptxSabaNaeem26
 
Computer architecture addressing modes and formats
Computer architecture addressing modes and formatsComputer architecture addressing modes and formats
Computer architecture addressing modes and formatsMazin Alwaaly
 
Unit II arm 7 Instruction Set
Unit II arm 7 Instruction SetUnit II arm 7 Instruction Set
Unit II arm 7 Instruction SetDr. Pankaj Zope
 
PPT on Addressing Modes.ppt.pptx
PPT on Addressing Modes.ppt.pptxPPT on Addressing Modes.ppt.pptx
PPT on Addressing Modes.ppt.pptxTushar Singhal
 
An overview of siemens plc address mapping
An overview of siemens plc address mappingAn overview of siemens plc address mapping
An overview of siemens plc address mappingJustEngineering
 
(246431835) instruction set principles (2) (1)
(246431835) instruction set principles (2) (1)(246431835) instruction set principles (2) (1)
(246431835) instruction set principles (2) (1)Alveena Saleem
 
Unit 1 ca-introduction
Unit 1 ca-introductionUnit 1 ca-introduction
Unit 1 ca-introductionBBDITM LUCKNOW
 

Similar to Compreport (20)

Instruction set (prasenjit dey)
Instruction set (prasenjit dey)Instruction set (prasenjit dey)
Instruction set (prasenjit dey)
 
Instruction-Sets-2.pptx
Instruction-Sets-2.pptxInstruction-Sets-2.pptx
Instruction-Sets-2.pptx
 
Addressing modes/Addressing Mode with illustration/ Addressing mode in 8086
Addressing modes/Addressing Mode with illustration/ Addressing mode in 8086Addressing modes/Addressing Mode with illustration/ Addressing mode in 8086
Addressing modes/Addressing Mode with illustration/ Addressing mode in 8086
 
ADDRESSING MODES
ADDRESSING MODESADDRESSING MODES
ADDRESSING MODES
 
ADDRESSING MODES
ADDRESSING MODESADDRESSING MODES
ADDRESSING MODES
 
ADDRESSING MODES.pptx
ADDRESSING MODES.pptxADDRESSING MODES.pptx
ADDRESSING MODES.pptx
 
Instruction codes
Instruction codesInstruction codes
Instruction codes
 
ITEC582-Chapter 12.pptx
ITEC582-Chapter 12.pptxITEC582-Chapter 12.pptx
ITEC582-Chapter 12.pptx
 
Computer architecture addressing modes and formats
Computer architecture addressing modes and formatsComputer architecture addressing modes and formats
Computer architecture addressing modes and formats
 
Unit II arm 7 Instruction Set
Unit II arm 7 Instruction SetUnit II arm 7 Instruction Set
Unit II arm 7 Instruction Set
 
PPT on Addressing Modes.ppt.pptx
PPT on Addressing Modes.ppt.pptxPPT on Addressing Modes.ppt.pptx
PPT on Addressing Modes.ppt.pptx
 
Chapter3.ppt
Chapter3.pptChapter3.ppt
Chapter3.ppt
 
An overview of siemens plc address mapping
An overview of siemens plc address mappingAn overview of siemens plc address mapping
An overview of siemens plc address mapping
 
(246431835) instruction set principles (2) (1)
(246431835) instruction set principles (2) (1)(246431835) instruction set principles (2) (1)
(246431835) instruction set principles (2) (1)
 
Unit 1 ca-introduction
Unit 1 ca-introductionUnit 1 ca-introduction
Unit 1 ca-introduction
 
UNIT-3.pptx
UNIT-3.pptxUNIT-3.pptx
UNIT-3.pptx
 
Bc0040
Bc0040Bc0040
Bc0040
 
addressing mode 1
addressing mode 1addressing mode 1
addressing mode 1
 
Addressing modes
Addressing modesAddressing modes
Addressing modes
 
microprocessor
 microprocessor microprocessor
microprocessor
 

More from xdarlord

Alternating Circuits Report PPT Lecture 16
Alternating Circuits Report PPT Lecture 16Alternating Circuits Report PPT Lecture 16
Alternating Circuits Report PPT Lecture 16xdarlord
 
Alternating Current Lecture Introduction
Alternating Current Lecture IntroductionAlternating Current Lecture Introduction
Alternating Current Lecture Introductionxdarlord
 
Introduction to Alternating Currents AC Circuits
Introduction to Alternating Currents AC CircuitsIntroduction to Alternating Currents AC Circuits
Introduction to Alternating Currents AC Circuitsxdarlord
 
Introduction to second law thermodynamics
Introduction to second law thermodynamicsIntroduction to second law thermodynamics
Introduction to second law thermodynamicsxdarlord
 
The Second Law of Thermodynamics--Thermodynamics: An Engineering Approach
The Second Law of Thermodynamics--Thermodynamics: An Engineering ApproachThe Second Law of Thermodynamics--Thermodynamics: An Engineering Approach
The Second Law of Thermodynamics--Thermodynamics: An Engineering Approachxdarlord
 
Wireless Networks.ppt
Wireless Networks.pptWireless Networks.ppt
Wireless Networks.pptxdarlord
 
Intro_to_Arduino_-_v30.ppt
Intro_to_Arduino_-_v30.pptIntro_to_Arduino_-_v30.ppt
Intro_to_Arduino_-_v30.pptxdarlord
 
Internet age
Internet ageInternet age
Internet agexdarlord
 
Centrifugal sand siever bean sheller
Centrifugal sand siever bean sheller Centrifugal sand siever bean sheller
Centrifugal sand siever bean sheller xdarlord
 
Basic television
Basic televisionBasic television
Basic televisionxdarlord
 

More from xdarlord (11)

Alternating Circuits Report PPT Lecture 16
Alternating Circuits Report PPT Lecture 16Alternating Circuits Report PPT Lecture 16
Alternating Circuits Report PPT Lecture 16
 
Alternating Current Lecture Introduction
Alternating Current Lecture IntroductionAlternating Current Lecture Introduction
Alternating Current Lecture Introduction
 
Introduction to Alternating Currents AC Circuits
Introduction to Alternating Currents AC CircuitsIntroduction to Alternating Currents AC Circuits
Introduction to Alternating Currents AC Circuits
 
Introduction to second law thermodynamics
Introduction to second law thermodynamicsIntroduction to second law thermodynamics
Introduction to second law thermodynamics
 
The Second Law of Thermodynamics--Thermodynamics: An Engineering Approach
The Second Law of Thermodynamics--Thermodynamics: An Engineering ApproachThe Second Law of Thermodynamics--Thermodynamics: An Engineering Approach
The Second Law of Thermodynamics--Thermodynamics: An Engineering Approach
 
Wireless Networks.ppt
Wireless Networks.pptWireless Networks.ppt
Wireless Networks.ppt
 
Intro_to_Arduino_-_v30.ppt
Intro_to_Arduino_-_v30.pptIntro_to_Arduino_-_v30.ppt
Intro_to_Arduino_-_v30.ppt
 
AC.pptx
AC.pptxAC.pptx
AC.pptx
 
Internet age
Internet ageInternet age
Internet age
 
Centrifugal sand siever bean sheller
Centrifugal sand siever bean sheller Centrifugal sand siever bean sheller
Centrifugal sand siever bean sheller
 
Basic television
Basic televisionBasic television
Basic television
 

Recently uploaded

Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130Suhani Kapoor
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxupamatechverse
 
High Profile Call Girls Nashik Megha 7001305949 Independent Escort Service Na...
High Profile Call Girls Nashik Megha 7001305949 Independent Escort Service Na...High Profile Call Girls Nashik Megha 7001305949 Independent Escort Service Na...
High Profile Call Girls Nashik Megha 7001305949 Independent Escort Service Na...Call Girls in Nagpur High Profile
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSKurinjimalarL3
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Dr.Costas Sachpazis
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxupamatechverse
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxpranjaldaimarysona
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxpurnimasatapathy1234
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxJoão Esperancinha
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxDeepakSakkari2
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile servicerehmti665
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024hassan khalil
 
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).pptssuser5c9d4b1
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130Suhani Kapoor
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSRajkumarAkumalla
 

Recently uploaded (20)

Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptx
 
High Profile Call Girls Nashik Megha 7001305949 Independent Escort Service Na...
High Profile Call Girls Nashik Megha 7001305949 Independent Escort Service Na...High Profile Call Girls Nashik Megha 7001305949 Independent Escort Service Na...
High Profile Call Girls Nashik Megha 7001305949 Independent Escort Service Na...
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptx
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptx
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptx
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptx
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
 
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptxExploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile service
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024
 
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCRCall Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
 

Compreport

  • 1. It is the mark of an educated mind to be able to entertain a thought without accepting it. Aristotle
  • 3.  an electronic device for storing and processing data, typically in binary form, according to instructions given to it in variable program. Computer  because computers are controlled by programs written for them, this makes them very versatile because their operation can be changed simply by changing the program. PROGRAM – is a set of INSTRUCTIONS that cause a computer to perform a given task. *each instruction affect the memory and the accumulator , a register with in a control unit that contains that basic operand used in each instruction.
  • 4. WHAT IS AN INSTRUCTION SET? • The complete collection of instructions that are understood by a CPU • Machine language: binary representation of operations and (addresses of) arguments • Assembly language: mnemonic representation for humans, e.g., OP A,B,C (meaning A <- OP(B,C))
  • 5. COMPUTER INSTRUCTION An instruction consist of two parts , Op code and address. OP CODE – tells the computer what to do if encounters an instruction. ADDRESS – is the memory location involved  The total number of instructions and the types and formats of the operands determine the length of an instruction.
  • 6. Instruction Symbol Explanation LOAD (M) (A) The contents of memory (at the address specified in the instruction) are written to the accumulator. STORE (A) (M) The contents of the accumulator are written in the memory. ADD (A) + (M) (A) The contents of memory are added to the accumulator. The results go to the accumulator. SUB (A) – (M) (A) The contents of memory are subtracted to the accumulator. The results go to the accumulator. SOME COMMON INSTRUCTION
  • 7. ELEMENTS OF AN INSTRUCTION  Operation code (op code) Do this: ADD, SUB, MPY, DIV, LOAD, STOR  Source operand reference To this: (address of) argument of op, e.g. register, memory location  Result operand reference Put the result here (as above)  Next instruction reference (often implicit) When you have done that, do this: BR
  • 8. COMPUTER INSTRUCTION SET • The shorter the instruction, the faster the time that it can be fetched and decoded. • Shorter instructions are better than longer ones: (i) take up less space in memory (ii) transferred to the CPU faster • A machine with 2^N instructions must require at least N-bit to encode all the op-codes.
  • 10. OP-CODE ENCODING  1. Block-code technique  To each of the 2K instructions a unique binary bit pattern of length K is assigned.  An K-to-2K decoder can then be used to decode all the instructions. For example, 3-to-8 decoder3-bit Op-code instruction 0 instruction 1 instruction 2 instruction 3 instruction 4 instruction 5 instruction 6 instruction 7
  • 11. OP-CODE ENCODING  2. Expanding op-code technique  Consider an 4+12 bit instruction with a 4-bit op-code and three 4- bit addresses.  It can at most encode 16 three-address instructions.  If there are only 15 such three-address instructions, then one of the unused op-code can be used to expand to two-address, one-address or zero address instructions  Again, this expanded op-code can encode at most 16 two-address instructions. And if there are less than 16 such instructions, we can expand the op-code further. Op-code Address 1 Address 2 Address 3 1 1 1 1 Op-code Address 1 Address 2 1 1 1 1 1 1 1 1 Op-code Address 1 1 1 1 1 1 1 1 1 1 1 1 1 Op-code
  • 12. OPCODE ENCODING  Note that the three address fields may not necessarily be used to encode a three-address operand; they can be used as a single 12-bit one- address operand.  Can have some part of the op-code to specify the instruction format and/or length.  if there are few two-address instructions, we may attempt to make them shorter instead and to use the first two bits to indicate the instruction length, e.g., 10 means two-address and 11 means three address.
  • 13. OP-CODE ENCODING  Huffman encoding  Given the probability of occurrences of each instruction, it is possible to encode all the instructions with minimal number of bits, and with the following property: Fewer bits are used for most frequently used instructions and more for the least frequently used ones. 1 1/4 1/2 1/8 1/8 1/4 1/2 1/16 1/16 1/16 1/16 1/8 1/8 1/4 1/4 LOADSTOSHIFT NOTJUMPHALT AND ADD 1 10 0 1 0 101010 10 11100110100011001000010000
  • 14. OPCODE ENCODING, HUFFMAN CODES  Huffman encoding algorithm:  1. Initialize the leaf nodes each with a probability of an instruction. All nodes are unmarked.  2. Find the two unmarked nodes with the smallest values and mark them. Add a new unmarked node with a value equal to the sum of the chosen two.  3. Repeat step (2) until all nodes have been marked except the last one, which has a value of 1.  4. The encoding for each instruction is found by tracing the path from the unmarked node (the root) to that instruction.  may mark branches arbitrarily with 0, 1
  • 15. OPCODE ENCODING, HUFFMAN CODES • Advantage: – minimal number of bits • Disadvantage: – must decode instructions bit-by-bit, (can be slow). – to decode, must have a logical representation of the encoded tree, and follow branches as you decipher bits – Fact is, most decoding is done in parallel – Gives a speed advantage
  • 17. IMMEDIATE ADDRESSING Operand is part of instruction Operand = address field e.g., ADD #5 Add 5 to contents of accumulator 5 is operand No memory reference to fetch data Fast Limited range
  • 18. DIRECT ADDRESSING  Address field contains address of operand  Effective address (EA) = address field (A)  e.g., ADD A Add contents of cell A to accumulator Look in memory at address A for operand  Single memory reference to access data  No additional calculations needed to work out effective address  Limited address space (length of address field)
  • 19. DIRECT ADDRESSING DIAGRAM Address AOpcode Instruction Memory Operand
  • 20. INDIRECT ADDRESSING Memory cell pointed to by address field contains the address of the operand EA = (A) Look in A, find effective address and look there for operand E.g. ADD (A) Add content of cell pointed to by content of A to accumulator
  • 21. INDIRECT ADDRESSING DIAGRAM Address AOpcode Instruction Memory Operand Pointer to operand
  • 22. REGISTER ADDRESSING Operand is held in register named in address field EA = R Limited number of registers Very small address field needed Shorter instructions Faster fetch
  • 23. DISPLACEMENT ADDRESSING EA = A + (R) Address field holds two values A = base value R = register that holds displacement or vice versa See segmentation
  • 24. STACK ADDRESSING Operand is (implicitly) on top of stack e.g. ADDPop top two items from stack and add and push result on top
  • 25. ADDRESSING MODES  inherent  an op-code indicates the address of its operand CLI ; clear the interrupt flag  immediate  an instruction contains or immediately precedes its operand value ADD #250, R1 % R1 := R1 + 250;  Absolute/Direct  an instruction contains the memory address of its operand ADD 250, R1 % R1 := R1 + *(250);  register  an instruction contains the register address of its
  • 26. ADDRESSING MODES  register indirect  the register address in an instruction specifies the address of its operand ADD @R2, @R1 % *R1 := *R1 + *R2;  auto-decrement or auto-increment  The contents of the register is automatically decremented or incremented before or after the execution of the instruction MOV (R2)+, R1 % R1 := *(R2); R2 := R2 + k; MOV -(R2), R1 % R2 := R2 - k; R1 := *(R2);
  • 27. ADDRESSING MODES  indexed  an offset is added to a register to give the address of the operand MOV 2(R2), R1 % R1 := R2[2];  base-register  a displacement is added to an implicit or explicit base register to give the address of the operand  relative  same as base-register mode except that the instruction pointer is used as the base register
  • 28. ADDRESSING MODES  Indirect addressing mode in general also applies to absolute addresses, not just register addresses; the absolute address is a pointer to the operand.  The offset added to an index register may be as large as the entire address space. On the other hand, the displacement added to a base register is generally much smaller than the entire address space.  The automatic modification (i.e., auto-increment or auto-decrement) to an index register is called autoindexing.  Relative addresses have the advantage that the code is position-independent.
  • 29. INSTRUCTION TYPES  Instructions, of most modern computers, may be classified into the following six groups:  Data transfer (40% of user program instructions) MOV, LOAD  Arithmetic ADD, SUB, DIV, MUL  Logical AND, OR, NOT, SHIFT, ROTATE  System-control Test-And-Set  I/O Separate I/O space input/output