Tutorial 5: IO part 1

Note

This is for practice, not for marks. Treat this as additional study material to help you develop your knowledge and skills on these topics. During the tutorial session, the TA will explain how to solve these problems.

Question 1

  1. The input status bit in an interface circuit is cleared as soon as the input data register is read. Why is this important?

  2. What is the difference between a subroutine and an interrupt-service routine?

Question 2

Assume that a memory location BINARY contains a 32-bit pattern. It is desired to display these bits as eight hexadecimal digits on a display device that has the interface depicted below. Write a program that accomplishes this task.

../_images/DISP_interface.png

Question 3

A computer is required to accept characters from the keyboard input of 20 terminals. The main memory area to be used for storing data for each terminal is pointed to by a pointer PNTRn, where n = 1 through 20. Input data must be collected from the terminals while another program PROG is being executed. This may be accomplished in one of two ways:

  1. Every T seconds, program PROG calls a polling subroutine POLL. This subroutine checks the status of each of the 20 terminals in sequence and transfers any input characters to the memory. Then it returns to PROG.

  2. Whenever a character is ready in any of the interface buffers of the terminals, an interrupt request is generated. This causes the interrupt routine INTERRUPT to be executed. INTERRUPT polls the status registers to find the first ready character, transfers it, and then returns to PROG.

Write the routines POLL and INTERRUPT given the interface of a keyboard device in the below figure. Let the maximum character rate for any terminal be c characters per second, with an average rate equal to rc, where r ≤ 1. In method (1), what is the maximum value of T for which it is still possible to guarantee that no input characters will be lost? What is the equivalent value for method (2)? Estimate, on the average, the percentage of time spent in servicing the terminals for methods (1) and (2), for c = 100 characters per second and r = 0.01, 0.1, 0.5, and 1. Assume that POLL takes 800 ns to poll all 20 devices and that an interrupt from a device requires 200 ns to process.

../_images/KBD_interface.png