SlideShare ist ein Scribd-Unternehmen logo
1 von 23
Downloaden Sie, um offline zu lesen
Unit 5 -INSTRUCTION, INTERRUPTS and IO
PROCESSING
Abhineet Anand
Computer Science and Engg. Department
University of Petroleum and Energy Studies, Dehradun

December 9, 2012

Abhineet Anand (UPES, Dehradun)

INST n , INTERRUPTS, IO PROCESSING

December 9, 2012

1 / 23
Outline
1

Instruction Codes
Introduction
Operation Code
Operands

2

Instruction Formats
Single accumulator organization
General register organization
Stack organization
Evaluation of Arithmetic Statement

3

Addressing Modes
Type of Addressing Modes

4

Program Interrupt
Types of Interrupts

Abhineet Anand (UPES, Dehradun)

INST n , INTERRUPTS, IO PROCESSING

December 9, 2012

2 / 23
Instruction Codes

A Computer instruction is binary code that specifies a sequence of
micro operation for the Computer.
The Computer reads each instruction from memory and places it in a
control register.
The control then interprets the binary code of the instruction and
proceeds to execute it by issuing a sequence of micro operations.

Abhineet Anand (UPES, Dehradun)

INST n , INTERRUPTS, IO PROCESSING

December 9, 2012

3 / 23
Instruction Codes

An instruction code is a group of bits that instruct the computer to
perform a specific task.
It is usually divided into parts, each having its own particular
interpretation.
They are:
Operation Code, and
Operands.

The most basic part of an instruction code is its operation part.

Abhineet Anand (UPES, Dehradun)

INST n , INTERRUPTS, IO PROCESSING

December 9, 2012

4 / 23
Operation Code

The Operation Code (OpCode) of an instruction is a group of bits that
define each operation such add, subtract, multiply, shift, and
complement.
It must consist of at least n bits for a given 2n distinct operations.
Suppose we are having 64 (26 ) operation then the length of OpCode
will be 6.
The control unit decode the OpCode and do the required operation.

Abhineet Anand (UPES, Dehradun)

INST n , INTERRUPTS, IO PROCESSING

December 9, 2012

5 / 23
Operands
The Operation must be performed on some data stored in processor
register or in memory.
Every Computer has its own particular instruction code format.
The Simplest way to organize a computer is to have an instruction
code format with two parts.
The first part specifies the operation to be performed and the second
specifies an address.

Abhineet Anand (UPES, Dehradun)

INST n , INTERRUPTS, IO PROCESSING

December 9, 2012

6 / 23
Instruction Formats

The bits of the instruction are divided into groups called fields. The
most common fields found in instruction formats are:
An Operation Code field that specifies the operation to be performed.
An Address field that designates a memory address or a processor
register.
A mode field that specifies the way the operand or the effective
address is determined.

Abhineet Anand (UPES, Dehradun)

INST n , INTERRUPTS, IO PROCESSING

December 9, 2012

7 / 23
Instruction Formats

Computer may have instruction of several different lengths containing
varying numbers of addresses.
The number of address fields in the instruction format of a computer
depends on the internal organization of its registers.
Most computers fall into one of three types of CPU organization:
1
2
3

Single accumulator organization.
General register organization.
Stack organization.

Abhineet Anand (UPES, Dehradun)

INST n , INTERRUPTS, IO PROCESSING

December 9, 2012

8 / 23
Single accumulator organization

All Operation are performed with an implied accumulator register. The
instruction format in this type of computers uses one address field.
Example:

ADD X
where, X is the address of the operand.
The ADD instruction in this case results in the operation
AC < − AC + M[X].

Abhineet Anand (UPES, Dehradun)

INST n , INTERRUPTS, IO PROCESSING

December 9, 2012

9 / 23
General register organization
The instruction format in this type of computer needs three register
address fields.
Thus the instruction for an arithmetic addition may be written in an
assembly language as

ADD R1, R2, R3
to denote the operation R1 < − R2 + R3.
The number of address fields in the instruction can be reduced from
three to two if the destination register is the same as one of the
source registers.

