We have just studied the READ bus protocol used to communicate with the memory:
We will now study how the CPU communicates with an IO device:
IO communication is a very complex problem and is solved using both hardware and software (interrupt handler !!)
IO devices are attached to the computer system:
An IO device is physically made up as 2 functional parts:
|
|
In CS355, we study how the computer system exchange data with an IO device through the interfac
An IO interface consists of 2 different sets of circuits:
The IOinterface contains special purpose registers that are connected to the system bus:
The registers are connected to the system bus in the same way as the memory circuit !!!
How does the CPU perform an IO operation (= give a command to an IO device):
The CPU sends the command (= data) to an IO device using the bus protocol !!!
How does the CPU input/ouput data from/to an IO device:
The CPU sends the read/write the data from/to an IO device using the bus protocol !!!
Because IO devices are relatively slow (compared to CPU), the status register can be read to check for readiness:
The CPU reads the status register from an IO device using the bus protocol !!!
Example: the CPU wants to print the letter 'A'
The CPU first writes the ASCII code for 'A' to the data register of the printer:
CPU then writes the command code for 'output' to the command register of the printer:
The command will start the output device (printer) to output the data in the data register !
While the printer is busy printing, the status will reflect that the IO device is not ready:
Note: the IO device will usually have a larger buffer that allows the CPU to write more data before the IO device become "not ready"
Consider the following naive way to print (all the characters in) a file:
while (not EOF) { Write next character to the printer's Data register Write the OUTPUT command to the printer's Command register Read the printer's Status register while ( status != READY ) // BUSY wait Read the printer's Status register } |
The naive way does work...
However: while the CPU is printing the file, the whole computer will stop working (because the CPU is busy printing the file !!!)
(Printing a large file can take a long time !!!)
|
Hence: (new) off-line communication techniques must be used in the communication between CPU and an IO device whereby the CPU do not have to wait !!
We will discuss the following 3 topics to understand IO communication:
|