# os-fpga/foedag architecture

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

- Interactive diagram: https://gitdiagram.com/os-fpga/foedag
- Repository: https://github.com/os-fpga/foedag

## Overview

FOEDAG is a Qt-based desktop EDA framework built around a Tcl-commandable core. The repository is organized as a modular application shell plus feature subsystems for project creation, editing, compilation, analysis, programming, and device/IP management.

1. Core application shell
The top-level app lives in `src/Main`, `src/MainWindow`, and `src/Main`. It bootstraps the GUI (`main.cpp`), application style, settings, command-line parsing, report generation, and registration of Tcl commands. The UI mixes Qt Widgets, QML, and WebEngine/Monaco or QScintilla-based editing.

2. Tcl as the integration layer
Tcl is a first-class control plane. `src/Tcl`, `src/Console`, and `src/Main/TclSimpleParser.cpp` provide the interpreter, console, history, parsing, and command dispatch. Many features expose Tcl command handlers so the same functionality can be driven from the GUI or batch scripts/tests.

3. Project and run management
`src/NewProject`, `src/Main/ProjectFile`, `src/DesignRuns`, and `src/ProjNavigator` model the user-facing project structure: sources, constraints, simulations, filesets, runs, and project metadata. This layer loads/saves project files, watches design files, creates run directories, and keeps the visible project tree in sync with the underlying configuration.

4. Compiler orchestration
`src/Compiler` is the central execution engine for synthesis/packing/placement/routing/bitstream-style workflows. It contains the `TaskManager`, worker threads, compiler state, constraints, design data, and report managers. This is the main boundary where GUI requests become long-running backend jobs.

5. Task and report pipeline
The compiler is task-driven: each flow stage produces structured results and feeds specialized report managers under `src/Compiler/Reports`. Those reports are surfaced through the main window report tree, task tables, JSON report generation, and compiler notifications. This is the primary data flow for build feedback.

6. Device and model configuration
`src/ModelConfig`, `src/DeviceModeling`, and `etc/device.xml`/`etc/devices` describe target device resources and bitstream/configuration mapping. These modules transform architecture/device definitions into editable models and configuration artifacts consumed by the compiler, pin tools, and programmer.

7. Pin/package and board I/O workflow
`src/PinAssignment` and `etc/templates` manage package pins, ports, and board I/O assignment. The flow typically goes from device/package metadata into port models and views, then back into project or constraint files. This subsystem is separate from compilation but feeds constraint generation.

8. IP generation and configuration
`src/IPGenerate` and `src/IpConfigurator` implement catalog-driven IP discovery, parameterization, and instance generation. Test data under `tests/Testcases/IPGenerate` shows that IP metadata is loaded, cached, and expanded into generated design files that then enter the project/compiler pipeline.

9. Simulation and design query
`src/Simulation` wraps simulation execution, while `src/DesignQuery` parses design hierarchies and emits structured summaries such as SDT/JSON artifacts. These features consume project/design data after or alongside compilation and are used for inspection rather than transformation.

10. Interactive timing/path analysis
`src/InteractivePathAnalysis` is a distinct analysis client that parses critical-path reports, communicates with a VPR-based backend process, and uses a TCP/zlib framing protocol in `client/`. This subsystem is more networked than the rest of the app and is bound to timing-analysis data exchange rather than the main compiler task queue.

11. Programmer subsystem
`src/Configuration/Programmer`, `src/ProgrammerGui`, and `src/Configuration/HardwareManager` handle device programming and hardware access. The code explicitly models JTAG/OpenOCD adapters, cables, TAPs, and programmer tools, so this boundary extends from GUI settings into external programming utilities and attached hardware.

12. Editor, navigator, and console UX
`src/TextEditor`, `src/ProjNavigator`, `src/Console`, and `src/MainWindow` are the primary productivity surfaces. They share project/session state, display files and hierarchy, route output and errors, and offer both scriptable and interactive workflows.

13. Auxiliary intelligence/chat feature
`src/rapidgpt` is a separate Qt UI/integration layer for chat-style assistance. It communicates through a connection/context abstraction, so it behaves like an optional external-backed assistant rather than a core EDA flow component.

14. Shared utilities and third-party boundaries
`src/Utils` contains cross-cutting helpers for files, processes, strings, JSON, logging, and Qt glue. The repository vendors major dependencies under `third_party` including Tcl, zlib, QScintilla, Monaco editor assets, googletest, OpenOCD wrappers, and spdlog; these materially shape the build and editor/runtime behavior.

15. Build, packaging, and verification
The project is CMake-driven with top-level `CMakeLists.txt`, module-local CMake files, CI workflows, and extensive unit/gui/batch tests under `tests/`. The docs and examples show the intended external contract: project files, Tcl scripts, generated reports, and device-specific artifacts.

