I - O and The CPU
I - O and The CPU
The CPU needs to receive data from and send data to I/O
devices.
Why send to input devices?
E.g. set sensitivity, calibrate, switch on/off, …
Why receive from output devices?
E.g. check if ready, check if successful, …
I/O registers
Inside the device, not inside the CPU!
Advantages:
● No new instructions needed
● Simple
Disadvantages:
● Uses up some memory addresses (overall amount of
addressable memory is reduced)
● Programs may accidentally access I/O
(when the program has a bug)
Port-mapped I/O
Early PCs:
● 1 MB of memory addressable (220 addresses)
● But only 640 kB usable for programs, rest partly used for I/O
● ISA could handle both port-mapped and memory-mapped
Modern computers:
● 64 bit address space leaves more than enough room for
memory-mapped I/O
● Small embedded microcontrollers may still use ports
Summary