Skip to main content
Glama

cg_simulate

Simulate C-like HDL source code to verify correctness through bytecode or Verilog simulation, returning pass/fail diagnostics and output values.

Instructions

Simulate C⏚ source. Returns {ok, simulator, timed_out, diagnostics, output}. output holds port values and print() lines; a properties { test: {...} } block self-checks and fails the run on mismatch. This is the ground-truth correctness check — iterate until ok is true.

simulator picks the backend: 'bytecode' (default — the compiler's fast simulator, no HDL toolchain) or 'iverilog' (generate Verilog + testbench and run Icarus Verilog, a Verilog-level cross-check; needs a network <Name>_test). 'verilator' is accepted but reported unavailable unless installed.

For a MULTI-FILE project, pass package_dir (the folder with your .cg files, e.g. "fpga/src/main/cg") so every sibling task in the same package resolves — a cg_example you pulled must be saved to a file in that dir, not just referenced.

report_dir DEFAULTS to "fpga/build" — this run's PASS/FAIL + output is recorded into that dir's accumulating report.html (see cg_report). Pass report_dir="" to disable.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sourceYes
timeoutNo
simulatorNobytecode
report_dirNofpga/build
extra_filesNo
package_dirNo
Behavior5/5

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

With no annotations, the description fully discloses behavioral traits: return values (ok, simulator, timed_out, diagnostics, output), self-check blocks that fail on mismatch, and simulator availability conditions. No contradictions.

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 well-structured with front-loaded return structure and separate sections for simulator options and multi-file projects. It is informative without being overly verbose, though could be slightly more concise.

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

Completeness4/5

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

Given the complexity (6 params, no output schema, no annotations), the description covers main use cases, return values, and configuration. Missing details on 'extra_files' and exact format of 'source', but overall provides sufficient context for an agent.

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

Parameters4/5

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

Schema coverage is 0%, so the description carries the burden. It explains source (implied), simulator (choices and requirements), report_dir (default and disable), and package_dir (multi-file usage). Timeout and extra_files are less explained, but key parameters are well covered.

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 clearly states the tool simulates a C⏚ source and details the return structure. It distinguishes itself from siblings like cg_generate_verilog or cg_synth by focusing on simulation and correctness checking.

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

Usage Guidelines4/5

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

The description provides guidelines on when to use built-in bytecode or Verilog simulators, notes dependencies for iverilog and verilator, and explains multi-file projects. It does not explicitly contrast with all siblings but gives clear context for iterative testing.

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/Neosyn-Logic/cg-agent-kit'

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