Skip to main content
Glama

run_tcl

Executes any Vivado Tcl command for project setup, constraints, IP, block design, simulation, and reporting. Supports multi-line scripts.

Instructions

执行任意 Vivado Tcl 命令。支持所有 Vivado Tcl API。

这是最通用的工具,可以执行任何 Vivado Tcl 命令,包括:

  • 项目: create_project, open_project, add_files, set_property top

  • 约束: create_clock, set_property PACKAGE_PIN

  • IP: create_ip, generate_target, set_property CONFIG.*

  • Block Design: create_bd_design, create_bd_cell, connect_bd_intf_net

  • 查询: get_ports, get_cells, get_property STATUS [get_runs]

  • 报告: report_utilization -return_string, report_timing_summary -return_string

  • 仿真: launch_simulation, run 100ns, add_wave

  • 以及任何其他 Vivado Tcl 命令

支持多行脚本(用换行符分隔)。

路径含特殊字符时请用 safe_tcl 而非 run_tcl,避免 Tcl 解析错误。

XSim 仿真常见坑摘要(0.3.17 实战沉淀,下面即完整清单):

  • add_wave_group 必须配 -into $g,否则信号全跑到顶层,group 是空的:

    set g [add_wave_group sig_grp]
    add_wave -into $g /tb/clk     ;# ✓ 进 group
    add_wave /tb/rst              ;# ✗ 跑到顶层
  • add_wave / get_objects 拒 escaped id,必须先 current_scope 切到目标 scope 再用 short name:

    # ✗ add_wave {\u_dut/sig}
    current_scope /tb/u_dut       ;# ✓ 切上下文
    add_wave sig
  • get_scopes 不支持多 path 参数,一次只能查一个 scope,多个要 foreach 逐个:

    # ✗ get_scopes /tb/u_dut /tb/u_ctrl
    foreach __p {/tb/u_dut /tb/u_ctrl} { puts "$__p: [get_scopes $__p]" }
  • size > 1 filter 对 escaped id 总线对象无效且不报错(其 size 属性可能 =1,静默漏数据)。筛总线别依赖 size,改用 regexp NAME 匹配 \[.*:.*\] 总线命名约定。

  • 清空波形只认 remove_wave [get_waves *],-all / * / -of_objects 都 不工作(XSim 2019.1 bug)

  • xsim -tclbatch 文件必须显式 quit,EOF 不自动退出,会卡死 CI

  • if-generate 命名块不是 scope —— 内部 reg 无 add_wave 寻址路径

  • [N] / [X] 在 Tcl 字符串里会触发命令替换,用 {} 包字面路径:

    # ✗ add_wave /tb/gen_ch[0].u/sig    invalid command "0"
    add_wave {/tb/gen_ch[0].u/sig}
  • marker 复位 = 磁盘 wcfg 干净时重载。marker 存在 .wcfg 的 <wave_markers><marker time="..fs"/></wave_markers>,清掉/复位用一行:

    close_wave_config -force          ;# 丢内存里的脏 marker
    open_wave_config C:/path/wave.wcfg ;# 从干净磁盘文件重载

