Appearance
Spec: Fault Injection
Overview
Add the ability to inject faults into circuit components and wires during simulation, enabling users to study fault detection, debugging techniques, and test coverage analysis. Supports stuck-at faults, bridging faults, and intermittent faults.
Motivation
Understanding faults is crucial for:
- Teaching digital testing and DFT (Design for Test) concepts.
- Debugging circuits by isolating which faults explain observed behavior.
- Validating that test vectors achieve adequate fault coverage.
- Simulating real-world hardware failures for robustness analysis.
Requirements
Functional Requirements
Fault Types
- Stuck-at-0 (SA0): Force a pin or wire permanently to logic 0.
- Stuck-at-1 (SA1): Force a pin or wire permanently to logic 1.
- Stuck-at-Z (SAZ): Force a pin or wire permanently to high-impedance/floating.
- Bridging Fault: Short two unrelated wires together (AND-bridge or OR-bridge model).
- Delay Fault: Increase propagation delay of a component beyond its specification.
- Intermittent Fault: Fault activates/deactivates probabilistically or on a schedule.
- Bit-Flip Fault: Invert the signal at a specific point for a single clock cycle.
Fault Management
- Fault Injection UI: Right-click pin/wire → "Inject Fault" context menu.
- Fault List Panel: Display all active faults with type, location, and status.
- Enable/Disable Faults: Toggle faults on/off without removing them.
- Fault Profiles: Save/load collections of faults as named profiles.
- Conditional Faults: Faults that activate only after a specified condition (time, trigger signal).
Analysis
- Fault Coverage Report: Run test vectors against all possible SA faults and report coverage %.
- Fault Equivalence: Identify faults that produce identical behavior (fault collapsing).
- Fault Dictionary: Map each fault to its observable output signature.
- Visual Fault Indication: Faulted elements display a distinct visual marker (lightning bolt icon, red highlight).
Non-Functional Requirements
- Fault injection does not modify the underlying circuit design (faults are a simulation overlay).
- Fault simulation does not degrade non-faulted circuit simulation performance.
- Support up to 100 simultaneous active faults.
- Fault coverage analysis scales to circuits with up to 500 fault sites.
Design
Fault Model
csharp
public abstract class Fault
{
public Guid Id { get; set; }
public string Name { get; set; }
public FaultTarget Target { get; set; } // Pin or Wire reference
public bool IsActive { get; set; }
public FaultActivation Activation { get; set; } // Always, Conditional, Intermittent
public abstract Signal? OverrideSignal(Signal originalSignal);
}
public class StuckAtFault : Fault
{
public Signal StuckValue { get; set; } // High, Low, or Floating
public override Signal? OverrideSignal(Signal original) => StuckValue;
}
public class BridgingFault : Fault
{
public FaultTarget SecondTarget { get; set; }
public BridgeType Type { get; set; } // AND or OR
}
public class DelayFault : Fault
{
public int AdditionalDelay { get; set; } // extra ticks
}
public class IntermittentFault : Fault
{
public double Probability { get; set; } // 0.0 to 1.0
public int? CycleInterval { get; set; } // activate every N cycles
}Simulation Integration
Normal Evaluation Pass
→ Component.Evaluate() produces output signals
→ FaultInjector checks each output pin against active faults
→ If fault matches: override signal with fault value
→ Propagate (possibly faulted) signals downstreamThe FaultInjector is a simulation pass that runs after normal evaluation but before propagation, transparently inserting faults.
Fault Coverage Analysis
For each fault in collapsed fault list:
1. Inject single fault
2. Run all test vectors
3. Compare outputs to fault-free reference
4. If any output differs → fault detected
5. Record in fault dictionary
Coverage = detected_faults / total_faults × 100%Visual Indicators
- Faulted pin: small lightning bolt icon (⚡) overlay.
- Faulted wire: dashed red pattern along the wire.
- Fault panel: list view with columns (Name, Type, Location, Status, Detection).
Implementation Tasks
- Create
DigitalWorks.Core/Faults/namespace with fault type classes. - Implement
FaultInjectoras a simulation pass inSimulationStepEngine. - Implement stuck-at faults (SA0, SA1, SAZ).
- Implement bridging fault logic.
- Implement delay and intermittent fault models.
- Create fault injection context menu (right-click pin/wire).
- Create Fault List panel UI.
- Implement fault profiles (save/load fault sets).
- Implement fault coverage analysis engine.
- Implement fault dictionary generation.
- Add visual fault indicators on canvas.
- Create fault coverage report view.
Risks & Open Questions
- How to handle fault injection in macros (inject at macro pin or internal node)?
- Should fault coverage analysis be exhaustive (exponential) or use random sampling?
- Performance impact of running coverage analysis on large circuits (many fault sites × many test vectors)?
- Should faults persist in saved files or be session-only?
Priority
Medium — Excellent educational value for DFT courses, niche but differentiating.