2024 25 7a

Computer Organization and Architecture2024-257 marksPeripheral devices, I/O interface, I/O ports

Describe the role of peripheral devices in a computer system and explain how they interact with the CPU through I/O interfaces and ports?

Describe the role of peripheral devices in a computer system and explain how they interact with the CPU through I/O interfaces and ports?

Quick answer

Peripheral devices connect a computer to the outside world. Without them, the CPU and memory could compute but could not receive any data or show any result. They have three roles.

Role of peripheral devices

  • Input: devices such as the keyboard, mouse and scanner bring data and commands into the computer.
  • Output: devices such as the monitor and printer show or print the results for the user.
  • Storage: devices such as the hard disk, SSD and tape keep programs and data for a long time, as main memory loses its contents on power off.

Communication devices such as network cards and modems connect the computer to other computers.

Differences from the CPU

Peripherals differ from the CPU in many ways. They are slower, since they often have mechanical parts. They send data in different formats, for example serial bits or analog signals. They use different voltage levels and timing. Each device also works at its own speed. So the CPU cannot be connected to the device directly.

Interaction through the I/O interface and ports

An I/O interface is placed between the device and the CPU buses. It does the following work.

  • It decodes the address and selects the right device.
  • It holds data in a buffer register, to match the speeds.
  • It changes the data format and signal levels.
  • It gives status information, such as ready, busy and error, and takes commands.
  • It raises interrupts when the device needs attention.

The CPU sees the interface as a few registers, called ports. These are the data port, the status port and the control port.

 CPU <--> System buses <--> [ I/O interface ] <--> Device
                           (data, status, control ports)

To output a character to a printer, the CPU first reads the status port to check that the printer is ready. Then it writes the character to the data port. The interface passes it to the printer with the correct handshake signals. The CPU can then be informed about completion by a status flag or by an interrupt.

To get a key from a keyboard, the key press sets the ready flag in the status port. The CPU reads the data port to get the key code, and this clears the flag.

The ports are addressed either by special IN and OUT instructions (isolated I/O), or by ordinary memory instructions (memory mapped I/O). Larger transfers use DMA, so that the CPU is not involved in every word. In this way the interface and ports let a fast CPU work smoothly with many different and slow devices.

Short on time? The 1, 5 and 10 mark versions of this answer, flashcards and practice sets come with a program pass.

Up nextExplain the Direct Memory Access (DMA) techniques for data transfer?