ADD R1, R2
would denote the operation R1 < − R1 + R2.

Abhineet Anand (UPES, Dehradun)

INST n , INTERRUPTS, IO PROCESSING

December 9, 2012

10 / 23
Stack organization

The stack-organized CPU would have PUSH and POP instruction
which requires an address filed.
Example:

PUSH X
will push the word at address X to the top of the stack. The stack
pointer is updated automatically.
The operation is performed on the two items that are on top of the
stack.

Abhineet Anand (UPES, Dehradun)

INST n , INTERRUPTS, IO PROCESSING

December 9, 2012

11 / 23
Evaluation of Arithmetic Statement

X=(A+B)∗(C+D)
Three - Address Instruction
ADD R1, A, B
R1 < − M[A] + M[B]
ADD R2, C, D
R2 < − M[C] + M[D]
MUL X, R1, R2
M[X] < − R1 ∗ R2.
Two - Address Instruction
MOV R1, A
R1 < − M[A]
ADD R1, B
R1 < − R1 + M[B]
MOV R2, C
R2 < − M[C]
ADD R2, D
R2 < − R2 + M[D]
MUL R1, R2
R1 < − R1 ∗ R2
MOV X, R1
M[X] < − R1

Abhineet Anand (UPES, Dehradun)

INST n , INTERRUPTS, IO PROCESSING

December 9, 2012

12 / 23
Evaluation of Arithmetic Statement
One - Address Instruction
LOAD A
AC< − M[A]
ADD B
AC < − AC + M[B]
STORE T
M[T] < − AC
LOAD C
AC < − M[C]
ADD D
AC< − AC + M[D]
MUL T
AC < − AC ∗ M[T]
STORE X
M[X] < − AC
Zero - Address Instruction
PUSH A
TOS < − A
PUSH B
TOS < − B
ADD
TOS < − (A + B)
PUSH C
TOS < − C
PUSH D
TOS < − D
ADD
TOS < −(C + D)
MUL
TOS < − (C + D) * (A+ B)
POP X
M[X] < − TOS
Abhineet Anand (UPES, Dehradun)

INST n , INTERRUPTS, IO PROCESSING

December 9, 2012

13 / 23
Addressing Modes

The way the operands are chosen during program execution is
dependent on the addressing mode of the instruction.
The addressing mode specifies a rule for interpreting or modifying the
address field of the instruction before the operand is actually
referenced.
An Operation Code field that specifies the operation to be performed.
An Address field that designates a memory address or a processor
register.
A mode field that specifies the way the operand or the effective
address is determined.

Abhineet Anand (UPES, Dehradun)

INST n , INTERRUPTS, IO PROCESSING

December 9, 2012

14 / 23
Addressing Modes

Computer use addressing mode techniques for the purpose of
accommodating one or both of the following provisions:
To give programming versatility to the user by providing such facilities
as pointers to memory, counters for loop control, indexing of data, and
program relocation.
To reduce the number of bits in the addressing field of the instruction.

Abhineet Anand (UPES, Dehradun)

INST n , INTERRUPTS, IO PROCESSING

December 9, 2012

15 / 23
Type of Addressing Modes

Although most addressing mode modify the address field of the
instruction, there are two modes that need no address field at all.
These are:
Implied Mode: Operands are specified implicitly in the definition of the
instruction. Like ”Complement Accumulator”.
Zero-Address instruction in a stack-organized computer are
implied-mode instruction since the operands are implied to be on top of
the stack.
Immediate Mode: In this mode the operand is specified in the
instruction itself.
Immediate-mode instruction are useful for initializing registers to a
constant value.

Abhineet Anand (UPES, Dehradun)

INST n , INTERRUPTS, IO PROCESSING

December 9, 2012

16 / 23
Type of Addressing Modes

Register Mode: In this mode the operands are in register that reside
within the CPU.
The particular register is selected from a register filed in the
instruction.
Register Indirect Mode: In this mode the instruction specifies a
register in the CPU whose content give the address of the operand in
memory.
The advantage is that the address field of the instruction uses a fewer
bits to select a register than would have been required to specify a
memory address directly.

