跳转到内容

第一个工程

小工程可以先用简单结构:

my-rtl/
rtl/
top.sv
alu.sv
include/
defs.svh

直接用 VS Code 打开 my-rtl:

Terminal window
code D:\work\my-rtl

如果 VS Code 打开的 workspace root 下有 Verilog/SystemVerilog 文件, 且没有 vizsla.toml 或旧版 vizsla_config.toml, 扩展会创建默认 vizsla.toml 并弹出提示:

# Default startup manifest. Omitting sources enables best-effort indexing for navigation
# without semantic diagnostics. Fill shell globs, for example sources = ["rtl/**"]
# and include_dirs = ["include"], to enable semantic diagnostics.
# Set sources = [] to disable workspace indexing.

这个默认清单会以 best-effort 方式索引 workspace root 下的 Verilog/SystemVerilog 文件, 让跳转和引用等读能力开箱可用; 但它不会建立编译 profile, 也不运行跨文件 semantic diagnostics。你可以之后再按实际目录写入 sources shell glob 或 include_dirs, 并按需补充 defines, librariestop_modules, 来启用更准确的语义诊断。

如果通过其它客户端或命令行方式启动服务器, 且确实没有 vizsla.tomlvizsla_config.toml, Vizsla 同样会进入 best-effort 索引模式。显式写入 sources = [] 会关闭 workspace 索引, 只保留打开文件的 syntax/parse diagnostics。

当工程变大时, 我们建议编辑 workspace root 下的 vizsla.toml:

  • 你只想扫描 rtlinclude, 不想扫描仿真输出、生成目录或第三方缓存。
  • 你需要设置 defines
  • 你需要把 include 目录和 source 目录分开。
  • 你有外部库目录, 希望它们作为依赖参与分析。
  • 你想显式声明 top_modules

示例:

top_modules = ["top"]
defines = ["SYNTHESIS", "DATA_WIDTH=32"]
sources = ["rtl/**"]
include_dirs = ["include"]
exclude = ["build/**", "out/**"]

清单只会从你打开的 workspace root 读取。我们不会自动向父目录或子目录搜索其它清单; 如果 vizsla.tomlvizsla_config.toml 同时存在, 会优先读取 vizsla.toml