电子达模拟
- 作者仓库星标 19
- 作者仓库 eda-sim
- 领域
- 人工智能
- 作者声明的智能体
- 未找到明确声明;不据此推断已兼容或已测试
- 静态检查
- 88 / 100 · 启发式扫描,不代表运行安全
- 运行环境证据
- 未执行;当前没有隔离运行测试证据
- 作者 / 版本 / 许可证
- @cike128 · 未声明许可证
- 上下文用量评级
- 低消耗
- 接入复杂程度
- 需简单配置
- 是否需要外部接口密钥
- 不需要
- 兼容的系统
- 未声明(默认跨平台)
- 运行环境要求
- Python >=3.6
- 检测到的文件与系统行为
-
- 只读
- 允许写入 / 修改
- 命令执行
- 网络行为
- 仅限本地
- 安装命令数
- 无(仅作为资料)
需要注意: 未声明工具权限范围;实际权限由运行环境决定。
# 1. Verify simulation completed
grep -q '$finish' sim.log && echo "SIM FINISHED" || echo "SIM INCOMPLETE"
# 2. Check for errors (filter known benign patterns via exclude.txt)
grep -iE 'error|warning' sim.log \
| grep -v 'Warning-\[' \
| grep -v 'UVM_WARNING *:' \
| grep -v 'UVM_ERROR *:' \
| grep -v 'UVM_FATAL *:' \
| grep -v -f exclude.txt
在进行任何 EDA 操作之前,请获取项目环境:这将设置所有必需的变量。验证方式:如果 `.envrc` 不存在,请按照以下模板创建一个:
可用时使用项目 Makefile: 如果没有 Makefile 或者它不起作用,请使用直接 VCS 调用: 要点: 始终使用 `$VCS_BIN`(直接二进制路径),切勿裸露 `vcs` `-timescale=1ns/1ps` 为没有明确时间刻度的模块设置默认值
使用项目回归脚本: 如果编写自定义回归脚本,关键模式: 使用 `$VCS_BIN` 而不是 `vcs` 进行编译 每个测试都需要自己的带有 `current_case/` 符号链接的工作目录 如果测试用例未提供(flist 需要它),则创建空的 `define.sv`
检查模拟通过/失败:添加到`exclude.txt`的常见误报模式: `error_type.*v_error_type_e` — UVM 事务字段打印 `^UVM_INFO` — 包含“错误”子字符串的信息消息 `error_en 0 rand_num` — 协议日志中的错误启用字段
FSDB 是 Synopsys 专有的二进制格式。使用捆绑的`scripts/fsdb_reader.py`以编程方式读取信号。该脚本使用 Synopsys NPI(主要)或 CLI 工具(后备),无需 GUI。重要提示:NPI 需要 Verdi 的捆绑 Python 3.6 (`$VERDI_HOME/platform/linux64/Python/bin/python3.6`)。脚本会自动检测到这一点。系统 Python (3.7+) 将导致 NPI `.so` 文件出现段错误 — 该脚本通过调用 Verdi 的 Python 作为子进程来透明地处理此问题。
# Offline EDA Simulation Workflow
This skill defines the mandatory procedure for running Synopsys VCS simulations in an offline (no-network) environment. The EDA tools are installed locally but their default wrappers try to phone home for license validation, which fails without network access. The workaround is to invoke binaries directly and point to a local license server.
## Why This Matters
Synopsys tool wrappers (e.g., `vcs`, `verdi`) use `snpslmd` license checkout that may route through network namespaces. In offline setups, this fails silently or hangs. By calling the binary directly via `$VCS_BIN` (set in `.envrc`) and ensuring `SNPSLMD_LICENSE_FILE=27000@localhost.localdomain`, we bypass network dependencies entirely.
## Step 0: Environment Setup (MANDATORY, every session)
Before ANY EDA operation, source the project environment:
```bash
source <project_root>/.envrc
```
This sets all required variables. Verify with:
```bash
echo "VCS_BIN=$VCS_BIN"
echo "VERDI_HOME=$VERDI_HOME"
echo "LM_LICENSE_FILE=$LM_LICENSE_FILE"
```
If `.envrc` doesn't exist, create one following this template:
```bash
#!/bin/bash
export PROJECT_HOME="<absolute_path>"
export DV_ROOT="$PROJECT_HOME/dv"
export DIG_ROOT="$PROJECT_HOME/rtl"
export VCS_HOME="<path_to_vcs_installation>"
export VERDI_HOME="<path_to_verdi_installation>"
export SNPSLMD_LICENSE_FILE="27000@localhost.localdomain"
export LM_LICENSE_FILE="$SNPSLMD_LICENSE_FILE"
export VCS_BIN="$VCS_HOME/bin/vcs"
export VERDI_PLI_TAB="$VERDI_HOME/share/PLI/VCS/LINUX64/novas.tab"
export VERDI_PLI_A="$VERDI_HOME/share/PLI/VCS/LINUX64/pli.a"
export PATH="$DV_ROOT/sim:$PATH"
```
## Step 1: Running a Single Test
Use the project Makefile when available:
```bash
cd $DV_ROOT/sim
make all CASE_NAME=<category/test_name>
```
If no Makefile or it doesn't work, use direct VCS invocation:
```bash
$VCS_BIN -full64 -top test_bench -sverilog -lca -kdb \
-f $DV_ROOT/sim/flist \
-timescale=1ns/1ps \
+notimingcheck +nospecify \
-debug_access+all \
+define+DUMPOFF \
+warn=noIPC +lint=TFIPC-L \
+error+20 \
-P $VERDI_PLI_TAB $VERDI_PLI_A \
-l compile.log
./simv +UVM_TESTNAME=base_test -l sim.log
```
Key points:
- Always use `$VCS_BIN` (the direct binary path), NEVER bare `vcs`
- `-timescale=1ns/1ps` sets default for modules without explicit timescale
- Do NOT use `-unit_timescale` — it overrides ALL modules including vendor IPs with different timescales, causing timing behavior changes
- Do NOT use `+memcbk` on VCS 2023.12+ — it's deprecated, use `-debug_access+all` instead
## Step 2: Running Regression
Use the project regression script:
```bash
cd $DV_ROOT/sim
./run_regr.sh [regr_list_name] # Default: regr_list
MAX_PARALLEL=8 ./run_regr.sh regr_list # Override parallel count
```
If writing a custom regression script, key patterns:
- Use `$VCS_BIN` not `vcs` for compilation
- Each test needs its own working directory with `current_case/` symlinks
- Create empty `define.sv` if the test case doesn't provide one (flist requires it)
- Check `sim.log` for `$finish` AND filter error/warning lines using `exclude.txt`
- Use `timeout` command to prevent hung simulations
## Step 3: Post-Processing Results
Check simulation pass/fail:
```bash
# 1. Verify simulation completed
grep -q '$finish' sim.log && echo "SIM FINISHED" || echo "SIM INCOMPLETE"
# 2. Check for errors (filter known benign patterns via exclude.txt)
grep -iE 'error|warning' sim.log \
| grep -v 'Warning-\[' \
| grep -v 'UVM_WARNING *:' \
| grep -v 'UVM_ERROR *:' \
| grep -v 'UVM_FATAL *:' \
| grep -v -f exclude.txt
```
Common false positive patterns to add to `exclude.txt`:
- `error_type.*v_error_type_e` — UVM transaction field prints
- `^UVM_INFO` — info messages containing "error" substring
- `error_en 0 rand_num` — error-enable field in protocol logs
- `Command:.*simv` — VCS command line echoes containing "error" in paths
- `illegal seting of role control` — analog model transient states
- `MEM_Error` — SRAM model clock glitch in functional sim (no SDF)
## Step 4: Waveform Debug (if needed)
```bash
# Recompile with waveform dump enabled
make all CASE_NAME=<name> FSDB=1
# Launch Verdi
$VERDI_HOME/bin/verdi -elab simv.daidir/kdb.elab++ -ssf test.fsdb
```
## Step 5: Coverage
```bash
# After regression, merge coverage databases
urg -full64 -dir $(find . -name "*.vdb") -dbname merge.vdb
# View in Verdi
$VERDI_HOME/bin/verdi -cov -covdir merge.vdb
```
## Step 6: FSDB Waveform Reading (without Verdi GUI)
FSDB is a Synopsys proprietary binary format. Use the bundled `scripts/fsdb_reader.py` to read signals programmatically. The script uses **Synopsys NPI (primary)** or CLI tools (fallback), no GUI needed.
**IMPORTANT**: NPI requires Verdi's bundled Python 3.6 (`$VERDI_HOME/platform/linux64/Python/bin/python3.6`). The script auto-detects this. System Python (3.7+) will cause segfault with NPI `.so` files — the script handles this transparently by invoking Verdi's Python as a subprocess.
### Read a signal's value changes
```bash
python3 <skill_dir>/scripts/fsdb_reader.py <file.fsdb> --signal <path> [--start <time>] [--end <time>] [--format h]
```
Signal paths use `.` as hierarchy separator (NPI native format):
```bash
python3 scripts/fsdb_reader.py test.fsdb --signal test_bench.u_chip.clk --end 100ns
```
Format options: `b` (binary), `o` (octal), `d` (decimal), `u` (unsigned), `h` (hex, default).
### List signals in an FSDB
```bash
python3 scripts/fsdb_reader.py test.fsdb --list-signals --depth 2
```
### Convert FSDB to VCD
```bash
python3 scripts/fsdb_reader.py test.fsdb --to-vcd --output out.vcd [--end 1us]
```
VCD is a text format readable by any tool. Use `--end` to limit file size for large FSDBs.
### Force CLI fallback mode
```bash
python3 scripts/fsdb_reader.py test.fsdb --signal test_bench.clk --cli
```
### Direct CLI (alternative)
If the script isn't available, use Verdi tools directly:
```bash
# Read signal values (fsdbreport uses / separator, writes report.txt to CWD)
$VERDI_HOME/bin/fsdbreport file.fsdb -s "test_bench/signal_name" -of h -et 1us
# Convert to VCD
$VERDI_HOME/bin/fsdb2vcd file.fsdb -o output.vcd -et 1us
```
### Generating FSDB from simulation
To enable FSDB dump, run with `FSDB=1`:
```bash
make all CASE_NAME=<name> FSDB=1
```
If the testbench `$fsdbDumpvars` is commented out, use UCLI at runtime:
```bash
echo 'call {$fsdbDumpfile("test.fsdb")}
call {$fsdbDumpvars(0, test_bench)}
run
quit' > dump.tcl
./simv +UVM_TESTNAME=base_test -ucli -i dump.tcl -l sim.log
```
## Compilation Troubleshooting
| Error | Cause | Fix |
|-------|-------|-----|
| `Error-[DEBUG_DEP_ERROR] +memcbk deprecated` | VCS 2023.12+ removed `+memcbk` | Use `-debug_access+all` instead |
| `Error-[XMRE] Cross-module reference` | Test references instances not in current TB | Check if the model/module exists in the testbench |
| `Error-[UM] Undefined macro` | Missing `+define+` or define file not compiled before RTL | Ensure `define.sv` is listed BEFORE RTL in flist |
| `Error-[SFCOR] Source file cannot be opened` | Generated file (e.g., from TCL script) not created | Run the generation script (e.g., `tclsh gen_regs.tcl > test_cmd.sv`) |
| `Error-[SE] Syntax error: parameter in begin block` | `parameter`/`localparam` not allowed in procedural blocks | Inline the constant value or move declarations before assignments |
| License checkout failure / tool hangs | Network wrapper can't reach license server | Use `$VCS_BIN` directly instead of `vcs` wrapper |
## Regression Analysis Checklist
When analyzing regression failures:
1. Classify failures: COMPILE FAIL vs SIM FAIL vs TIMEOUT
2. For SIM FAIL, check `check_log_failed.log` — if it only contains `V_NO_ERROR` or `error_type` lines, it's a false positive
3. Group failures by error pattern (ADC value mismatch, CC timing, MEM_Error, etc.)
4. Fix the highest-impact issues first (false positive filtering fixes the most tests)
5. Re-process existing sim.log files when only the pass/fail checker changed (no need to re-simulate)
按说明文件中的顺序排列。
为什么这很重要
步骤 0:环境设置(强制,每个会话)
第 1 步:运行单个测试
第 2 步:运行回归
步骤 3:后处理结果
文件/命令 -> vcs · verdi · snpslmd · $VCS_BIN · .envrc · SNPSLMD_LICENSE_FILE=27000@localhost.localdomain · -timescale=1ns/1ps · -unit_timescale
内容校验值 -> da044f8cd17a
当前原文的自动摘译,尚未人工审校。
为什么这很重要
Synopsys 工具包装器(例如,
vcs、verdi)使用可通过网络命名空间路由的snpslmd许可证签出。在离线设置中,此操作会默默失败或挂起。通过直接通过$VCS_BIN(在.envrc中设置)调用二进制文件并确保SNPSLMD_LICENSE_FILE=27000@localhost.localdomain,我们完全绕过了网络依赖性。