Abhineet Anand (UPES, Dehradun)

INST n , INTERRUPTS, IO PROCESSING

December 9, 2012

17 / 23
Type of Addressing Modes

Auto-increment Mode or Auto-decrement Mode
Direct Address Mode
Indirect Address Mode
Relative Address Mode
Indexed Addressing Mode
Base Register Addressing Mode

Abhineet Anand (UPES, Dehradun)

INST n , INTERRUPTS, IO PROCESSING

December 9, 2012

18 / 23
Program Interrupt

The concept of program interrupt is used to handle a variety of
problems that arise out of normal program sequence.
Program interrupt refers to the transfer of program control from a
currently running program to another service program as a result of
an external or internal generated request.
Control returns to the original program after the service program is
executed.

Abhineet Anand (UPES, Dehradun)

INST n , INTERRUPTS, IO PROCESSING

December 9, 2012

19 / 23
Program Interrupt

The interrupt procedure is, in principal, quite similar, to subroutine call
except for three variation:
1

2

3

The interrupt is usually initiated by an internal or external signal rather
than from the execution of an instruction;
The address of the interrupt service program is determined by the
hardware rather than from the address field of instruction; and
an interrupt procedure usually stores all the information necessary to
define the state of the CPU rather than storing only the program
counter.

Abhineet Anand (UPES, Dehradun)

INST n , INTERRUPTS, IO PROCESSING

December 9, 2012

20 / 23
Program Interrupt

These three procedure concept are clarified further as:
1
2
3

The content of the program counter
The content of all processor register
The content of certain status conditions

The collection of all status bit conditions in the CPU is sometimes
called a Program Status Word or PSW.

Abhineet Anand (UPES, Dehradun)

INST n , INTERRUPTS, IO PROCESSING

December 9, 2012

21 / 23
Types of Interrupts
There are three major types of interrupts that cause a break in the
normal execution of a program. They are:
1

2

3

External Interrupts - come from input-output (I/O) devices, from a
timing devices, from a circuit monitoring the power supply, or from any
other external source.
Example: I/O devices requesting for transfer of data, I/O devices
finished transfer of data, elapsed time of an event, or power failure.
Internal Interrupts - arise from illegal or erroneous use of an instruction
or date, also known as trap.
Example: register overflow, divide by zero, invalid operation code, stack
overflow, protection violation.
Software Interrupts - initiated by executing an instruction. It is a special
call instruction that behaves like an interrupt rather than a subroutine
call.

Abhineet Anand (UPES, Dehradun)

INST n , INTERRUPTS, IO PROCESSING

December 9, 2012

22 / 23
THANK YOU

Abhineet Anand (UPES, Dehradun)

INST n , INTERRUPTS, IO PROCESSING

December 9, 2012

23 / 23

Weitere ähnliche Inhalte

Was ist angesagt?

Memory Reference Instructions
Memory Reference InstructionsMemory Reference Instructions
Memory Reference InstructionsRabin BK
 
Data transfer and manipulation
Data transfer and manipulationData transfer and manipulation
Data transfer and manipulationrajshreemuthiah
 
Iaetsd fpga implementation of fault tolerant embedded
Iaetsd fpga implementation of fault tolerant embeddedIaetsd fpga implementation of fault tolerant embedded
Iaetsd fpga implementation of fault tolerant embeddedIaetsd Iaetsd
 
Digital signal processing
Digital signal processingDigital signal processing
Digital signal processingPrabhu R
 
JCL MAINFRAMES
JCL MAINFRAMESJCL MAINFRAMES
JCL MAINFRAMESkamaljune
 
Computer Organisation - Addressing Modes
Computer Organisation - Addressing ModesComputer Organisation - Addressing Modes
Computer Organisation - Addressing ModesArunaDevi63
 
Central processing unit
Central processing unitCentral processing unit
Central processing unitjyoti_lakhani
 
Computer architecture instruction formats
Computer architecture instruction formatsComputer architecture instruction formats
Computer architecture instruction formatsMazin Alwaaly
 
