SlideShare a Scribd company logo
1 of 22
Accessing I/O Devices
I/O Device 1 I/O Device 2
Processor Memory
BUS
Parallel I/O
• I/O devices connect to processor through PORTS
• Ports are:
 registers (part of the I/O interface)
 8, 16, or 32 bits wide
Addressed in the range 0000-FFFFh
Accessed with 2 instructions – IN, OUT
Modes of I/O Instructions
• Direct I/O – the port address is one of the operands.
– Address must be 00-FFh.
• IN AL, 27h
– Data flows through the accumulator
• MOV AX, BX
• OUT 26h, AX ; move 16-bit data from AX to port
; 26h (AL to 26h and AH to 27h)
• Indirect I/O – the port address is preloaded into DX
– Address can be 0000-FFFFh
• String I/O – allows data to pass directly through the
accumulator (from I/O device to memory)
80x86 I/O Instructions
Type Instruction Description
Direct IN AL, port input data to accumulator
IN AX, port port must be in range 00-FFh
IN EAX, port
OUT port, AL output data from accumulator
OUT port, AX port must be in range 00-FFh
OUT port, EAX
Indirect IN AL, DX input data to accumulator
IN AX, DX port address in DX must be in range 0000-FFFFh
IN EAX, DX
OUT DX, AL output data from accumulator
OUT DX, AX port address in DX must be in range 0000-FFFFh
OUT DX, EAX
String INSB input data to memory location DS:SI or DS:ESI
INSW port address in DX must be in range 0000-FFFFh
INSD
OUTSB output data from memory location DS:SI or DS:ESI
OUTSW port address in DX must be in range 0000-FFFFh
OUTSD
Ways to Differentiate I/O
• Memory-Mapped versus I/O-Mapped Ports
 address of 80x86 processors is divided into 1M, 4GB,
or 64GB of memory space and 64K of I/O space.
 With memory-mapped I/O, because I/O ports are
