- The CPU is connection to
the memory and
- also - to
a number of
IO devices:
- Although IO devices comes in many shapes and forms,
to enable an IO device to be included within a computer system,
the following design of IO device is universally adapted
for cost-efficiency reasons.
An IO device always consists of 2 parts:
- The actual IO device itself (that's the part you would
"recognize" as an IO device, e.g., the disk, the mouse,
the terminal, the scanner, etc).
- The interface, - that's the part of the IO device that
you do not usually see, unless you have opened your computer.
It consists of a circuit board containing chips and
other electrical components
Example:
Can you see the
circuit board inside the
hard drive ????
That's the interface !!!
The hard drive consist of:
- The hard drive (is some platters hidden inside the metal enclosure)
- The
interface that connects the
hard drive
to
the System Bus
(= the circuit board in the photo)
|
- The motherboard of your average PC already contains
the most often used interfaces/controllers:
- Parallel interfaces (or parallel ports - typically used to
control printer and scanners)
- Serial interfaces (typically used to control slower devices like
mouse, modem, etc)
- USB (Universal Serial Bus) interfaces. (Higher speed serial device,
is even faster than the traditional parallel port.
Can even handle 11 Mbps wireless network connections.
Very commonly used to control any type of slow to medium speed
IO devices.)
- Firewire interfaces - very high speed serial device.
Since the most common interfaces are already on the motherboard,
it is no wonder that you will rarely see an interface card.
You can easily tell when the interface of the IO device is already included
inside the computer (motherboard) or not: when you buy an IO device and
you don't have to open your computer to install the IO device,
then the interface is included inside the computer (motherboard).
One example that you will see the actual interface card is when you
installs a Network Interface Card or "NIC" (but networking capability
is becoming more and more popular and a NIC may eventually be included also).
Another example is when you install a SCSI card in your PC to allow
your PC to use higher speed SCSI hard disks.
- Sometimes, the interface (or controller) is included with the IO device.
An example is IDE devices.
IDE is the abbreviation of either "Intelligent Drive Electronics" or
"Integrated Drive Electronics", depending on who you ask.
The IDE interface is an interface used in mass storage devices and
the controller is integrated into the hard disk or CD-ROM drive unit.
Low end PC usually have 2 IDE controllers and
each IDE controller can control 2 IDE devices such as hard drives
and CD ROMS.
- The interface
is remarkably uniform for all IO devices...
well, it has to, because the interface circuit board
(interface card) is inserted onto the motherboard
of the computer system.
- The interface is a circuit board or "card" that is plugged
into the motherboard and the interface is
connected to the system bus of the computer system
(the system bus is on the motherboard).
- The CPU can only interact with the interface
(and because the interface
controls the actual IO device,
the CPU interact with the
IO device indirectly)
- Specifically: the interface circuit contains registers
that the CPU can read and write.
|
In particular, there is
always a
command register to which
the CPU can write a command code.
The command code will trigger the circuitry to make
the IO device perform the specified operation.
- The interface consists of:
- Hardware (electronics) to control the actual IO device
- Registers
that can be read
(e.g., status rgeister) and/or written
(e.g., command register) by the
CPU (through the system bus).
|
Note:
- The registers in an
IO device are
simply memory cells
(just like the memory cells found in the
memory device !!!)
- The only difference
is the content of these
registers can
trigger the
IO device hard ware to
perform certain operation !!!
|
- The CPU can read and/or write
the registers
in the IO interface card
just like it does with memory.
You have already seen how CPU communicates with memory...
For example, if the CPU wants to read a memory location:
- CPU sends out address, MREQ and READ request
- CPU waits until the memory removed the WAIT signal
- When the WAIT signal is off (memory data is ready),
CPU copies the data on the databus into MBR and
move it to its final destination (usually a register)
- All this has been explained here:
click here
and
click here
-
How the CPU make an IO device do its work
- In theory, the CPU can communicate with an IO device
in the same way... if the CPU wants to read an IO device,
say the keyboard, the CPU could:
- CPU sends out address of the keyboard and a READ request
- CPU waits until the keyborad removed the WAIT signal
- When the WAIT signal is off (keyboard data is ready on the databus),
CPU copies the data on the databus into MBR and
move it to its final destination (usually a register)
- But if the CPU uses the above communication technique to
communcate with an IO device, you will never want to
touch a computer again in your life....
The computer will be very
sloooooooooooooooooooooow.....
The reason why we can make the CPU wait on a transfer operation
to memory is because the memory is very fast -
finishes in about 50 nsec.
You do not want to make the CPU wait on a transfer operation
to an IO device is because it takes many milli-seconds
or even seconds in case of a keyboard, for the data to become
ready.
A milli-second is almost an eternity to the CPU: in a single milli-sec,
the CPU can execute tens of thousands of instructions.
- Hence, a new
off-line communication techniques
need to be developed to
facilitate the communication between the CPU and IO devices
whereby the CPU do not wait for the IO device.
- Realising off-line data transfer to/from IO device to memory
will necesitate the implementation of the following 3 functions:
- Addressing
the IO device: how to identify an IO device
- Data Transfer:
how to transfer data from IO device
to memory
(not to the CPU !, the memory is the storage area !) and vice versa
- Synchronization:
you will see that a program that performs
an IO operation will not be able to proceed with its execution.
That program must release the control of the CPU and
reclaim it when its data transfer operation has finished.
The reclaiming of the CPU is a form of synchronization
|
These 3 functions will be discussed next...