Computer architecture addressing modes and formats
Computer architecture addressing modes and formatsComputer architecture addressing modes and formats
Computer architecture addressing modes and formatsMazin Alwaaly
 
Mainframe jcl exec and dd statements part - 3
Mainframe jcl exec and dd statements part - 3Mainframe jcl exec and dd statements part - 3
Mainframe jcl exec and dd statements part - 3janaki ram
 
Mainframe JCL Part - 1
Mainframe JCL Part - 1Mainframe JCL Part - 1
Mainframe JCL Part - 1janaki ram
 
Addressing Modes
Addressing ModesAddressing Modes
Addressing ModesMayank Garg
 
Mainframe refresher-part-1
Mainframe refresher-part-1Mainframe refresher-part-1
Mainframe refresher-part-1vishwas17
 

Was ist angesagt? (18)

Micro program example
Micro program exampleMicro program example
Micro program example
 
Memory Reference Instructions
Memory Reference InstructionsMemory Reference Instructions
Memory Reference Instructions
 
Data transfer and manipulation
Data transfer and manipulationData transfer and manipulation
Data transfer and manipulation
 
Iaetsd fpga implementation of fault tolerant embedded
Iaetsd fpga implementation of fault tolerant embeddedIaetsd fpga implementation of fault tolerant embedded
Iaetsd fpga implementation of fault tolerant embedded
 
Digital signal processing
Digital signal processingDigital signal processing
Digital signal processing
 
JCL MAINFRAMES
JCL MAINFRAMESJCL MAINFRAMES
JCL MAINFRAMES
 
Computer Organisation - Addressing Modes
Computer Organisation - Addressing ModesComputer Organisation - Addressing Modes
Computer Organisation - Addressing Modes
 
Lecture 26
Lecture 26Lecture 26
Lecture 26
 
Instruction codes
Instruction codesInstruction codes
Instruction codes
 
Central processing unit
Central processing unitCentral processing unit
Central processing unit
 
Addressing modes
Addressing modesAddressing modes
Addressing modes
 
Computer architecture instruction formats
Computer architecture instruction formatsComputer architecture instruction formats
Computer architecture instruction formats
 
addressing modes
addressing modesaddressing modes
addressing modes
 
Computer architecture addressing modes and formats
Computer architecture addressing modes and formatsComputer architecture addressing modes and formats
Computer architecture addressing modes and formats
 
Mainframe jcl exec and dd statements part - 3
Mainframe jcl exec and dd statements part - 3Mainframe jcl exec and dd statements part - 3
Mainframe jcl exec and dd statements part - 3
 
Mainframe JCL Part - 1
Mainframe JCL Part - 1Mainframe JCL Part - 1
Mainframe JCL Part - 1
 
Addressing Modes
Addressing ModesAddressing Modes
Addressing Modes
 
Mainframe refresher-part-1
Mainframe refresher-part-1Mainframe refresher-part-1
Mainframe refresher-part-1
 

Ähnlich wie Instruction, interrupts & io processing

Ähnlich wie Instruction, interrupts & io processing (20)

Lect5 organization
Lect5 organizationLect5 organization
Lect5 organization
 
Central processor organization
Central processor organizationCentral processor organization
Central processor organization
 
Central processor organization
Central processor organizationCentral processor organization
Central processor organization
 
ITEC582-Chapter 12.pptx
ITEC582-Chapter 12.pptxITEC582-Chapter 12.pptx
ITEC582-Chapter 12.pptx
 
instruction codes
instruction codesinstruction codes
instruction codes
 
Computer Organization and Architecture.
Computer Organization and Architecture.Computer Organization and Architecture.
Computer Organization and Architecture.
 
Computer Organization
Computer OrganizationComputer Organization
Computer Organization
 
Computer Organization
Computer OrganizationComputer Organization
Computer Organization
 
Co unit 1
Co unit 1Co unit 1
Co unit 1
 
CSA PPT UNIT 1.pptx
CSA PPT UNIT 1.pptxCSA PPT UNIT 1.pptx
CSA PPT UNIT 1.pptx
 
