# suresh-vlsi/atpg-fault-detection-distillation architecture

> Architecture diagram of the GitHub repository suresh-vlsi/atpg-fault-detection-distillation, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/suresh-vlsi/atpg-fault-detection-distillation
- Repository: https://github.com/suresh-vlsi/atpg-fault-detection-distillation

## Overview

This repository is a VLSI fault-detection demonstration combining classical stuck-at ATPG and fault simulation with a teacher-to-student ML workflow. Users can parse a benchmark circuit, analyze faults and generate labeled data, train and evaluate models, then run a final student-inference demo. The graph preserves both documented flows. Edges are limited to relationships visible in excerpts or README statements; some model-training internals and final-demo wiring are documented but not shown in source excerpts.

Main entry points: [`main.py`](https://github.com/suresh-vlsi/atpg-fault-detection-distillation/blob/master/main.py) (ATPG runner), [`dataset_generator.py`](https://github.com/suresh-vlsi/atpg-fault-detection-distillation/blob/master/dataset_generator.py) (Dataset generator), [`dataset`](https://github.com/suresh-vlsi/atpg-fault-detection-distillation/tree/master/dataset) (Fault dataset), [`models`](https://github.com/suresh-vlsi/atpg-fault-detection-distillation/tree/master/models) (Saved models)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_circuit["Circuit and faults"]
  node_parser["Netlist parser<br/>[parser.py]"]
  node_circuit_rep["Circuit representation<br/>[circuit.py]"]
  node_fault_model["Stuck-at faults<br/>[fault.py]"]
end

subgraph group_atpg["ATPG and simulation"]
  node_atpg_driver["ATPG utilities<br/>[atpg.py]"]
  node_d_algorithm["D-algorithm<br/>[d_algorithm.py]"]
  node_simulator["Fault simulator<br/>[simulator.py]"]
  node_collapsing["Fault collapsing"]
  node_main["ATPG runner<br/>[main.py]"]
end

subgraph group_data["Dataset generation"]
  node_generator["Dataset generator"]
  node_dataset["Fault dataset"]
end

subgraph group_models["Model training"]
  node_teacher["Teacher model<br/>[teacher_model.py]"]
  node_student["Student distillation<br/>[student_model.py]"]
  node_model_artifacts["Saved models"]
end

subgraph group_inference["Evaluation and demo"]
  node_evaluation["Student evaluation"]
  node_demo["Inference demo<br/>[final_demo.py]"]
end

node_user(("Engineer"))

node_user -->|"runs ATPG"| node_main
node_main -->|"parses circuit"| node_parser
node_parser -->|"builds circuit"| node_circuit_rep
node_main -->|"generates faults"| node_fault_model
node_main -->|"reduces faults"| node_collapsing
node_main -->|"generates tests"| node_atpg_driver
node_atpg_driver -->|"searches patterns"| node_d_algorithm
node_atpg_driver -->|"verifies tests"| node_simulator
node_collapsing -->|"simulates faults"| node_simulator
node_user -->|"generates data"| node_generator
node_generator -->|"loads circuit"| node_parser
node_generator -->|"enumerates faults"| node_fault_model
node_generator -->|"labels samples"| node_simulator
node_generator -->|"writes CSV"| node_dataset
node_dataset -->|"trains on data"| node_teacher
node_teacher -->|"distills knowledge"| node_student
node_teacher -->|"saves model"| node_model_artifacts
node_student -->|"saves model"| node_model_artifacts
node_user -->|"evaluates student"| node_evaluation
node_evaluation -->|"reads samples"| node_dataset
node_evaluation -->|"loads models"| node_model_artifacts
node_user -->|"runs demo"| node_demo
node_demo -->|"loads student"| node_model_artifacts
node_demo -->|"reads data"| node_dataset

click node_parser "https://github.com/suresh-vlsi/atpg-fault-detection-distillation/blob/master/parser.py"
click node_circuit_rep "https://github.com/suresh-vlsi/atpg-fault-detection-distillation/blob/master/circuit.py"
click node_fault_model "https://github.com/suresh-vlsi/atpg-fault-detection-distillation/blob/master/fault.py"
click node_atpg_driver "https://github.com/suresh-vlsi/atpg-fault-detection-distillation/blob/master/atpg.py"
click node_d_algorithm "https://github.com/suresh-vlsi/atpg-fault-detection-distillation/blob/master/d_algorithm.py"
click node_simulator "https://github.com/suresh-vlsi/atpg-fault-detection-distillation/blob/master/simulator.py"
click node_collapsing "https://github.com/suresh-vlsi/atpg-fault-detection-distillation/blob/master/fault_collapsing.py"
click node_main "https://github.com/suresh-vlsi/atpg-fault-detection-distillation/blob/master/main.py"
click node_generator "https://github.com/suresh-vlsi/atpg-fault-detection-distillation/blob/master/dataset_generator.py"
click node_dataset "https://github.com/suresh-vlsi/atpg-fault-detection-distillation/tree/master/dataset"
click node_teacher "https://github.com/suresh-vlsi/atpg-fault-detection-distillation/blob/master/teacher_model.py"
click node_student "https://github.com/suresh-vlsi/atpg-fault-detection-distillation/blob/master/student_model.py"
click node_model_artifacts "https://github.com/suresh-vlsi/atpg-fault-detection-distillation/tree/master/models"
click node_evaluation "https://github.com/suresh-vlsi/atpg-fault-detection-distillation/blob/master/student_evaluation.py"
click node_demo "https://github.com/suresh-vlsi/atpg-fault-detection-distillation/blob/master/final_demo.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_parser,node_circuit_rep,node_fault_model toneBlue
class node_atpg_driver,node_d_algorithm,node_simulator,node_collapsing,node_main toneAmber
class node_generator,node_dataset toneMint
class node_teacher,node_student,node_model_artifacts toneRose
class node_evaluation,node_demo,node_user toneIndigo
```

## Components

### Circuit and faults

- [Netlist parser](https://github.com/suresh-vlsi/atpg-fault-detection-distillation/blob/master/parser.py): `parser.py`
- [Circuit representation](https://github.com/suresh-vlsi/atpg-fault-detection-distillation/blob/master/circuit.py): `circuit.py`
- [Stuck-at faults](https://github.com/suresh-vlsi/atpg-fault-detection-distillation/blob/master/fault.py): `fault.py`

### ATPG and simulation

- [ATPG utilities](https://github.com/suresh-vlsi/atpg-fault-detection-distillation/blob/master/atpg.py): `atpg.py`
- [D-algorithm](https://github.com/suresh-vlsi/atpg-fault-detection-distillation/blob/master/d_algorithm.py): `d_algorithm.py`
- [Fault simulator](https://github.com/suresh-vlsi/atpg-fault-detection-distillation/blob/master/simulator.py): `simulator.py`
- [Fault collapsing](https://github.com/suresh-vlsi/atpg-fault-detection-distillation/blob/master/fault_collapsing.py): `fault_collapsing.py`
- [ATPG runner](https://github.com/suresh-vlsi/atpg-fault-detection-distillation/blob/master/main.py): `main.py`

### Dataset generation

- [Dataset generator](https://github.com/suresh-vlsi/atpg-fault-detection-distillation/blob/master/dataset_generator.py): `dataset_generator.py`
- [Fault dataset](https://github.com/suresh-vlsi/atpg-fault-detection-distillation/tree/master/dataset): `dataset`

### Model training

- [Teacher model](https://github.com/suresh-vlsi/atpg-fault-detection-distillation/blob/master/teacher_model.py): `teacher_model.py`
- [Student distillation](https://github.com/suresh-vlsi/atpg-fault-detection-distillation/blob/master/student_model.py): `student_model.py`
- [Saved models](https://github.com/suresh-vlsi/atpg-fault-detection-distillation/tree/master/models): `models`

### Evaluation and demo

- [Student evaluation](https://github.com/suresh-vlsi/atpg-fault-detection-distillation/blob/master/student_evaluation.py): `student_evaluation.py`
- [Inference demo](https://github.com/suresh-vlsi/atpg-fault-detection-distillation/blob/master/final_demo.py): `final_demo.py`

### Other components

- **Engineer**

## Connections

- Engineer → ATPG runner: runs ATPG (evidence: `README.md`)
- ATPG runner → Netlist parser: parses circuit (evidence: `main.py`)
- Netlist parser → Circuit representation: builds circuit (evidence: `parser.py`)
- ATPG runner → Stuck-at faults: generates faults (evidence: `main.py`)
- ATPG runner → Fault collapsing: reduces faults (evidence: `main.py`)
- ATPG runner → ATPG utilities: generates tests (evidence: `README.md`)
- ATPG utilities → D-algorithm: searches patterns (evidence: `atpg.py`)
- ATPG utilities → Fault simulator: verifies tests (evidence: `atpg.py`)
- Fault collapsing → Fault simulator: simulates faults (evidence: `fault_collapsing.py`)
- Engineer → Dataset generator: generates data (evidence: `README.md`)
- Dataset generator → Netlist parser: loads circuit (evidence: `dataset_generator.py`)
- Dataset generator → Stuck-at faults: enumerates faults (evidence: `dataset_generator.py`)
- Dataset generator → Fault simulator: labels samples (evidence: `dataset_generator.py`)
- Dataset generator → Fault dataset: writes CSV (evidence: `README.md`)
- Fault dataset → Teacher model: trains on data (evidence: `README.md`)
- Teacher model → Student distillation: distills knowledge (evidence: `README.md`)
- Teacher model → Saved models: saves model (evidence: `README.md`)
- Student distillation → Saved models: saves model (evidence: `README.md`)
- Engineer → Student evaluation: evaluates student (evidence: `README.md`)
- Student evaluation → Fault dataset: reads samples (evidence: `student_evaluation.py`)
- Student evaluation → Saved models: loads models (evidence: `student_evaluation.py`)
- Engineer → Inference demo: runs demo (evidence: `README.md`)
- Inference demo → Saved models: loads student (evidence: `README.md`)
- Inference demo → Fault dataset: reads data (evidence: `README.md`)
