How os-fpga/foedag works
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: Command Commands · ProjectManager Projects · Compiler Compiler · Main Foedag core
Components 22
Application shell
GUI bootstrap, main window, settings, and top-level orchestration.
- App entry · Starts the desktop application and wires the top-level runtime.
src/Main/main.cpp - Foedag core · Main application objects, command line, settings, report generation, and Tcl command registration.
src/Main - Main window · 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 · Interpreter and history support for scripted control of the application.
src/Tcl - Console · Embedded Tcl console, output formatting, error parsing, and worker integration.
src/Console - Commands · Command abstraction and logging used to route Tcl and GUI actions.
src/Command
Project workspace
Project creation, file/model management, runs, and navigation.
- Projects · Project creation, metadata, filesets, options, and run configuration management.
src/NewProject/ProjectManager - Project file · Loads, migrates, and saves project configuration components.
src/Main/ProjectFile - Runs UI · Dialogs and views for creating and summarizing design runs.
src/DesignRuns - Navigator · File explorer, hierarchy view, and property panel for project contents.
src/ProjNavigator
EDA flow
Compiler execution, reports, IP generation, simulation, and analysis.
- Compiler · Central execution engine for synthesis, packing, placement, routing, and bitstream-style workflows.
src/Compiler - Reports · Task and stage report managers plus table and JSON report generation.
src/Compiler/Reports - IP tools · IP catalog loading, configuration, and generated instance expansion.
src/IPGenerate - Sim/Query · Simulation wrapper and design hierarchy/query artifact generation.
src/Simulation - Timing analysis · Interactive critical-path analysis client with TCP/zlib backend protocol.
src/InteractivePathAnalysis
Device stack
Device/configuration models, pin/package workflow, and programming.
- Device config · Model configuration and device modeling for architecture, resources, and bitstream mapping.
src/Configuration/ModelConfig - Pin I/O · Package pins, ports, and board I/O assignment workflow.
src/PinAssignment - Programmer · Programming GUI, hardware manager, adapters, cables, TAPs, and external programmer tools.
src/Configuration/Programmer
User tools
Editor and assistant-facing productivity surfaces.
- Text editor · Embedded source editor using Monaco or QScintilla-style editing components.
src/TextEditor - RapidGPT · Optional chat-style assistance and connection/context integration.
src/rapidgpt
Support
Shared utilities and external dependency boundaries.
- Utils · Cross-cutting helpers for files, processes, strings, JSON, logging, and Qt glue.
src/Utils - Third-party · Vendored Tcl, zlib, QScintilla, Monaco assets, googletest, OpenOCD, spdlog, and related dependencies.
third_party
Connections 36
- 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.