set_property / radix 写脚本陷阱(0.3.20 实战沉淀,无 err 静默踩):

  • -filter "name =~ {...[$var]...}" 会污染后续 set_property 静默失败[$var] 触发 Tcl 命令替换,虽然 get_scopes 内部 fallback 仍返回正确对象, 但污染后续 wave property 路径,set_property RADIX dec $w 静默不生效。 改用 foreach + regexp 自己过滤,绕开 filter 字符串里的 [$var]

  • set_property RADIX value 大小写敏感(大多数 Vivado property 是大小写 不敏感的,这条是反直觉的例外):

    set_property RADIX dec $w   ;# ✓ RADIX=dec
    set_property RADIX DEC $w   ;# ✗ 静默退回 RADIX=default,不报错
  • add_wave -radixset_property RADIX 接受的 value 集合不一致:

    add_wave -radix : default | dec | bin | oct | hex | unsigned | ascii | smag
    set_property RADIX: dec | hex(其他实测未通过;大写一律不接受)

    signed decimal 在 XSim 叫 dec,不是 signed(从 ModelSim/QuestaSim 带过来的命名习惯会踩)。

  • Analog 波形可纯 Tcl 渲染(早期文档误判"无 Tcl 接口"的真根因)。 WaveformStyle 不在 list_property $w / set_property 全集里,要用专用命令 set_wave_prop。当年踩坑是因为值写成了裸 ANALOG——Vivado 收下不报错但 渲染器不认,只改属性值不渲染(静默接受陷阱)。正确值必须带 STYLE_ 前缀, 且信号寻址有两个静默坑(实测 2019.1):

    # ★ get_waves 按"显示名"(如 y0[15:0])/glob 匹配,传全路径 /tb/y0 返回空!
    #   且 set_wave_prop 对空对象 rc=0 静默接受 → 信号没 add 会伪装成功,务必先判空。
    set w [get_waves -quiet y0*]   ;# 用显示名/glob;或遍历 get_waves * 按 DESIGN_OBJECT 全路径过滤
    if {[llength $w]} {
      set_wave_prop WaveformStyle STYLE_ANALOG $w  ;# ★ 裸 ANALOG 静默吞值不渲染
      set_wave_prop AnalogMin -2048 $w             ;# 贴数据范围:太宽压平,太窄削顶
      set_wave_prop AnalogMax  2047 $w
      set_wave_prop AnalogInterpolation LINEAR $w
      set_property HEIGHT 80 $w                     ;# 存为 CellHeight
    }
    • 无法 Tcl 读回:get_wave_prop 不存在、report_wave_props 输出不可捕获, 设完只能人眼确认渲染(MCP set_wave_analog 工具已封装寻址 + STYLE_ 前缀)。

    • 重载冲掉 analog:先定好 zoom 再实时上 analog,别先改 analog 再 open_wave_config。

    • wcfg 磁盘路径属性是 FILE_PATH(不是 FILE_NAME,后者报 [Common 17-54]): get_property FILE_PATH [current_wave_config](MCP set_wave_zoom 改 zoom_setting 用此)。

Args: command: Tcl 命令文本(支持多行)。 session_id: 目标会话 ID,默认 "default"。 timeout: 命令执行超时秒数,默认 120。注意超时语义:超时只是 MCP 停止 等待并返回错误,命令在 Vivado 里仍在继续跑(不会被取消),后续 命令会排队等它跑完。长任务(综合/实现/比特流)请改用 run_synthesis / run_implementation / generate_bitstream (Python 轮询不阻塞),或按预期耗时调大本值。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
commandYes
timeoutNo
session_idNodefault

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of disclosing behavior. It is exceptionally transparent: it explains that timeout only stops MCP waiting, not command execution; it documents many silent XSim pitfalls (e.g., add_wave_group requiring -into, escaped-id rejection, get_scopes multi-path failure, size filters being ineffective); and it warns about set_property RADIX case-sensitivity and other silent traps. This goes far beyond a typical description.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is very long, but it is well-structured with clear sections (general examples, XSim pitfalls, set_property/radix traps) and front-loaded with the core purpose. It is information-dense and every section provides practical value, though it is verbose enough to be a token burden for an LLM; slight trimming would make it more concise.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's high complexity, zero schema coverage, and no annotations, the description is remarkably complete. It covers when to use alternatives, parameter semantics, timeout behavior, known bugs, silent failure modes, and concrete workarounds. The presence of an output schema means return values need not be described in detail, and the description exceeds what is necessary for effective tool invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate. It does: command is explained as Tcl text with multiline support and many examples; session_id is labeled as target session with default 'default'; timeout is explained with default 120 and detailed semantics about how timeout behaves (MCP stops waiting but command continues in Vivado). This gives the agent far more parameter understanding than the bare schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description opens with a specific verb and resource: '执行任意 Vivado Tcl 命令' (execute any Vivado Tcl command), and explicitly lists supported domains with concrete examples. It distinguishes itself from siblings by naming safe_tcl as an alternative for paths with special characters and referring long-running tasks to dedicated tools like run_synthesis.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides explicit when-to-use guidance: it is the most generic tool for any Vivado Tcl command. It gives clear exclusions: use safe_tcl for special-character paths, and use run_synthesis/run_implementation/generate_bitstream for long tasks. It also explains timeout semantics with behavioral consequences, helping the agent decide when to set a larger timeout or use a different tool.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/mapleleavessssssss-wq/vivado-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server