A processor and memory alone cannot read a book or print a report. They must be connected to keyboards, screens, printers and disks. These devices are different from the processor in speed and in the way they work, and the interface makes the connection possible.

Peripheral Devices

Peripheral devices are the input, output and storage devices connected to a computer. Input devices include the keyboard and the mouse. Output devices include the monitor and the printer. Storage devices include magnetic disks and tapes. The devices are electromechanical and much slower than the processor, and they work with data formats that differ from the word of the computer.

Definition: Input-output interface. A hardware module placed between the processor bus and a peripheral device that resolves differences in speed, data format and signals between them.

Input-Output Interface

An interface performs several tasks. It decodes the device address, it holds data and status information, it synchronises the speed of the device with that of the processor, and it converts the data between serial and parallel form where necessary. It gives the processor a set of registers for data, status and control.

Table 4.5: Functions of an input-output interface

Function Purpose
Address decoding Recognises which device the processor addresses
Data buffering Holds data during the transfer
Status and control Reports ready or busy and accepts commands
Format conversion Changes between serial and parallel data
Speed matching Joins a slow device to a fast processor

Isolated and Memory-Mapped Input-Output

In isolated input-output separate instructions, IN and OUT, and a separate control line address the devices, and their addresses are not part of the memory addresses. In memory-mapped input-output the device registers share the memory address space, and ordinary load and store instructions are used. Table 4.6 compares the two.

Table 4.6: Isolated and memory-mapped input-output

Feature Isolated Memory-mapped
Address space Separate Shared with memory
Instructions Special IN and OUT Ordinary load and store
Memory space Not reduced Reduced by device addresses
Control lines Separate Same as for memory

Example 4.5: Device address in memory-mapped input-output

Problem: A system uses memory-mapped input-output, and a printer data register is at address F000 (hexadecimal) of a 16-bit address space. How much memory space is left for programs if the addresses F000 to FFFF belong to devices?

Solution:

  1. The whole address space is 2 to the power 16 = 65,536 bytes.
  2. The addresses F000 to FFFF are 4,096 bytes.
  3. Space left = 65,536 - 4,096 = 61,440 bytes.

Result: 61,440 bytes remain for memory, which shows the cost of memory-mapped input-output.

total = 2 ** 16
dev = 0xFFFF - 0xF000 + 1
print(dev, total - dev)

Output

4096 61440

Common mistakes

  • Assuming that peripherals work at the speed of the processor.
  • Treating device addresses as separate in memory-mapped input-output.
  • Forgetting that the interface also holds status information.

Key takeaways

  • Peripherals are input, output and storage devices.
  • The interface matches speed, data format and signals.
  • Isolated I/O uses special instructions; memory-mapped I/O uses ordinary ones.
  • Memory-mapped devices take away part of the memory address space.

Practice questions

  1. What is the purpose of an input-output interface?
  2. Name one difference between isolated and memory-mapped I/O.
  3. Give two examples of output devices.

Answers to the practice questions

  1. To match the speed, format and signals of a peripheral to those of the processor bus.
  2. Isolated I/O has a separate address space and special instructions; memory-mapped I/O shares the memory address space.
  3. The monitor and the printer.

Sources

  • Official BCA syllabus Computer Architecture, course code 25BCA401DS02, Unit IV