Proposal: Share the RTL testbench between Verilator and VCS
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 25/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- cpp
- 领域
- build-system, testing
调研方向
Start by reading sim/rtlsim/processor.cpp, sim/rtlsim/main.cpp, and the existing RTL shim to trace how Verilator handles reset, memory handshakes, and results. Then review hw/dpi/ and the librtlsim.so runtime path before deciding how to share the testbench with VCS. Done means preserving current Verilator behavior and validating the proposed shared flow with selected RV32 integer ELF tests; VCS has not yet been tested.
由索引模型根据 Issue 内容生成。
描述
Proposal: Share the RTL testbench between Verilator and VCS
Motivation
I would like to add Synopsys VCS support using a shared RTL testbench for Verilator and VCS.
Maintaining separate reset sequences, memory-interface handling, and test-result checks for each simulator would make future changes harder to keep consistent. I suggest first separating the existing testbench behavior from the Verilator execution code, then adding VCS support to the shared implementation.
This proposal is based on commit 7b67f0210c95. VCS compilation and execution have not yet been tested.
Current implementation
sim/rtlsim/processor.cpp combines several responsibilities:
- Creating and controlling the Verilator model.
- Driving reset, DCR transactions, and execution.
- Handling memory requests and responses.
- Advancing the DRAM model and managing waveform output.
sim/rtlsim/main.cpp loads programs and handles standalone execution results. The RTL shim connects the Vortex design to the external memory and control interfaces.
The build also produces librtlsim.so, which sw/runtime/rtlsim uses for in-process simulation. Any restructuring needs to preserve this existing Verilator runtime path.
Proposed structure
Keep sim/rtlsim/ as the build entry point and organize its implementation into three directories:
sim/rtlsim/
├── Makefile
├── common/
│ ├── sources.mk
│ ├── rtlsim_shim.sv
│ ├── testbench.sv
│ ├── dpi_bridge.cpp
│ ├── program.cpp
│ ├── program.h
│ └── processor.h
├── verilator/
│ ├── build.mk
│ ├── main.cpp
│ ├── processor.cpp
│ └── verilator.vlt.in
└── vcs/
├── build.mk
└── run.sh.in
These filenames are a starting point for discussion. The intended separation is:
common/: shared testbench behavior, program preparation, result handling, and source selection.verilator/: Verilator build options, model lifecycle, simulation scheduling, and tracing integration.vcs/: VCS build options and execution setup.
The existing RAM, DRAM, and ELF-loading code in sim/common/ would remain there and be reused.
Shared testbench behavior
Both simulators would compile the same SystemVerilog testbench and the shared rtlsim_shim.sv DUT wrapper.
The shared testbench would own reset sequencing, DCR signaling, start/busy handling, and memory-interface handshakes. A DPI bridge would connect it to the existing C++ memory models and program-loading code.
Memory timing and protocol handling need a clear boundary. For example, the C++ model would determine when a memory response becomes available, while the SV testbench would hold that response until the DUT accepts it.
Simulator-specific code should not implement its own reset policy, memory-address mapping, or pass/fail rules. When behavior moves into the shared testbench, its previous implementation should be removed from the Verilator path.
The DPI sources under hw/dpi/ would also need review for Verilator-specific headers and assumptions, including data types, scope/context use, and tracing.
Build interface
The proposed build commands are:
make -C sim/rtlsim SIMULATOR=verilator
make -C sim/rtlsim SIMULATOR=vcs
Verilator would remain the default.
The top-level Makefile would select a simulator-specific build.mk. The top-level Makefile would select a simulator-specific build.mk. common/sources.mk would define the shared source lists and include paths. Both simulators would use the existing TOML-based configuration flow, with each build file supplying the corresponding tool-specific options.
Generated files would remain in the configured build tree. Simulator outputs and configuration stamps must be separated so that switching engines cannot reuse incompatible artifacts.
Scope and implementation plan
The goal is to support the existing Verilator-based rtlsim functionality in VCS using the shared testbench. Existing build and execution commands would continue to use Verilator unless VCS is explicitly selected. Verilator would remain the default simulator, and existing build and execution commands would continue to use it unless VCS is explicitly selected.
The first change would restructure the Verilator implementation while preserving its existing standalone execution and host runtime behavior.
The next change would add VCS support, starting with selected RV32 integer ELF tests as an initial validation step. Subsequent work would extend VCS support to the remaining functionality of the current rtlsim path, including host runtime integration.
Host runtime integration would need to account for the in-process interface currently exposed by librtlsim.so. A standalone VCS executable does not provide that interface by itself, so the connection mechanism would need to be designed and validated. Any functionality not yet supported by the VCS backend should be documented. Requests for unsupported functionality should return a clear error.
AFU/XRT integration would remain outside the initial scope because it uses a separate simulation path.
Feedback requested
Would the proposed common/, verilator/, and vcs/ structure be a suitable way to share the RTL testbench between the two simulators?
Are there any performance, compatibility, or host runtime constraints I should consider before starting the implementation?
If I implement this proposal and submit a pull request, would you be willing to review it?
- 主要语言
- Verilog
- 星标
- 2.4k
- 派生
- 563
- 平均合并
- 2 天 12 小时
- 30 天内合并 PR
- 33
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
vortexgpgpu/vortex 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 70/100
vortexgpgpu/vortex#501 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 62/100
vortexgpgpu/vortex#499 ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 22/100
vortexgpgpu/vortex#505 ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 28/100
vortexgpgpu/vortex#504 ·
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 22/100
vortexgpgpu/vortex#503 ·
维护者通常 1 天内回复
查看 vortexgpgpu/vortex 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 68/100
-
难度 2/5 1-3 小时 新手友好度 72/100
layer5io/blowhorn-site#781 ·
-
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
good first issue
难度 2/5 1-3 小时 新手友好度 78/100
-
难度 2/5 1-3 小时 新手友好度 72/100