Proposal: Share the RTL testbench between Verilator and VCS
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 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時間
- マージ済み PR(30日)
- 33
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- 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 1週間以上 初心者へのやさしさ 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