Next: 2.1 Interface Consistency
Up: Interface Consistency
Previous: 1 Background
The following is a simple example of an interface.
Consider a device that can be reserved by manipulating two signals (could be bits in a register, lines on a bus, variables, or wires): request and grant. Use of the device follows a simple four-phase protocol where a request is followed by a grant, after which the device can be used. When the use has finished, the request is removed and this is followed by the device removing the grant. The interface consists of the two signals plus the four-phase protocol. In Java the interface could be described as follows:In a systems design components from very different technologies are put together, and the interface description should be able to bridge the gaps between a range of technologies such as software (for a general purpose computer), software (for a specialized controller), various programmable hardware technologies such as FPGA, special purpose dedicated processors, synthesizable circuitry and hand-crafted ASICS.class device{ private boolean request; private boolean grant; }In addition to the syntactical information specifying the number, names, and types of the signals, the interface defines a protocol requiring the pair (request, grant) to change as follows:(false, false) -> (true, false) -> (true, true) -> (false, true) -> (false, false) -> ...The device is only assumed to work properly if all use of it follows this protocol. It is therefore an integral part of the interface that should be part of the written documentation.
Jorgen Staunstrup