NivaarExam PrepOfficial exam papers ↗

22-Elec-A4 Digital Systems and Computers · May 2018

Question 5 of 6: Parallel I/O — CPU communication and handshake protocols

Nivaar worked solution (AI-drafted; not reviewed by a licensed engineer)

Notes on this paper

National Exams — May 2018 · 16-Elec-A4 Digital Systems & Computers. Closed book, 3 hours. Six questions, 12 marks each; the rubric requires any five, but all six are solved here as a study resource. Approved Casio/Sharp calculator permitted. A Boolean-identity table and the flip-flop excitation table are supplied with the paper (reproduced where used).

Reference texts. M. M. Mano & M. D. Ciletti, Digital Design (6th ed.) — number systems, Boolean minimization, sequential logic; J. F. Wakerly, Digital Design: Principles and Practices (5th ed.) — counters, registers, PLDs; C. Hamacher, Z. Vranesic, S. Zaky & N. Manjikian, Computer Organization and Embedded Systems (6th ed.) — parallel I/O, handshaking, memory-mapped ports; Motorola M68HC11 Reference Manual — port addressing and instruction set.

Question 5: Parallel I/O — CPU communication and handshake protocols (12 marks)

Question text not reproduced: the examination questions are © Engineers and Geoscientists BC. Open the official past paper (linked at the top of this page) to read the question, then follow the worked solution below.

(a) Two methods for the CPU to communicate with the I/O interface. The two classical schemes are program-controlled (polled / programmed) I/O and interrupt-driven I/O. In polled I/O the CPU repeatedly reads a status bit in the interface and transfers a byte only when the bit signals "ready"; it is simple but wastes CPU cycles busy-waiting. In interrupt-driven I/O the interface asserts the IRQ line (shown in the figure) when it is ready, the CPU finishes its current instruction, vectors to a service routine, transfers the byte, and returns — so the CPU does useful work between transfers. (A third method, direct memory access (DMA), lets the interface move blocks to/from memory without the CPU handling each byte; it is the high-throughput extension of the same idea.)

(b) i. Three parallel data-exchange protocols between the interface and the external device:

  1. Simple / brute-force (unconditional) I/O — no handshake. The interface simply drives or samples the data lines, assuming the device is always ready. Used only when timing is guaranteed (e.g. a set of LEDs or switches).
  2. Strobed (pulsed / one-way) handshake — a single control pulse accompanies the data. The sender asserts one strobe line to say "data is valid now"; the receiver is assumed fast enough to capture it. One line (H1 or H2) is active.
  3. Fully interlocked (two-way / double) handshake — both control lines participate. The sender asserts "data available"; the receiver, when it has taken the data, asserts "data accepted"; only then does the sender remove the data and de-assert, and the receiver follows. Each edge is acknowledged, so the transfer self-paces to the slower party and works with devices of unknown speed.

(b) ii. The handshake lines H1 and H2. From the figure, H1 runs from the interface to the device and H2 from the device to the interface. Their common names are a data-ready / data-valid strobe and a data-accepted / acknowledge line; which one plays which role depends on the transfer direction, because the "sender" changes: