# saleae/sampleanalyzer architecture

> Architecture diagram of the GitHub repository saleae/sampleanalyzer, 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/saleae/sampleanalyzer
- Repository: https://github.com/saleae/sampleanalyzer

## Overview

This repository is a Saleae Logic low-level analyzer plugin demonstrating simple serial byte decoding. The workflow is: configure the input channel and bit rate, sample captured waveform bits in the analyzer worker, publish byte frames, then render/export results. It also supplies generated serial waveform data for simulation. The README documents the plugin role; source excerpts establish the runtime calls and ownership shown here.

Main entry points: [`src/SimpleSerialAnalyzer.cpp`](https://github.com/saleae/sampleanalyzer/blob/master/src/SimpleSerialAnalyzer.cpp) (Analyzer plugin), [`src/SimpleSerialAnalyzerResults.cpp`](https://github.com/saleae/sampleanalyzer/blob/master/src/SimpleSerialAnalyzerResults.cpp) (Frame and export results), [`src/SimpleSerialSimulationDataGenerator.cpp`](https://github.com/saleae/sampleanalyzer/blob/master/src/SimpleSerialSimulationDataGenerator.cpp) (Serial waveform generator), [`src/SimpleSerialAnalyzerSettings.cpp`](https://github.com/saleae/sampleanalyzer/blob/master/src/SimpleSerialAnalyzerSettings.cpp) (Channel and rate settings)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_configuration["Analyzer configuration"]
  node_settings["Channel and rate settings"]
end

subgraph group_runtime["Decode runtime"]
  node_analyzer["Analyzer plugin"]
  node_sampling["Serial bit sampling"]
end

subgraph group_output["Results presentation"]
  node_results["Frame and export results"]
end

subgraph group_simulation["Simulation"]
  node_generator["Serial waveform generator"]
end

node_logic(("Saleae Logic"))

node_logic -->|"loads plugin"| node_analyzer
node_analyzer -->|"registers settings"| node_settings
node_analyzer -->|"runs worker"| node_sampling
node_sampling -->|"commits frames"| node_results
node_analyzer -->|"sets up results"| node_results
node_analyzer -->|"requests simulation"| node_generator
node_generator -->|"reads parameters"| node_settings
node_results -->|"reads timing"| node_analyzer

click node_settings "https://github.com/saleae/sampleanalyzer/blob/master/src/SimpleSerialAnalyzerSettings.cpp"
click node_analyzer "https://github.com/saleae/sampleanalyzer/blob/master/src/SimpleSerialAnalyzer.cpp"
click node_sampling "https://github.com/saleae/sampleanalyzer/blob/master/src/SimpleSerialAnalyzer.cpp"
click node_results "https://github.com/saleae/sampleanalyzer/blob/master/src/SimpleSerialAnalyzerResults.cpp"
click node_generator "https://github.com/saleae/sampleanalyzer/blob/master/src/SimpleSerialSimulationDataGenerator.cpp"

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_settings toneBlue
class node_analyzer,node_sampling toneAmber
class node_results toneMint
class node_generator toneRose
class node_logic toneIndigo
```

## Components

### Analyzer configuration

- [Channel and rate settings](https://github.com/saleae/sampleanalyzer/blob/master/src/SimpleSerialAnalyzerSettings.cpp): `src/SimpleSerialAnalyzerSettings.cpp`

### Decode runtime

- [Analyzer plugin](https://github.com/saleae/sampleanalyzer/blob/master/src/SimpleSerialAnalyzer.cpp): `src/SimpleSerialAnalyzer.cpp`
- [Serial bit sampling](https://github.com/saleae/sampleanalyzer/blob/master/src/SimpleSerialAnalyzer.cpp): `src/SimpleSerialAnalyzer.cpp`

### Results presentation

- [Frame and export results](https://github.com/saleae/sampleanalyzer/blob/master/src/SimpleSerialAnalyzerResults.cpp): `src/SimpleSerialAnalyzerResults.cpp`

### Simulation

- [Serial waveform generator](https://github.com/saleae/sampleanalyzer/blob/master/src/SimpleSerialSimulationDataGenerator.cpp): `src/SimpleSerialSimulationDataGenerator.cpp`

### Other components

- **Saleae Logic**

## Connections

- Saleae Logic → Analyzer plugin: loads plugin (evidence: `readme.md`)
- Analyzer plugin → Channel and rate settings: registers settings (evidence: `src/SimpleSerialAnalyzer.cpp`)
- Analyzer plugin → Serial bit sampling: runs worker (evidence: `src/SimpleSerialAnalyzer.cpp`)
- Serial bit sampling → Frame and export results: commits frames (evidence: `src/SimpleSerialAnalyzer.cpp`)
- Analyzer plugin → Frame and export results: sets up results (evidence: `src/SimpleSerialAnalyzer.cpp`)
- Analyzer plugin → Serial waveform generator: requests simulation (evidence: `src/SimpleSerialAnalyzer.cpp`)
- Serial waveform generator → Channel and rate settings: reads parameters (evidence: `src/SimpleSerialSimulationDataGenerator.cpp`)
- Frame and export results → Analyzer plugin: reads timing (evidence: `src/SimpleSerialAnalyzerResults.cpp`)
