Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[circt-verilog-lsp-server] Add Verilog Language Server #8234

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

uenoku
Copy link
Member

@uenoku uenoku commented Feb 13, 2025

This is a first PR to add a Language Server Protocol (LSP) implementation for Verilog/SystemVerilog using the slang frontend.

The server is built as circt-verilog-lsp-server and eventually integrates with CIRCT's existing Verilog import capabilities. It leverages MLIR's LSP server support libraries for the protocol implementation.

  • VerilogServer.cpp - Core language service implementation that manages documents
    and interfaces with slang for parsing and analysis. Maintains document state
    and handles document synchronization events.

  • LSPServer.cpp - Protocol layer that implements LSP message handling and converts
    between LSP types and internal representations. Built on MLIR's LSP server
    support libraries.

lib/Tools/circt-verilog-lsp-server/{Utils, VerilogSeverImpl} are added as workaround for RTTI build issue. The current version of slang requires RTTI but LLVM may not be built with RTTI. So if LLVM functions use RTTI in VerilogServer.cpp it causes compilation error because there is no RTTI. As a workaround, I specialized utility functions in LSPUtils.cpp, and use it from VerilogServer.cpp.

Not implemented in this initial PR but the goal is to provide modern LSP features such as hover/go to def/references integrated with CIRCT (e.g. hover source location).

Screenshot from 2025-02-12 16-14-32

Screenshot from 2025-02-12 16-14-45

@uenoku uenoku force-pushed the dev/hidetou/lsp branch 5 times, most recently from db2847d to 54c80b9 Compare February 13, 2025 02:13
This is a first PR to add a Language Server Protocol (LSP) implementation
for Verilog/SystemVerilog using the slang frontend. This enables IDE features
like syntax error checking and diagnostics.

The server is built as circt-verilog-lsp-server and integrates with CIRCT's
existing Verilog import capabilities. It leverages MLIR's LSP server support
libraries for the protocol implementation.
@uenoku uenoku marked this pull request as ready for review February 13, 2025 02:41
@uenoku uenoku requested a review from fabianschuiki February 13, 2025 02:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant