How digital-eda/digital-ide works
Main Components
• VS Code Extension Interface: Represented by files in the “src” directory (e.g., src/extension.ts) and global configuration files.
• Netlist and Viewer Modules: Functions for netlist rendering and viewer integration, evident in “src/function/dide-netlist” and “resources/dide-viewer.”
• Simulation & Testing Components: Includes simulation setup and testbench handling under “src/function/sim.”
• Additional Utility Modules: Logging, global helpers, internationalization (i18n), and configuration management (config directory with various .json files).
Relationships & Interactions
• The VS Code extension acts as the “front door” by interfacing with the VS Code API.
• When a user opens an HDL file, the extension routes the file to the Language Service, which in turn uses the Rust parser modules to provide smart diagnostics, auto-completion, and linting (see src/function/lsp).
• The documentation module listens for certain types of comments or code annotations in HDL files, triggering the generation of interactive documentation (with support from resources/dide-doc assets).
• For simulation tasks, the simulation component (src/function/sim) gathers file and project info via the file system modules and then interfaces with external tools (Vivado, ModelSim, Icarus Verilog as mentioned in the README) via configurable linter and simulation layers.
• The netlist renderer and waveform (VCD) renderer manage visualization tasks, leveraging both front-end assets (CSS, images, resources) and back-end logic from the corresponding src function folders.
• Global managers (src/manager) help coordinate tasks like project configuration, third-party tool integration, and structured file parsing.
Architectural Patterns and Design Principles
• Modular Design: The system is clearly organized into function-specific modules (documentation, netlist, simulation, LSP, tree view, etc.) promoting separation of concerns.
• Plugin Architecture: Since this is a VS Code extension, it extends the editor’s functionality through defined extension endpoints (commands, status bar items, file watchers).
• Client-Server Interactions for LSP: The language service is implemented as a separate process or module that interacts with the extension layer, following the Language Server Protocol design paradigm.
• Use of External Resources: There is significant usage of external resource files (CSS, images, static VHDL libraries) that support the UI/UX of the plugin’s output.
Relevant Technologies, Frameworks, or Libraries
• VS Code Extension API: Underlying the entire system, allowing integration with the editor.
• TypeScript & JavaScript: For the bulk of the extension’s logic (located in src/).
• Rust Parser for HDL: Although files indicate TypeScript, the README mentions a rewritten parser in Rust that promises better performance.
• CSS/HTML/JS Assets for Renderers: For documentation, netlist, and waveform renderers.
• Build & Test Infrastructure: Configuration files like package.json, webpack.config.js, and numerous configuration JSONs facilitate build and deployment.
Elements
• Individual labeled components such as:
• Extension Core Interface (with VS Code APIs)
• Language Service/Parser (highlighting the Rust integration)
• Documentation Generator (Wavedrom and other renderers)
• Netlist Renderer and Viewer
• Simulation Handler/Integration Module
• File System and Resource Manager
• Global Utilities (configuration, internationalization, etc.)
• External Tools / Third-party Simulators (Vivado, ModelSim, Icarus Verilog)
• Annotations on key architectural decisions, like adherence to the LSP model or modular separation of different concerns.