Processor Basics
Processor BasicsProcessor Basics
Processor Basics
 
embedded system and computer architecure
embedded system and computer architecureembedded system and computer architecure
embedded system and computer architecure
 
Cpu execution
Cpu executionCpu execution
Cpu execution
 
Basic computer organization
Basic computer organizationBasic computer organization
Basic computer organization
 
Cs2253 coa-2marks-2013
Cs2253 coa-2marks-2013Cs2253 coa-2marks-2013
Cs2253 coa-2marks-2013
 
pdfslide.net_morris-mano-ppt.ppt
pdfslide.net_morris-mano-ppt.pptpdfslide.net_morris-mano-ppt.ppt
pdfslide.net_morris-mano-ppt.ppt
 
Addressing modes (detailed data path)
Addressing modes (detailed data path)Addressing modes (detailed data path)
Addressing modes (detailed data path)
 
CS6303 Computer Architecture.pdf
CS6303 Computer Architecture.pdfCS6303 Computer Architecture.pdf
CS6303 Computer Architecture.pdf
 
Ch 8
Ch 8Ch 8
Ch 8
 
Different addressing mode and risc, cisc microprocessor
Different addressing mode and risc, cisc microprocessorDifferent addressing mode and risc, cisc microprocessor
Different addressing mode and risc, cisc microprocessor
 

Mehr von Kumar

Graphics devices
Graphics devicesGraphics devices
Graphics devicesKumar
 
Fill area algorithms
Fill area algorithmsFill area algorithms
Fill area algorithmsKumar
 
region-filling
region-fillingregion-filling
region-fillingKumar
 
Bresenham derivation
Bresenham derivationBresenham derivation
Bresenham derivationKumar
 
Bresenham circles and polygons derication
Bresenham circles and polygons dericationBresenham circles and polygons derication
Bresenham circles and polygons dericationKumar
 
Introductionto xslt
Introductionto xsltIntroductionto xslt
Introductionto xsltKumar
 
Extracting data from xml
Extracting data from xmlExtracting data from xml
Extracting data from xmlKumar
 
Xml basics
Xml basicsXml basics
Xml basicsKumar
 
XML Schema
XML SchemaXML Schema
XML SchemaKumar
 
Publishing xml
Publishing xmlPublishing xml
Publishing xmlKumar
 
Applying xml
Applying xmlApplying xml
Applying xmlKumar
 
Introduction to XML
Introduction to XMLIntroduction to XML
Introduction to XMLKumar
 
How to deploy a j2ee application
How to deploy a j2ee applicationHow to deploy a j2ee application
How to deploy a j2ee applicationKumar
 
JNDI, JMS, JPA, XML
JNDI, JMS, JPA, XMLJNDI, JMS, JPA, XML
JNDI, JMS, JPA, XMLKumar
 
EJB Fundmentals
EJB FundmentalsEJB Fundmentals
EJB FundmentalsKumar
 
JSP and struts programming
JSP and struts programmingJSP and struts programming
JSP and struts programmingKumar
 
java servlet and servlet programming
java servlet and servlet programmingjava servlet and servlet programming
java servlet and servlet programmingKumar
 
Introduction to JDBC and JDBC Drivers
Introduction to JDBC and JDBC DriversIntroduction to JDBC and JDBC Drivers
Introduction to JDBC and JDBC DriversKumar
 
Introduction to J2EE
Introduction to J2EEIntroduction to J2EE
Introduction to J2EEKumar
 

Mehr von Kumar (20)

Graphics devices
Graphics devicesGraphics devices
Graphics devices
 
Fill area algorithms
Fill area algorithmsFill area algorithms
Fill area algorithms
 
region-filling
region-fillingregion-filling
region-filling
 
Bresenham derivation
Bresenham derivationBresenham derivation
Bresenham derivation
 
Bresenham circles and polygons derication
Bresenham circles and polygons dericationBresenham circles and polygons derication
Bresenham circles and polygons derication
 