mapped to a memory address, any of the memory
read/write instructions are available to use. Address
can be computed using any of the addressing modes.
With I/O mapped ports, restricted to simple IN/OUT
instructions. Address must be in DX.
Memory Space
20-,32-,or36-bit
address
M/IO’ = 1
I/O Space
16-bit
address
M/IO’ = 0
Memory-Mapped I/O
• I/O Devices and memory share the same
address space.
– Each I/O Device is assigned a unique set of addresses.
– When the processor places a particular address on the
address lines, the device recognizing this address
responds to the commands on the control lines.
– The processor requests either a read or a write
operation, and the requested data is transferred over the
data lines.
– Any machine instruction that can access memory can
be used to transfer data to/from I/O devices.
• Mov datain, R0
Intel Architecture
• Intel processors have a separate 16-bit address
bus for I/O devices
• Designer has the option of
– connecting I/O devices to use special address space
– or simply incorporating them as part of the memory
address space.
• The later approach leads to simpler software.
• One advantage of a separate address bus for I/O is
reduced number of address lines needed for I/O
devices.
• Not physically separate address lines on processor.
Special signal (I/OR or I/OW, MemR or MemW)
Ways to Drive Hardware Devices
using Parallel Buses
• Programmed I/O through I/O ports
• Interrupt I/O using (hardware) interrupts
• Direct Memory Access
Programmed I/O
(driving Hardware devices through I/O ports)
• External devices are almost always connected not
directly to the system bus but to an INTERFACE.
• Registers in the interface allow for a wide range
of possibilities for the designer to determine how
it is to interface to the bus.
• TO avoid confusion with the main registers in the
8086, peripheral interface chip registers are
usually referred to as PORTS.
Interface Ports
• Typically consists of three registers
– Control Port - the setting of which will determine if the
interface is to send or receive.
– Data Port – for the data element to be transmitted or to
hold a data element received.
– Status Port – used to obtain information such as
“printer out of paper, don’t send any more data” or, for
a serial transmission, “all the bits of the data element
haven’t yet been received”
– Simple interfaces may have status and control
combined into one port; sophisticated ports may have
multiple control and status ports.
I/O Interface for an Input Device
Address
Decoder
Control
Circuits
Data and
Status Registers
Input Device
Address Lines
Data Lines
Control Lines
I/O Interface
I/O Device Speeds
• Processors can operate at speeds that are vastly
different than I/O speeds.
– When a human is entering characters on a keyboard,
the processor can execute millions of instructions
between successive character entries.
So, how does the processor handle I/O inputs…..
Three types of I/O Strategies
• Polled I/O
• Interrupt Driven I/O
• DMA I/O
Polled IO versus Interrupt Driven I/O
• Polled IO – processor continually checks IO
device to see if it is ready for data transfer
– Inefficient, processor wastes time checking for ready
condition
• Interrupt Driven IO – IO device interrupts
processor when it is ready for data transfer
– Processor can be doing other tasks while waiting for
last data transfer to complete – very efficient.
I/O Interfacing
• A lot of handshaking is required between
the CPU and most I/O devices.
• All I/O devices operate asynchronously
with respect to the CPU. The events that
determine when an input device has data
available or when an output device needs
data are independent of the CPU.
Three I/O strategies
• Must be capable of data rates fast enough to
keep up with the demands of the device, but
must not be allowed to transfer data faster
than the device can process it.
»Polled waiting loops
»Interrupt-driven I/O
»Direct memory Access (DMA)
Synchronization
• The CPU must have some way of checking
the status of the device and waiting until it
is ready to transfer
Transfer Rate
• A measure of the number of bytes per
second transferred between the CPU and an
external device.
• Maximum transfer rate – a measure of the
bandwidth capability of a particular method
of doing I/O.
Comparison of transfer rates
• Polled waiting loops provide data rates that are a
bit slower, but still quite reasonable.
• Interrupt-driven I/O requires overhead of saving
and restoring the machine state (significantly
degrades data rates unless more than one byte can
be transferred per interrupt.
• DMA has fastest transfer rates (additional
hardware complexity needed.
Latency
• Measure of the delay from the instant that
the device is ready until the time the first
data byte is transferred. Latency is
equivalent to the “response time”
Comparison of Latency
• Polled Waiting Loops – latency can be very
high (the computer may not even be
checking the device for new data when it
arrives).
• Interrupt-driven I/O – dramatically lower
than polled, but still imposes a software
overhead.
• DMA – very low (lower than the others)
Polled Waiting I/O
• Use software to test the status of a
device,before transferring each data byte.
• Continuously checking the peripheral’s
BUSY/READY flag
• Ties up the CPU – no other tasks can be
performed.

More Related Content

What's hot

input and output organisation
input and output organisation input and output organisation
input and output organisation sree deepika
 
Coal 14 input output devices in Assembly Programming
Coal 14 input output devices in Assembly ProgrammingCoal 14 input output devices in Assembly Programming
Coal 14 input output devices in Assembly ProgrammingMuhammad Taqi Hassan Bukhari
 
Minimum Modes and Maximum Modes of 8086 Microprocessor
Minimum Modes and Maximum Modes of 8086 MicroprocessorMinimum Modes and Maximum Modes of 8086 Microprocessor
Minimum Modes and Maximum Modes of 8086 MicroprocessorNikhil Kumar
 
Io processing
Io processingIo processing
Io processingTech_MX
 
Computer Organisation and Architecture
Computer Organisation and ArchitectureComputer Organisation and Architecture
Computer Organisation and ArchitectureSubhasis Dash
 
Memory mapped I/O and Isolated I/O
Memory mapped I/O and Isolated I/OMemory mapped I/O and Isolated I/O
Memory mapped I/O and Isolated I/OBharat Kharbanda
 
Architecture of 8085
Architecture of 8085Architecture of 8085
Architecture of 8085ShivamSood22
 
Input Output Operations
Input Output OperationsInput Output Operations
Input Output Operationskdisthere
 
Introduction to Interfacing Technique
Introduction to Interfacing TechniqueIntroduction to Interfacing Technique
Introduction to Interfacing TechniqueMabeth MaRiyah Ramos
 
Unit 4-lecte3-io interface
Unit 4-lecte3-io interfaceUnit 4-lecte3-io interface
Unit 4-lecte3-io interfacevishal choudhary
 
Input output accessing
Input output accessingInput output accessing
Input output accessingankitraosingh
 
8086 modes
8086 modes8086 modes
8086 modesPDFSHARE
 

What's hot (20)

Input output interface
Input output interfaceInput output interface
Input output interface
 
input and output organisation
input and output organisation input and output organisation
input and output organisation
 
Coal 14 input output devices in Assembly Programming
Coal 14 input output devices in Assembly ProgrammingCoal 14 input output devices in Assembly Programming
Coal 14 input output devices in Assembly Programming
 
Minimum Modes and Maximum Modes of 8086 Microprocessor
Minimum Modes and Maximum Modes of 8086 MicroprocessorMinimum Modes and Maximum Modes of 8086 Microprocessor
Minimum Modes and Maximum Modes of 8086 Microprocessor
 
Io processing
Io processingIo processing
Io processing
 
Unit 5
Unit 5Unit 5
Unit 5
 
Computer Organisation and Architecture
Computer Organisation and ArchitectureComputer Organisation and Architecture
Computer Organisation and Architecture
 
Memory mapped I/O and Isolated I/O
Memory mapped I/O and Isolated I/OMemory mapped I/O and Isolated I/O
Memory mapped I/O and Isolated I/O
 
Architecture of 8085
Architecture of 8085Architecture of 8085
Architecture of 8085
 
2.instrumentation ii
2.instrumentation ii2.instrumentation ii
2.instrumentation ii
 
i/o interface
i/o interfacei/o interface
i/o interface
 
Unit-4 (IO Interface).pptx
Unit-4 (IO Interface).pptxUnit-4 (IO Interface).pptx
Unit-4 (IO Interface).pptx
 
Chapter 9
Chapter 9Chapter 9
Chapter 9
 
Input Output Operations
Input Output OperationsInput Output Operations
Input Output Operations
 
Introduction to Interfacing Technique
Introduction to Interfacing TechniqueIntroduction to Interfacing Technique
Introduction to Interfacing Technique
 
8086
80868086
8086
 
Unit 4-lecte3-io interface
Unit 4-lecte3-io interfaceUnit 4-lecte3-io interface
Unit 4-lecte3-io interface
 
8086 conti
8086 conti8086 conti
8086 conti
 
Input output accessing
Input output accessingInput output accessing
Input output accessing
 
8086 modes
8086 modes8086 modes
8086 modes
 

Viewers also liked

Interfacing of io device to 8085
Interfacing of io device to 8085Interfacing of io device to 8085
Interfacing of io device to 8085Nitin Ahire
 
Interfacing of 8255 IC By Er. Swapnil Kaware.
Interfacing of 8255 IC By Er. Swapnil Kaware.Interfacing of 8255 IC By Er. Swapnil Kaware.
Interfacing of 8255 IC By Er. Swapnil Kaware.Prof. Swapnil V. Kaware
 
8085 Architecture & Memory Interfacing1
8085 Architecture & Memory Interfacing18085 Architecture & Memory Interfacing1
8085 Architecture & Memory Interfacing1techbed
 
Memory & I/O interfacing
Memory & I/O  interfacingMemory & I/O  interfacing
Memory & I/O interfacingdeval patel
 

Viewers also liked (6)

Chapter 5
Chapter 5Chapter 5
Chapter 5
 
Chapter5
Chapter5Chapter5
Chapter5
 
Interfacing of io device to 8085
Interfacing of io device to 8085Interfacing of io device to 8085
Interfacing of io device to 8085
 
Interfacing of 8255 IC By Er. Swapnil Kaware.
Interfacing of 8255 IC By Er. Swapnil Kaware.Interfacing of 8255 IC By Er. Swapnil Kaware.
Interfacing of 8255 IC By Er. Swapnil Kaware.
 
8085 Architecture & Memory Interfacing1
8085 Architecture & Memory Interfacing18085 Architecture & Memory Interfacing1
8085 Architecture & Memory Interfacing1
 
Memory & I/O interfacing
Memory & I/O  interfacingMemory & I/O  interfacing
Memory & I/O interfacing
 

Similar to Interfacingiodevice

io orgnz.ppt
io orgnz.pptio orgnz.ppt
io orgnz.pptVetriM4
 
Unit 4-l ecture3-io interface
Unit 4-l ecture3-io interfaceUnit 4-l ecture3-io interface
Unit 4-l ecture3-io interfacevishal choudhary
 
Unit 4-lecte3-io interface
Unit 4-lecte3-io interfaceUnit 4-lecte3-io interface
Unit 4-lecte3-io interfacevishal choudhary
 
The primary purpose of memory interfacing is to facilitate the transfer of da...
The primary purpose of memory interfacing is to facilitate the transfer of da...The primary purpose of memory interfacing is to facilitate the transfer of da...
The primary purpose of memory interfacing is to facilitate the transfer of da...Sindhu Mani
 
UNIT- 3.pptx
UNIT- 3.pptxUNIT- 3.pptx
UNIT- 3.pptxBASKARS53
 
Microprocessor and Application (8085)
Microprocessor and Application (8085)Microprocessor and Application (8085)
Microprocessor and Application (8085)ufaq kk
 
UNIT 3 Peripheral Interfacing.pptx
UNIT 3 Peripheral Interfacing.pptxUNIT 3 Peripheral Interfacing.pptx
UNIT 3 Peripheral Interfacing.pptxGowrishankar C
 
Input output in computer Orgranization and architecture
Input output in computer Orgranization and architectureInput output in computer Orgranization and architecture
Input output in computer Orgranization and architecturevikram patel
 
Input_Output_Organization.pptx
Input_Output_Organization.pptxInput_Output_Organization.pptx
Input_Output_Organization.pptxSherinRappai
 

Similar to Interfacingiodevice (20)

io orgnz.ppt
io orgnz.pptio orgnz.ppt
io orgnz.ppt
 
Unit4_IO_13623_AnilRawat.ppt
Unit4_IO_13623_AnilRawat.pptUnit4_IO_13623_AnilRawat.ppt
Unit4_IO_13623_AnilRawat.ppt
 
Ch11.ppt
Ch11.pptCh11.ppt
Ch11.ppt
 
Io organization
Io organizationIo organization
Io organization
 
Unit 4-l ecture3-io interface
Unit 4-l ecture3-io interfaceUnit 4-l ecture3-io interface
Unit 4-l ecture3-io interface
 
Unit 4-lecte3-io interface
Unit 4-lecte3-io interfaceUnit 4-lecte3-io interface
Unit 4-lecte3-io interface
 
The primary purpose of memory interfacing is to facilitate the transfer of da...
The primary purpose of memory interfacing is to facilitate the transfer of da...The primary purpose of memory interfacing is to facilitate the transfer of da...
The primary purpose of memory interfacing is to facilitate the transfer of da...
 
Ca 2 note mano
Ca 2 note manoCa 2 note mano
Ca 2 note mano
 
UNIT- 3.pptx
UNIT- 3.pptxUNIT- 3.pptx
UNIT- 3.pptx
 
1.instrumentation ii
1.instrumentation ii1.instrumentation ii
1.instrumentation ii
 
UNIT 2.pptx
UNIT 2.pptxUNIT 2.pptx
UNIT 2.pptx
 
interface
interfaceinterface
interface
 
Lecture 9.pptx
Lecture 9.pptxLecture 9.pptx
Lecture 9.pptx
 
I/O Channel IBM 370
I/O Channel IBM 370I/O Channel IBM 370
I/O Channel IBM 370
 
Microprocessor and Application (8085)
Microprocessor and Application (8085)Microprocessor and Application (8085)
Microprocessor and Application (8085)
 
UNIT 3 Peripheral Interfacing.pptx
UNIT 3 Peripheral Interfacing.pptxUNIT 3 Peripheral Interfacing.pptx
UNIT 3 Peripheral Interfacing.pptx
 
Input output in computer Orgranization and architecture
Input output in computer Orgranization and architectureInput output in computer Orgranization and architecture
Input output in computer Orgranization and architecture
 
Input_Output_Organization.pptx
Input_Output_Organization.pptxInput_Output_Organization.pptx
Input_Output_Organization.pptx
 
Lecture 36
Lecture 36Lecture 36
Lecture 36
 
Mpi unit i_8086_architectures
Mpi unit i_8086_architecturesMpi unit i_8086_architectures
Mpi unit i_8086_architectures
 

Recently uploaded

CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Blooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxBlooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxUnboundStockton
 
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxHistory Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxsocialsciencegdgrohi
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
ENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptx
ENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptxENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptx
ENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptxAnaBeatriceAblay2
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfadityarao40181
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
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
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxRaymartEstabillo3
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 

Recently uploaded (20)

CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Blooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxBlooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docx
 
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxHistory Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
ENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptx
ENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptxENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptx
ENGLISH5 QUARTER4 MODULE1 WEEK1-3 How Visual and Multimedia Elements.pptx
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdf
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
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
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 

Interfacingiodevice

  • 1. Accessing I/O Devices I/O Device 1 I/O Device 2 Processor Memory BUS
  • 2. Parallel I/O • I/O devices connect to processor through PORTS • Ports are:  registers (part of the I/O interface)  8, 16, or 32 bits wide Addressed in the range 0000-FFFFh Accessed with 2 instructions – IN, OUT
  • 3. Modes of I/O Instructions • Direct I/O – the port address is one of the operands. – Address must be 00-FFh. • IN AL, 27h – Data flows through the accumulator • MOV AX, BX • OUT 26h, AX ; move 16-bit data from AX to port ; 26h (AL to 26h and AH to 27h) • Indirect I/O – the port address is preloaded into DX – Address can be 0000-FFFFh • String I/O – allows data to pass directly through the accumulator (from I/O device to memory)
  • 4. 80x86 I/O Instructions Type Instruction Description Direct IN AL, port input data to accumulator IN AX, port port must be in range 00-FFh IN EAX, port OUT port, AL output data from accumulator OUT port, AX port must be in range 00-FFh OUT port, EAX Indirect IN AL, DX input data to accumulator IN AX, DX port address in DX must be in range 0000-FFFFh IN EAX, DX OUT DX, AL output data from accumulator OUT DX, AX port address in DX must be in range 0000-FFFFh OUT DX, EAX String INSB input data to memory location DS:SI or DS:ESI INSW port address in DX must be in range 0000-FFFFh INSD OUTSB output data from memory location DS:SI or DS:ESI OUTSW port address in DX must be in range 0000-FFFFh OUTSD
  • 5. Ways to Differentiate I/O • Memory-Mapped versus I/O-Mapped Ports  address of 80x86 processors is divided into 1M, 4GB, or 64GB of memory space and 64K of I/O space.  With memory-mapped I/O, because I/O ports are mapped to a memory address, any of the memory read/write instructions are available to use. Address can be computed using any of the addressing modes. With I/O mapped ports, restricted to simple IN/OUT instructions. Address must be in DX. Memory Space 20-,32-,or36-bit address M/IO’ = 1 I/O Space 16-bit address M/IO’ = 0
  • 6. Memory-Mapped I/O • I/O Devices and memory share the same address space. – Each I/O Device is assigned a unique set of addresses. – When the processor places a particular address on the address lines, the device recognizing this address responds to the commands on the control lines. – The processor requests either a read or a write operation, and the requested data is transferred over the data lines. – Any machine instruction that can access memory can be used to transfer data to/from I/O devices. • Mov datain, R0
  • 7. Intel Architecture • Intel processors have a separate 16-bit address bus for I/O devices • Designer has the option of – connecting I/O devices to use special address space – or simply incorporating them as part of the memory address space. • The later approach leads to simpler software. • One advantage of a separate address bus for I/O is reduced number of address lines needed for I/O devices. • Not physically separate address lines on processor. Special signal (I/OR or I/OW, MemR or MemW)
  • 8. Ways to Drive Hardware Devices using Parallel Buses • Programmed I/O through I/O ports • Interrupt I/O using (hardware) interrupts • Direct Memory Access
  • 9. Programmed I/O (driving Hardware devices through I/O ports) • External devices are almost always connected not directly to the system bus but to an INTERFACE. • Registers in the interface allow for a wide range of possibilities for the designer to determine how it is to interface to the bus. • TO avoid confusion with the main registers in the 8086, peripheral interface chip registers are usually referred to as PORTS.
  • 10. Interface Ports • Typically consists of three registers – Control Port - the setting of which will determine if the interface is to send or receive. – Data Port – for the data element to be transmitted or to hold a data element received. – Status Port – used to obtain information such as “printer out of paper, don’t send any more data” or, for a serial transmission, “all the bits of the data element haven’t yet been received” – Simple interfaces may have status and control combined into one port; sophisticated ports may have multiple control and status ports.
  • 11. I/O Interface for an Input Device Address Decoder Control Circuits Data and Status Registers Input Device Address Lines Data Lines Control Lines I/O Interface
  • 12. I/O Device Speeds • Processors can operate at speeds that are vastly different than I/O speeds. – When a human is entering characters on a keyboard, the processor can execute millions of instructions between successive character entries. So, how does the processor handle I/O inputs…..
  • 13. Three types of I/O Strategies • Polled I/O • Interrupt Driven I/O • DMA I/O
  • 14. Polled IO versus Interrupt Driven I/O • Polled IO – processor continually checks IO device to see if it is ready for data transfer – Inefficient, processor wastes time checking for ready condition • Interrupt Driven IO – IO device interrupts processor when it is ready for data transfer – Processor can be doing other tasks while waiting for last data transfer to complete – very efficient.
  • 15. I/O Interfacing • A lot of handshaking is required between the CPU and most I/O devices. • All I/O devices operate asynchronously with respect to the CPU. The events that determine when an input device has data available or when an output device needs data are independent of the CPU.
  • 16. Three I/O strategies • Must be capable of data rates fast enough to keep up with the demands of the device, but must not be allowed to transfer data faster than the device can process it. »Polled waiting loops »Interrupt-driven I/O »Direct memory Access (DMA)
  • 17. Synchronization • The CPU must have some way of checking the status of the device and waiting until it is ready to transfer
  • 18. Transfer Rate • A measure of the number of bytes per second transferred between the CPU and an external device. • Maximum transfer rate – a measure of the bandwidth capability of a particular method of doing I/O.
  • 19. Comparison of transfer rates • Polled waiting loops provide data rates that are a bit slower, but still quite reasonable. • Interrupt-driven I/O requires overhead of saving and restoring the machine state (significantly degrades data rates unless more than one byte can be transferred per interrupt. • DMA has fastest transfer rates (additional hardware complexity needed.
  • 20. Latency • Measure of the delay from the instant that the device is ready until the time the first data byte is transferred. Latency is equivalent to the “response time”
  • 21. Comparison of Latency • Polled Waiting Loops – latency can be very high (the computer may not even be checking the device for new data when it arrives). • Interrupt-driven I/O – dramatically lower than polled, but still imposes a software overhead. • DMA – very low (lower than the others)
  • 22. Polled Waiting I/O • Use software to test the status of a device,before transferring each data byte. • Continuously checking the peripheral’s BUSY/READY flag • Ties up the CPU – no other tasks can be performed.