Skip to content

feat(verilator): Support Verilator target build to shared library#6281

Merged
waruqi merged 1 commit intoxmake-io:devfrom
CodeWenjiu:verilator
Apr 7, 2025
Merged

feat(verilator): Support Verilator target build to shared library#6281
waruqi merged 1 commit intoxmake-io:devfrom
CodeWenjiu:verilator

Conversation

@CodeWenjiu
Copy link
Contributor

close #6280

@waruqi
Copy link
Member

waruqi commented Apr 3, 2025

wait for #6209

We need to add support for the new jobgraph to replace batchjobs

@waruqi waruqi requested a review from Copilot April 3, 2025 01:04
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces support for building the Verilator target into a shared library by adding a new simulation main file for testing purposes.

  • Added sim_main.cpp to initialize simulation using VerilatedContext and a hello instance.
  • Implements the simulation loop to run until completion.
Files not reviewed (3)
  • tests/projects/embed/verilator/shared/src/main.v: Language not supported
  • tests/projects/embed/verilator/shared/xmake.lua: Language not supported
  • xmake/rules/verilator/xmake.lua: Language not supported
Comments suppressed due to low confidence (2)

tests/projects/embed/verilator/shared/src/sim_main.cpp:7

  • [nitpick] Consider using std::unique_ptr to manage the lifetime of VerilatedContext, which can improve exception safety and simplify resource cleanup.
VerilatedContext* contextp = new VerilatedContext;

tests/projects/embed/verilator/shared/src/sim_main.cpp:9

  • [nitpick] Consider using std::unique_ptr for the hello instance to take advantage of RAII, reducing the risk of memory leaks if an exception is thrown.
hello* top = new hello{contextp};

@waruqi waruqi closed this Apr 3, 2025
@waruqi waruqi reopened this Apr 3, 2025
@waruqi waruqi added this to the v2.9.9 milestone Apr 7, 2025
@waruqi waruqi merged commit 27ddfdb into xmake-io:dev Apr 7, 2025
27 of 44 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support Verilator target build to shared library

3 participants