Hardware Diagnosis as Program Debugging

Ajay GuptaIJCAI 1987

Introduction

In the late 1980s, hardware diagnosis was evolving from empirical, dictionary-based methods toward more flexible model-based approaches. This paper establishes a formal bridge between hardware engineering and computer science by framing physical hardware diagnosis as a software debugging problem. By representing digital circuits as Prolog programs, the author demonstrates that identifying a faulty physical component is mathematically equivalent to locating an incorrect line of code using Shapiro’s Model Inference System (MIS).

Definitional Circuit Representation

The core of this framework lies in modeling hardware structure and behavior using logic programming (Horn clauses). Each hardware module is represented as a pure-PROLOG clause where the head defines the module's "black-box" interface (inputs and outputs) and the body describes its internal sub-components and their connections via shared variables.

Figure 1: A full adder circuit used as a benchmark for combinational logic diagnosis.

A critical requirement in this representation is unique naming. Unlike software, where a function call is identical across instances, hardware consists of multiple physical instances of the same gate. Every module in the Prolog description must carry a unique name based on its hierarchical path, allowing the debugger to distinguish between a broken component and a functional one of the same type elsewhere in the circuit.

The Debugging Duality

The methodology employs a "duality flip" of Shapiro’s Model Inference System. In traditional software debugging, the code is assumed to be potentially incorrect while the user (the "oracle") knows the intended truth. In hardware diagnosis, the design (the code) is assumed to be correct, but the physical device under test is "wrong" due to a fault. By treating the physical device as the oracle and the design description as the "incorrect program," the MIS debugger identifies which part of the design description disagrees with the physical reality, thereby pinpointing the fault.

Key Results and Algorithmic Equivalence

The author successfully demonstrates that the "violated expectation" principle used in hardware diagnosis can be entirely reproduced through MIS contradiction backtracing. This approach provides a systematic way to narrow down faults through a series of logical queries.

Figure 5: Logic trace showing the sequence of queries used to isolate a faulty component in the full adder.

As shown in the logic traces, the system asks questions such as "Is the output of gate X correct?" to isolate discrepancies. The paper validates this using standard benchmarks like the full adder (combinational logic) and parity checkers (sequential logic). For sequential circuits, the framework handles state and history by representing signals as sequences of data over clock ticks, proving that the logic programming approach scales to circuits with memory.

Limitations and Future Work

While theoretically robust, the method faces practical hurdles in real-world application. The current model assumes "complete observability," meaning the system can measure signals on any internal wire. However, in modern integrated circuits, most wires are inaccessible, necessitating further research into partial observability and test-generation. Additionally, while effective for "stuck-at" faults, more complex failures like bridge faults (short circuits) may require more sophisticated refinement relations to be accurately diagnosed within this logic-based framework.

Summary updated

BibTeX
@inproceedings{gupta1987hardware,
  author = {Ajay Gupta},
  title = {{Hardware Diagnosis as Program Debugging}},
  booktitle = {International Joint Conference on Artificial Intelligence},
  year = {1987},
}
Figure