# tpanackerman/logic-analyzer-fpga architecture

> Architecture diagram of the GitHub repository tpanackerman/logic-analyzer-fpga, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/tpanackerman/logic-analyzer-fpga
- Repository: https://github.com/tpanackerman/logic-analyzer-fpga

## Overview

This repository is a 16-channel FPGA logic analyzer with an ESP32 signal generator and a Python desktop application. The main workflow is to generate or probe digital signals, configure and trigger FPGA capture, stream records over UART, then visualize waveforms and decode protocols; automatic channel-role prediction and manual role assignment support analysis. The GUI also provides capture-dump and link-diagnostic utilities. The README documents the FPGA stages and product capabilities; sampled Python excerpts and the source index establish GUI module relationships. FPGA internals not excerpted are represented at documented subsystem level.

Main entry points: [`gui/main.py`](https://github.com/tpanackerman/logic-analyzer-fpga/blob/main/gui/main.py) (GUI capture), [`gui/analyze_dump.py`](https://github.com/tpanackerman/logic-analyzer-fpga/blob/main/gui/analyze_dump.py) (Offline analysis), [`gui/sample_access.py`](https://github.com/tpanackerman/logic-analyzer-fpga/blob/main/gui/sample_access.py) (Sample access), [`gui/capture_dump.py`](https://github.com/tpanackerman/logic-analyzer-fpga/blob/main/gui/capture_dump.py) (Capture dump)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_stimulus["Signal source"]
  node_esp32["ESP32 generator"]
end

subgraph group_fpga["FPGA capture"]
  node_fpga_top["Analyzer top"]
  node_sampler["Input sampler<br/>[sampler_sync.v]"]
  node_trigger["Trigger engine<br/>[trigger_engine.v]"]
  node_buffer[("Capture buffer")]
  node_serializer["UART stream"]
end

subgraph group_gui["Desktop analysis"]
  node_gui_main["GUI capture<br/>[main.py]"]
  node_accessor["Sample access<br/>[sample_access.py]"]
  node_predictor["Role predictor"]
  node_decoder["Protocol decoders<br/>[decoders.py]"]
end

subgraph group_utilities["Capture utilities"]
  node_capture_dump["Capture dump<br/>[capture_dump.py]"]
  node_offline_analysis["Offline analysis<br/>[analyze_dump.py]"]
  node_link_check["Link diagnostic<br/>[fpga_link_check.py]"]
end

node_operator(("Operator"))

node_operator -->|"configures capture"| node_gui_main
node_esp32 -->|"drives probe signals"| node_sampler
node_fpga_top -->|"samples inputs"| node_sampler
node_sampler -->|"feeds sampled signals"| node_trigger
node_trigger -->|"controls capture"| node_buffer
node_buffer -->|"streams records"| node_serializer
node_serializer -->|"sends UART data"| node_gui_main
node_gui_main -->|"builds sample view"| node_accessor
node_gui_main -->|"predicts channel roles"| node_predictor
node_gui_main -->|"decodes protocols"| node_decoder
node_predictor -->|"reads waveform features"| node_accessor
node_decoder -->|"reads waveform samples"| node_accessor
node_operator -->|"requests capture"| node_capture_dump
node_capture_dump -->|"configures and reads"| node_fpga_top
node_capture_dump -->|"saves dump data"| node_offline_analysis
node_offline_analysis -->|"builds sample view"| node_accessor
node_offline_analysis -->|"runs prediction"| node_predictor
node_offline_analysis -->|"runs decoding"| node_decoder
node_operator -->|"checks connection"| node_link_check
node_link_check -->|"tests UART link"| node_fpga_top

click node_esp32 "https://github.com/tpanackerman/logic-analyzer-fpga/blob/main/esp32_gen_input/esp32_gen_input.ino"
click node_fpga_top "https://github.com/tpanackerman/logic-analyzer-fpga/blob/main/src/logic_analyzer_top.v"
click node_sampler "https://github.com/tpanackerman/logic-analyzer-fpga/blob/main/src/sampler_sync.v"
click node_trigger "https://github.com/tpanackerman/logic-analyzer-fpga/blob/main/src/trigger_engine.v"
click node_buffer "https://github.com/tpanackerman/logic-analyzer-fpga/blob/main/src/circular_buffer_controller.v"
click node_serializer "https://github.com/tpanackerman/logic-analyzer-fpga/blob/main/src/data_width_divider.v"
click node_gui_main "https://github.com/tpanackerman/logic-analyzer-fpga/blob/main/gui/main.py"
click node_accessor "https://github.com/tpanackerman/logic-analyzer-fpga/blob/main/gui/sample_access.py"
click node_predictor "https://github.com/tpanackerman/logic-analyzer-fpga/blob/main/gui/channel_predictor.py"
click node_decoder "https://github.com/tpanackerman/logic-analyzer-fpga/blob/main/gui/decoders.py"
click node_capture_dump "https://github.com/tpanackerman/logic-analyzer-fpga/blob/main/gui/capture_dump.py"
click node_offline_analysis "https://github.com/tpanackerman/logic-analyzer-fpga/blob/main/gui/analyze_dump.py"
click node_link_check "https://github.com/tpanackerman/logic-analyzer-fpga/blob/main/gui/fpga_link_check.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_esp32 toneBlue
class node_fpga_top,node_sampler,node_trigger,node_buffer,node_serializer toneAmber
class node_gui_main,node_accessor,node_predictor,node_decoder toneMint
class node_capture_dump,node_offline_analysis,node_link_check toneRose
class node_operator toneIndigo
```

## Components

### Signal source

- [ESP32 generator](https://github.com/tpanackerman/logic-analyzer-fpga/blob/main/esp32_gen_input/esp32_gen_input.ino): `esp32_gen_input/esp32_gen_input.ino`

### FPGA capture

- [Analyzer top](https://github.com/tpanackerman/logic-analyzer-fpga/blob/main/src/logic_analyzer_top.v): `src/logic_analyzer_top.v`
- [Input sampler](https://github.com/tpanackerman/logic-analyzer-fpga/blob/main/src/sampler_sync.v): `src/sampler_sync.v`
- [Trigger engine](https://github.com/tpanackerman/logic-analyzer-fpga/blob/main/src/trigger_engine.v): `src/trigger_engine.v`
- [Capture buffer](https://github.com/tpanackerman/logic-analyzer-fpga/blob/main/src/circular_buffer_controller.v): `src/circular_buffer_controller.v`
- [UART stream](https://github.com/tpanackerman/logic-analyzer-fpga/blob/main/src/data_width_divider.v): `src/data_width_divider.v`

### Desktop analysis

- [GUI capture](https://github.com/tpanackerman/logic-analyzer-fpga/blob/main/gui/main.py): `gui/main.py`
- [Sample access](https://github.com/tpanackerman/logic-analyzer-fpga/blob/main/gui/sample_access.py): `gui/sample_access.py`
- [Role predictor](https://github.com/tpanackerman/logic-analyzer-fpga/blob/main/gui/channel_predictor.py): `gui/channel_predictor.py`
- [Protocol decoders](https://github.com/tpanackerman/logic-analyzer-fpga/blob/main/gui/decoders.py): `gui/decoders.py`

### Capture utilities

- [Capture dump](https://github.com/tpanackerman/logic-analyzer-fpga/blob/main/gui/capture_dump.py): `gui/capture_dump.py`
- [Offline analysis](https://github.com/tpanackerman/logic-analyzer-fpga/blob/main/gui/analyze_dump.py): `gui/analyze_dump.py`
- [Link diagnostic](https://github.com/tpanackerman/logic-analyzer-fpga/blob/main/gui/fpga_link_check.py): `gui/fpga_link_check.py`

### Other components

- **Operator**

## Connections

- Operator → GUI capture: configures capture (evidence: `README.md`)
- ESP32 generator → Input sampler: drives probe signals (evidence: `README.md`)
- Analyzer top → Input sampler: samples inputs (evidence: `README.md`)
- Input sampler → Trigger engine: feeds sampled signals (evidence: `README.md`)
- Trigger engine → Capture buffer: controls capture (evidence: `README.md`)
- Capture buffer → UART stream: streams records (evidence: `README.md`)
- UART stream → GUI capture: sends UART data (evidence: `README.md`)
- GUI capture → Sample access: builds sample view (evidence: `gui/main.py`)
- GUI capture → Role predictor: predicts channel roles (evidence: `gui/main.py`)
- GUI capture → Protocol decoders: decodes protocols (evidence: `gui/main.py`)
- Role predictor → Sample access: reads waveform features (evidence: `gui/channel_predictor.py`)
- Protocol decoders → Sample access: reads waveform samples (evidence: `gui/decoders.py`)
- Operator → Capture dump: requests capture (evidence: `gui/capture_dump.py`)
- Capture dump → Analyzer top: configures and reads (evidence: `gui/capture_dump.py`)
- Capture dump → Offline analysis: saves dump data (evidence: `gui/analyze_dump.py`)
- Offline analysis → Sample access: builds sample view (evidence: `gui/analyze_dump.py`)
- Offline analysis → Role predictor: runs prediction (evidence: `gui/analyze_dump.py`)
- Offline analysis → Protocol decoders: runs decoding (evidence: `gui/analyze_dump.py`)
- Operator → Link diagnostic: checks connection (evidence: `gui/fpga_link_check.py`)
- Link diagnostic → Analyzer top: tests UART link (evidence: `gui/fpga_link_check.py`)