Introductionto xslt
Introductionto xsltIntroductionto xslt
Introductionto xslt
 
Extracting data from xml
Extracting data from xmlExtracting data from xml
Extracting data from xml
 
Xml basics
Xml basicsXml basics
Xml basics
 
XML Schema
XML SchemaXML Schema
XML Schema
 
Publishing xml
Publishing xmlPublishing xml
Publishing xml
 
DTD
DTDDTD
DTD
 
Applying xml
Applying xmlApplying xml
Applying xml
 
Introduction to XML
Introduction to XMLIntroduction to XML
Introduction to XML
 
How to deploy a j2ee application
How to deploy a j2ee applicationHow to deploy a j2ee application
How to deploy a j2ee application
 
JNDI, JMS, JPA, XML
JNDI, JMS, JPA, XMLJNDI, JMS, JPA, XML
JNDI, JMS, JPA, XML
 
EJB Fundmentals
EJB FundmentalsEJB Fundmentals
EJB Fundmentals
 
JSP and struts programming
JSP and struts programmingJSP and struts programming
JSP and struts programming
 
java servlet and servlet programming
java servlet and servlet programmingjava servlet and servlet programming
java servlet and servlet programming
 
Introduction to JDBC and JDBC Drivers
Introduction to JDBC and JDBC DriversIntroduction to JDBC and JDBC Drivers
Introduction to JDBC and JDBC Drivers
 
Introduction to J2EE
Introduction to J2EEIntroduction to J2EE
Introduction to J2EE
 

Kürzlich hochgeladen

The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingTeacherCyreneCayanan
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...PsychoTech Services
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024Janet Corral
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajanpragatimahajan3
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 

Kürzlich hochgeladen (20)

The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajan
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 