Main entry points: [`src/Command`](https://github.com/os-fpga/foedag/tree/main/src/Command) (Commands), [`src/NewProject/ProjectManager`](https://github.com/os-fpga/foedag/tree/main/src/NewProject/ProjectManager) (Projects), [`src/Compiler`](https://github.com/os-fpga/foedag/tree/main/src/Compiler) (Compiler), [`src/Main`](https://github.com/os-fpga/foedag/tree/main/src/Main) (Foedag core)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_grp_app["Application shell"]
  node_main_entry["App entry<br/>bootstrap<br/>[main.cpp]"]
  node_main_shell["Foedag core<br/>app shell"]
  node_window_ui["Main window<br/>ui shell"]
end

subgraph group_grp_control["Control plane"]
  node_tcl_core["Tcl runtime<br/>script control"]
  node_console_ui["Console<br/>interactive shell"]
  node_cmd_stack["Commands<br/>dispatch layer"]
end

subgraph group_grp_project["Project workspace"]
  node_project_mgr["Projects<br/>project model"]
  node_project_file["Project file<br/>persistence"]
  node_runs_ui["Runs UI<br/>run manager"]
  node_proj_nav["Navigator<br/>project browser"]
end

subgraph group_grp_flow["EDA flow"]
  node_compiler["Compiler<br/>flow engine"]
  node_reports["Reports<br/>reporting"]
  node_ip_flow["IP tools<br/>ip generation"]
  node_sim_query["Sim/Query<br/>inspection"]
  node_timing["Timing analysis<br/>analysis client"]
end

subgraph group_grp_device["Device stack"]
  node_device_cfg["Device config<br/>device model"]
  node_pin_io["Pin I/O<br/>package assignment"]
  node_programmer["Programmer<br/>hardware access"]
end

subgraph group_grp_edit["User tools"]
  node_editor["Text editor<br/>code editor"]
  node_rapidgpt["RapidGPT<br/>assistant ui"]
end

subgraph group_grp_support["Support"]
  node_utils["Utils<br/>shared helpers"]
  node_third_party["Third-party<br/>vendored deps"]
end

node_main_entry -->|"starts"| node_main_shell
node_main_shell -->|"hosts"| node_window_ui
node_main_shell -->|"registers"| node_tcl_core
node_main_shell -->|"loads/saves"| node_project_file
node_window_ui -->|"embeds"| node_console_ui
node_window_ui -->|"shows"| node_proj_nav
node_window_ui -->|"surfaces"| node_reports
node_console_ui -->|"executes"| node_cmd_stack
node_tcl_core -->|"dispatches"| node_cmd_stack
node_cmd_stack -->|"controls"| node_project_mgr
node_cmd_stack -->|"starts flows"| node_compiler
node_cmd_stack -->|"drives"| node_ip_flow
node_cmd_stack -->|"invokes"| node_sim_query
node_cmd_stack -->|"updates"| node_pin_io
node_cmd_stack -->|"invokes"| node_programmer
node_project_mgr -->|"persists"| node_project_file
node_project_mgr -->|"configures"| node_runs_ui
node_project_mgr -->|"syncs"| node_proj_nav
node_proj_nav -->|"opens"| node_editor
node_compiler -->|"emits"| node_reports
node_compiler -->|"consumes"| node_device_cfg
node_compiler -->|"consumes"| node_pin_io
node_ip_flow -->|"generates into"| node_project_mgr
node_sim_query -->|"reads"| node_project_mgr
node_timing -->|"parses"| node_reports
node_timing -->|"follows"| node_compiler
node_device_cfg -->|"describes"| node_pin_io
node_device_cfg -->|"feeds"| node_programmer
node_editor -->|"edits"| node_project_mgr
node_rapidgpt -->|"integrates"| node_window_ui
node_utils -->|"supports"| node_main_shell
node_utils -->|"supports"| node_compiler
node_utils -->|"supports"| node_tcl_core
node_third_party -->|"provides"| node_editor
node_third_party -->|"provides"| node_tcl_core
node_third_party -->|"provides"| node_compiler

click node_main_entry "https://github.com/os-fpga/foedag/blob/main/src/Main/main.cpp"
click node_main_shell "https://github.com/os-fpga/foedag/tree/main/src/Main"
click node_window_ui "https://github.com/os-fpga/foedag/tree/main/src/MainWindow"
click node_tcl_core "https://github.com/os-fpga/foedag/tree/main/src/Tcl"
click node_console_ui "https://github.com/os-fpga/foedag/tree/main/src/Console"
click node_cmd_stack "https://github.com/os-fpga/foedag/tree/main/src/Command"
click node_project_mgr "https://github.com/os-fpga/foedag/tree/main/src/NewProject/ProjectManager"
click node_project_file "https://github.com/os-fpga/foedag/tree/main/src/Main/ProjectFile"
click node_runs_ui "https://github.com/os-fpga/foedag/tree/main/src/DesignRuns"
click node_proj_nav "https://github.com/os-fpga/foedag/tree/main/src/ProjNavigator"
click node_compiler "https://github.com/os-fpga/foedag/tree/main/src/Compiler"
click node_reports "https://github.com/os-fpga/foedag/tree/main/src/Compiler/Reports"
click node_ip_flow "https://github.com/os-fpga/foedag/tree/main/src/IPGenerate"
click node_sim_query "https://github.com/os-fpga/foedag/tree/main/src/Simulation"
click node_timing "https://github.com/os-fpga/foedag/tree/main/src/InteractivePathAnalysis"
click node_device_cfg "https://github.com/os-fpga/foedag/tree/main/src/Configuration/ModelConfig"
click node_pin_io "https://github.com/os-fpga/foedag/tree/main/src/PinAssignment"
click node_programmer "https://github.com/os-fpga/foedag/tree/main/src/Configuration/Programmer"
click node_editor "https://github.com/os-fpga/foedag/tree/main/src/TextEditor"
click node_rapidgpt "https://github.com/os-fpga/foedag/tree/main/src/rapidgpt"
click node_utils "https://github.com/os-fpga/foedag/tree/main/src/Utils"
click node_third_party "https://github.com/os-fpga/foedag/tree/main/third_party"

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_main_entry,node_main_shell,node_window_ui,node_utils,node_third_party toneBlue
class node_tcl_core,node_console_ui,node_cmd_stack toneAmber
class node_project_mgr,node_project_file,node_runs_ui,node_proj_nav toneMint
class node_compiler,node_reports,node_ip_flow,node_sim_query,node_timing toneRose
class node_device_cfg,node_pin_io,node_programmer toneIndigo
class node_editor,node_rapidgpt toneTeal
```

## Components

### Application shell

GUI bootstrap, main window, settings, and top-level orchestration.

- [App entry](https://github.com/os-fpga/foedag/blob/main/src/Main/main.cpp): bootstrap · Starts the desktop application and wires the top-level runtime. · `src/Main/main.cpp`
- [Foedag core](https://github.com/os-fpga/foedag/tree/main/src/Main): app shell · Main application objects, command line, settings, report generation, and Tcl command registration. · `src/Main`
- [Main window](https://github.com/os-fpga/foedag/tree/main/src/MainWindow): ui shell · Primary window chrome, tabs, dock widgets, session state, and QML/Qt Widgets UI. · `src/MainWindow`

### Control plane

Tcl interpreter, console, and command dispatch used by GUI and batch flows.

- [Tcl runtime](https://github.com/os-fpga/foedag/tree/main/src/Tcl): script control · Interpreter and history support for scripted control of the application. · `src/Tcl`
- [Console](https://github.com/os-fpga/foedag/tree/main/src/Console): interactive shell · Embedded Tcl console, output formatting, error parsing, and worker integration. · `src/Console`
- [Commands](https://github.com/os-fpga/foedag/tree/main/src/Command): dispatch layer · Command abstraction and logging used to route Tcl and GUI actions. · `src/Command`

### Project workspace

Project creation, file/model management, runs, and navigation.

- [Projects](https://github.com/os-fpga/foedag/tree/main/src/NewProject/ProjectManager): project model · Project creation, metadata, filesets, options, and run configuration management. · `src/NewProject/ProjectManager`
- [Project file](https://github.com/os-fpga/foedag/tree/main/src/Main/ProjectFile): persistence · Loads, migrates, and saves project configuration components. · `src/Main/ProjectFile`
- [Runs UI](https://github.com/os-fpga/foedag/tree/main/src/DesignRuns): run manager · Dialogs and views for creating and summarizing design runs. · `src/DesignRuns`
- [Navigator](https://github.com/os-fpga/foedag/tree/main/src/ProjNavigator): project browser · File explorer, hierarchy view, and property panel for project contents. · `src/ProjNavigator`

### EDA flow

Compiler execution, reports, IP generation, simulation, and analysis.

- [Compiler](https://github.com/os-fpga/foedag/tree/main/src/Compiler): flow engine · Central execution engine for synthesis, packing, placement, routing, and bitstream-style workflows. · `src/Compiler`
- [Reports](https://github.com/os-fpga/foedag/tree/main/src/Compiler/Reports): reporting · Task and stage report managers plus table and JSON report generation. · `src/Compiler/Reports`
- [IP tools](https://github.com/os-fpga/foedag/tree/main/src/IPGenerate): ip generation · IP catalog loading, configuration, and generated instance expansion. · `src/IPGenerate`
- [Sim/Query](https://github.com/os-fpga/foedag/tree/main/src/Simulation): inspection · Simulation wrapper and design hierarchy/query artifact generation. · `src/Simulation`
- [Timing analysis](https://github.com/os-fpga/foedag/tree/main/src/InteractivePathAnalysis): analysis client · Interactive critical-path analysis client with TCP/zlib backend protocol. · `src/InteractivePathAnalysis`

### Device stack

Device/configuration models, pin/package workflow, and programming.

- [Device config](https://github.com/os-fpga/foedag/tree/main/src/Configuration/ModelConfig): device model · Model configuration and device modeling for architecture, resources, and bitstream mapping. · `src/Configuration/ModelConfig`
- [Pin I/O](https://github.com/os-fpga/foedag/tree/main/src/PinAssignment): package assignment · Package pins, ports, and board I/O assignment workflow. · `src/PinAssignment`
- [Programmer](https://github.com/os-fpga/foedag/tree/main/src/Configuration/Programmer): hardware access · Programming GUI, hardware manager, adapters, cables, TAPs, and external programmer tools. · `src/Configuration/Programmer`

### User tools

Editor and assistant-facing productivity surfaces.

- [Text editor](https://github.com/os-fpga/foedag/tree/main/src/TextEditor): code editor · Embedded source editor using Monaco or QScintilla-style editing components. · `src/TextEditor`
- [RapidGPT](https://github.com/os-fpga/foedag/tree/main/src/rapidgpt): assistant ui · Optional chat-style assistance and connection/context integration. · `src/rapidgpt`

### Support

Shared utilities and external dependency boundaries.

- [Utils](https://github.com/os-fpga/foedag/tree/main/src/Utils): shared helpers · Cross-cutting helpers for files, processes, strings, JSON, logging, and Qt glue. · `src/Utils`
- [Third-party](https://github.com/os-fpga/foedag/tree/main/third_party): vendored deps · Vendored Tcl, zlib, QScintilla, Monaco assets, googletest, OpenOCD, spdlog, and related dependencies. · `third_party`

## Connections

- App entry → Foedag core: starts · Application entry bootstraps the core shell.
- Foedag core → Main window: hosts · Core shell creates and coordinates the main UI.
- Foedag core → Tcl runtime: registers · Core shell wires Tcl command registration and parser integration.
- Foedag core → Project file: loads/saves · Core shell persists project state through project-file components.
- Main window → Console: embeds · Main window exposes the interactive console.
- Main window → Navigator: shows · Main window presents project navigation and properties.
- Main window → Reports: surfaces · Main window renders compiler and task reports.
- Console → Commands: executes · Console routes user input through the command stack.
- Tcl runtime → Commands: dispatches · Tcl runtime feeds command handlers.
- Commands → Projects: controls · Commands manipulate project creation and configuration.
- Commands → Compiler: starts flows · Commands trigger long-running compiler jobs.
- Commands → IP tools: drives · Commands configure and generate IP.
- Commands → Sim/Query: invokes · Commands launch simulation and design-query tasks.
- Commands → Pin I/O: updates · Commands manage pin and port assignment.
- Commands → Programmer: invokes · Commands expose programmer and hardware operations.
- Projects → Project file: persists · Project manager serializes project structure and metadata.
- Projects → Runs UI: configures · Project manager feeds run creation and summaries.
- Projects → Navigator: syncs · Project model stays aligned with the visible navigator tree.
- Navigator → Text editor: opens · Navigator launches files in the editor surface.
- Compiler → Reports: emits · Compiler stages produce structured reports and notifications.
- Compiler → Device config: consumes · Compilation uses device and model configuration.
- Compiler → Pin I/O: consumes · Compiler consumes pin/constraint data from I/O assignment.
- IP tools → Projects: generates into · Generated IP artifacts are added to project sources.
- Sim/Query → Projects: reads · Simulation and design queries consume project/design data.
- Timing analysis → Reports: parses · Interactive timing analysis reads critical-path report data.
- Timing analysis → Compiler: follows · Timing analysis is downstream of compiler-generated flow data.
- Device config → Pin I/O: describes · Device models inform package and port assignment.
- Device config → Programmer: feeds · Device/configuration data informs programming settings.
- Text editor → Projects: edits · Editor works on files within the current project context.
- RapidGPT → Main window: integrates · Assistant UI is exposed as an optional workspace feature.
- Utils → Foedag core: supports · Shared helpers are used throughout the core shell.
- Utils → Compiler: supports · Utilities back compiler data handling and process management.
- Utils → Tcl runtime: supports · Utilities assist script parsing, files, and logging.
- Third-party → Text editor: provides · Vendored editor engines and UI dependencies underpin the editor surface.
- Third-party → Tcl runtime: provides · Vendored Tcl runtime and extensions underpin the control plane.
- Third-party → Compiler: provides · Vendored support libraries and external tooling feed the backend flow.
