7. Memory mapped I/O, Busses, Point-to-point Communication

Class outline

  1. Program access to I/O device - I/O read/write.
  2. Bus, basic terms
  3. Circuits and schematics of I/O device
  4. PCI Bus

What should I know before the class

  1. To understand lectures I/O subsystem I, II.
  2. To understand programs from previous class.
  3. Basics of logical systems - gates, flip-flop circuits.

What shall we do

I/O Device Access

The aim of today's class is to read/write values from/to memory mapped device. Use following template:

#define t0 $8
#define t1 $9
#define t2 $10

#define s0 $16
#define s1 $17
#define s2 $18

.globl start
.set noat
.set noreorder
.ent start

// Your code here

.end start


Work in Mips.exe simulator. 8-bit I/O port is memory mapped on address 0xBF900000.

Write values to output port
  1. Write a program, which shows a 8bit number from register s1 on output device (LEDs).
  2. Extend your program with infinite loop and in it show sequence of following numbers (in binary):

.word  1, 2, 4, 8, 16, 32, 65, 48, 66, 51, 54, 65, 80, 79, 1, 2, 3

Read from input port
  1. Write a program which reads a 8bit value from input peripheral (switches) to register s1.
  2. Extend your program to read a value from input peripherals, this value will be an index to array above. The program then will display on LEDs a value from the array. If the index is bigger than size of the array, the program will set all LEDs to ones (turns on all LEDs).

Bus and Point-to-point

Basic terms

  1. Bus vs. Point-to-point
    1. What do they have in common and in what are they different?
    2. Show example of point-to-point.
    3. Show example of bus.
  2. I/O device
    1. Describe basic block for generic I/O device on a bus? (hint: there are several devices on a bus, duplex communication).
    2. Describe briefly difference between input and output gate?
  3. Addressing
    1. Explain individual and group addressing.
    2. Explain two-layered addressing, why should I use it? Can you give example of two-layered addressing?
    3. What is the relocation of the bus device?
    4. What is a address space mirroring?

Circuit realization for I/O device

Circuit realization of I/O device on PCI and more modern is too complex for the introductory course like ours. For our educational purposes it is more suitable to show you circuit realization of old ISA bus.

Address decoder:

Simple I/O device:

  1. Describe address decoder. Lets have a 16b bus. The device has 64 I/O registers. Task: show how to place a registry field to I/O space, begining at address 0x1480. You can use only one 74LS688 circuit.
  2. Discuss address mirroring of our device.
Possible complete solution

  1. Is this device relocable?
  2. Which address should I use to access the device?
  3. Is there an address space mirroring?


  1. With help of lspci utility display PCI devices in your computer.
  2. Find details about PCI devices, addresses in memory and I/O space, they use.
  3. Using lspci -xxx display config space of given PCI device and for selected devices find out:
    • type of the device
    • manufacturer
    • memory addresses it uses
    • I/O addresses it uses
Design of PCI device

In lectures you have seen examples of building blocks usable for PCI device, including control finite state automaton. Extend this design to add a configuration read and write. (A diagram for config read and write: )

courses/b35apo/en/tutorials/08/start.txt ยท Last modified: 2018/02/11 17:30 (external edit)