Instruction, interrupts & io processing

  • 1. Unit 5 -INSTRUCTION, INTERRUPTS and IO PROCESSING Abhineet Anand Computer Science and Engg. Department University of Petroleum and Energy Studies, Dehradun December 9, 2012 Abhineet Anand (UPES, Dehradun) INST n , INTERRUPTS, IO PROCESSING December 9, 2012 1 / 23
  • 2. Outline 1 Instruction Codes Introduction Operation Code Operands 2 Instruction Formats Single accumulator organization General register organization Stack organization Evaluation of Arithmetic Statement 3 Addressing Modes Type of Addressing Modes 4 Program Interrupt Types of Interrupts Abhineet Anand (UPES, Dehradun) INST n , INTERRUPTS, IO PROCESSING December 9, 2012 2 / 23
  • 3. Instruction Codes A Computer instruction is binary code that specifies a sequence of micro operation for the Computer. The Computer reads each instruction from memory and places it in a control register. The control then interprets the binary code of the instruction and proceeds to execute it by issuing a sequence of micro operations. Abhineet Anand (UPES, Dehradun) INST n , INTERRUPTS, IO PROCESSING December 9, 2012 3 / 23
  • 4. Instruction Codes An instruction code is a group of bits that instruct the computer to perform a specific task. It is usually divided into parts, each having its own particular interpretation. They are: Operation Code, and Operands. The most basic part of an instruction code is its operation part. Abhineet Anand (UPES, Dehradun) INST n , INTERRUPTS, IO PROCESSING December 9, 2012 4 / 23
  • 5. Operation Code The Operation Code (OpCode) of an instruction is a group of bits that define each operation such add, subtract, multiply, shift, and complement. It must consist of at least n bits for a given 2n distinct operations. Suppose we are having 64 (26 ) operation then the length of OpCode will be 6. The control unit decode the OpCode and do the required operation. Abhineet Anand (UPES, Dehradun) INST n , INTERRUPTS, IO PROCESSING December 9, 2012 5 / 23
  • 6. Operands The Operation must be performed on some data stored in processor register or in memory. Every Computer has its own particular instruction code format. The Simplest way to organize a computer is to have an instruction code format with two parts. The first part specifies the operation to be performed and the second specifies an address. Abhineet Anand (UPES, Dehradun) INST n , INTERRUPTS, IO PROCESSING December 9, 2012 6 / 23
  • 7. Instruction Formats The bits of the instruction are divided into groups called fields. The most common fields found in instruction formats are: An Operation Code field that specifies the operation to be performed. An Address field that designates a memory address or a processor register. A mode field that specifies the way the operand or the effective address is determined. Abhineet Anand (UPES, Dehradun) INST n , INTERRUPTS, IO PROCESSING December 9, 2012 7 / 23
  • 8. Instruction Formats Computer may have instruction of several different lengths containing varying numbers of addresses. The number of address fields in the instruction format of a computer depends on the internal organization of its registers. Most computers fall into one of three types of CPU organization: 1 2 3 Single accumulator organization. General register organization. Stack organization. Abhineet Anand (UPES, Dehradun) INST n , INTERRUPTS, IO PROCESSING December 9, 2012 8 / 23
  • 9. Single accumulator organization All Operation are performed with an implied accumulator register. The instruction format in this type of computers uses one address field. Example: ADD X where, X is the address of the operand. The ADD instruction in this case results in the operation AC < − AC + M[X]. Abhineet Anand (UPES, Dehradun) INST n , INTERRUPTS, IO PROCESSING December 9, 2012 9 / 23
  • 10. General register organization The instruction format in this type of computer needs three register address fields. Thus the instruction for an arithmetic addition may be written in an assembly language as ADD R1, R2, R3 to denote the operation R1 < − R2 + R3. The number of address fields in the instruction can be reduced from three to two if the destination register is the same as one of the source registers. ADD R1, R2 would denote the operation R1 < − R1 + R2. Abhineet Anand (UPES, Dehradun) INST n , INTERRUPTS, IO PROCESSING December 9, 2012 10 / 23
  • 11. Stack organization The stack-organized CPU would have PUSH and POP instruction which requires an address filed. Example: PUSH X will push the word at address X to the top of the stack. The stack pointer is updated automatically. The operation is performed on the two items that are on top of the stack. Abhineet Anand (UPES, Dehradun) INST n , INTERRUPTS, IO PROCESSING December 9, 2012 11 / 23
  • 12. Evaluation of Arithmetic Statement X=(A+B)∗(C+D) Three - Address Instruction ADD R1, A, B R1 < − M[A] + M[B] ADD R2, C, D R2 < − M[C] + M[D] MUL X, R1, R2 M[X] < − R1 ∗ R2. Two - Address Instruction MOV R1, A R1 < − M[A] ADD R1, B R1 < − R1 + M[B] MOV R2, C R2 < − M[C] ADD R2, D R2 < − R2 + M[D] MUL R1, R2 R1 < − R1 ∗ R2 MOV X, R1 M[X] < − R1 Abhineet Anand (UPES, Dehradun) INST n , INTERRUPTS, IO PROCESSING December 9, 2012 12 / 23
  • 13. Evaluation of Arithmetic Statement One - Address Instruction LOAD A AC< − M[A] ADD B AC < − AC + M[B] STORE T M[T] < − AC LOAD C AC < − M[C] ADD D AC< − AC + M[D] MUL T AC < − AC ∗ M[T] STORE X M[X] < − AC Zero - Address Instruction PUSH A TOS < − A PUSH B TOS < − B ADD TOS < − (A + B) PUSH C TOS < − C PUSH D TOS < − D ADD TOS < −(C + D) MUL TOS < − (C + D) * (A+ B) POP X M[X] < − TOS Abhineet Anand (UPES, Dehradun) INST n , INTERRUPTS, IO PROCESSING December 9, 2012 13 / 23
  • 14. Addressing Modes The way the operands are chosen during program execution is dependent on the addressing mode of the instruction. The addressing mode specifies a rule for interpreting or modifying the address field of the instruction before the operand is actually referenced. An Operation Code field that specifies the operation to be performed. An Address field that designates a memory address or a processor register. A mode field that specifies the way the operand or the effective address is determined. Abhineet Anand (UPES, Dehradun) INST n , INTERRUPTS, IO PROCESSING December 9, 2012 14 / 23
  • 15. Addressing Modes Computer use addressing mode techniques for the purpose of accommodating one or both of the following provisions: To give programming versatility to the user by providing such facilities as pointers to memory, counters for loop control, indexing of data, and program relocation. To reduce the number of bits in the addressing field of the instruction. Abhineet Anand (UPES, Dehradun) INST n , INTERRUPTS, IO PROCESSING December 9, 2012 15 / 23
  • 16. Type of Addressing Modes Although most addressing mode modify the address field of the instruction, there are two modes that need no address field at all. These are: Implied Mode: Operands are specified implicitly in the definition of the instruction. Like ”Complement Accumulator”. Zero-Address instruction in a stack-organized computer are implied-mode instruction since the operands are implied to be on top of the stack. Immediate Mode: In this mode the operand is specified in the instruction itself. Immediate-mode instruction are useful for initializing registers to a constant value. Abhineet Anand (UPES, Dehradun) INST n , INTERRUPTS, IO PROCESSING December 9, 2012 16 / 23
  • 17. Type of Addressing Modes Register Mode: In this mode the operands are in register that reside within the CPU. The particular register is selected from a register filed in the instruction. Register Indirect Mode: In this mode the instruction specifies a register in the CPU whose content give the address of the operand in memory. The advantage is that the address field of the instruction uses a fewer bits to select a register than would have been required to specify a memory address directly. Abhineet Anand (UPES, Dehradun) INST n , INTERRUPTS, IO PROCESSING December 9, 2012 17 / 23
  • 18. Type of Addressing Modes Auto-increment Mode or Auto-decrement Mode Direct Address Mode Indirect Address Mode Relative Address Mode Indexed Addressing Mode Base Register Addressing Mode Abhineet Anand (UPES, Dehradun) INST n , INTERRUPTS, IO PROCESSING December 9, 2012 18 / 23
  • 19. Program Interrupt The concept of program interrupt is used to handle a variety of problems that arise out of normal program sequence. Program interrupt refers to the transfer of program control from a currently running program to another service program as a result of an external or internal generated request. Control returns to the original program after the service program is executed. Abhineet Anand (UPES, Dehradun) INST n , INTERRUPTS, IO PROCESSING December 9, 2012 19 / 23
  • 20. Program Interrupt The interrupt procedure is, in principal, quite similar, to subroutine call except for three variation: 1 2 3 The interrupt is usually initiated by an internal or external signal rather than from the execution of an instruction; The address of the interrupt service program is determined by the hardware rather than from the address field of instruction; and an interrupt procedure usually stores all the information necessary to define the state of the CPU rather than storing only the program counter. Abhineet Anand (UPES, Dehradun) INST n , INTERRUPTS, IO PROCESSING December 9, 2012 20 / 23
  • 21. Program Interrupt These three procedure concept are clarified further as: 1 2 3 The content of the program counter The content of all processor register The content of certain status conditions The collection of all status bit conditions in the CPU is sometimes called a Program Status Word or PSW. Abhineet Anand (UPES, Dehradun) INST n , INTERRUPTS, IO PROCESSING December 9, 2012 21 / 23
  • 22. Types of Interrupts There are three major types of interrupts that cause a break in the normal execution of a program. They are: 1 2 3 External Interrupts - come from input-output (I/O) devices, from a timing devices, from a circuit monitoring the power supply, or from any other external source. Example: I/O devices requesting for transfer of data, I/O devices finished transfer of data, elapsed time of an event, or power failure. Internal Interrupts - arise from illegal or erroneous use of an instruction or date, also known as trap. Example: register overflow, divide by zero, invalid operation code, stack overflow, protection violation. Software Interrupts - initiated by executing an instruction. It is a special call instruction that behaves like an interrupt rather than a subroutine call. Abhineet Anand (UPES, Dehradun) INST n , INTERRUPTS, IO PROCESSING December 9, 2012 22 / 23
  • 23. THANK YOU Abhineet Anand (UPES, Dehradun) INST n , INTERRUPTS, IO PROCESSING December 9, 2012 23 / 23