Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@
#########
.PHONY: develop build build-verilator install dependencies-linux dependencies-macos dependencies-win copy-verilator copy-verilator-win update-verilator-config

VERILATOR_CMAKE_ARGS := \
-DCMAKE_CXX_STANDARD=23 \
-DCMAKE_INSTALL_PREFIX=verilator

ifneq ($(OS),Windows_NT)
VERILATOR_CMAKE_ARGS += \
-DFLEX_EXECUTABLE=/usr/bin/flex \
-DFLEX_INCLUDE_DIR=/Library/Developer/CommandLineTools/usr/include
endif

develop: ## install dependencies and build library
uv pip install -e .[develop]

Expand All @@ -26,7 +36,7 @@ dependencies-win:

build-verilator: ## build verilator
git submodule update --init --recursive
cmake -B build src -DCMAKE_CXX_STANDARD=17 -DCMAKE_INSTALL_PREFIX=verilator
cmake -B build src $(VERILATOR_CMAKE_ARGS)
cmake --build build --config Release -j 3
cmake --install build

Expand All @@ -52,16 +62,16 @@ lint-py: ## lint python with ruff
python -m ruff format --check verilator

lint-docs: ## lint docs with mdformat and codespell
python -m mdformat --check README.md
python -m codespell_lib README.md
python -m mdformat --check README.md
python -m codespell_lib README.md

fix-py: ## autoformat python code with ruff
python -m ruff check --fix verilator
python -m ruff format verilator

fix-docs: ## autoformat docs with mdformat and codespell
python -m mdformat README.md
python -m codespell_lib --write README.md
python -m mdformat README.md
python -m codespell_lib --write README.md

lint: lint-py lint-docs ## run all linters
lints: lint
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ verilator-cli build sv/*.sv --includes sv --top-module top --exe sv/sim_sv.cpp
```

## License

This software is licensed under the Apache 2.0 license. See the [LICENSE](LICENSE) file for details.

Verilator is Copyright 2003-2026 by Wilson Snyder. Verilator is free software subject to either the GNU Lesser General Public License Version 3 or the Perl Artistic License Version 2.0.
Expand Down
14 changes: 11 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[build-system]
requires = [
"hatchling",
"systemc",
]
build-backend = "hatchling.build"

Expand All @@ -12,7 +13,7 @@ authors = [
description = "Python wrapping/binding for verilator"
readme = "README.md"
license = { text = "Apache-2.0" }
version = "5.44.0"
version = "5.48.0"
requires-python = ">=3.10"
keywords = []

Expand All @@ -27,7 +28,9 @@ classifiers = [
"Programming Language :: Python :: 3.14",
]

dependencies = []
dependencies = [
"systemc",
]

[project.optional-dependencies]
cli = [
Expand Down Expand Up @@ -60,7 +63,7 @@ Repository = "https://github.com/dau-dev/verilator-python"
Homepage = "https://github.com/dau-dev/verilator-python"

[tool.bumpversion]
current_version = "5.44.0"
current_version = "5.48.0"
commit = true
tag = true
commit_args = "-s"
Expand Down Expand Up @@ -155,6 +158,11 @@ exclude = [
"/pyproject.toml",
]

[tool.hatch.build.targets.wheel.shared-data]
"verilator/include" = "include/verilator"
"verilator/lib" = "lib/verilator"
"verilator/share" = "share/verilator"

[tool.pytest.ini_options]
addopts = [
"-vvv",
Expand Down
2 changes: 1 addition & 1 deletion src
Submodule src updated 9197 files
2 changes: 1 addition & 1 deletion verilator/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "5.44.0"
__version__ = "5.48.0"
18 changes: 18 additions & 0 deletions verilator/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,27 @@ def _get_verilator() -> str:
verilator_exe = str((verilator_root / "bin" / "verilator").resolve())
environ["VERILATOR_ROOT"] = str(verilator_root.as_posix())
environ["CXXFLAGS"] = environ.get("CXXFLAGS", "--std=c++20 -DVL_TIME_CONTEXT")
_set_systemc_env()
return verilator_exe


def _set_systemc_env() -> None:
"""Point Verilator at the bundled ``systemc`` Python package's headers/libs.

Resolved at runtime so the paths are correct regardless of where ``systemc``
was installed during the build (build isolation, different venvs, etc.).
Existing ``SYSTEMC_INCLUDE`` / ``SYSTEMC_LIBDIR`` env vars take precedence.
"""
if environ.get("SYSTEMC_INCLUDE") and environ.get("SYSTEMC_LIBDIR"):
return
try:
import systemc
except ImportError:
return
environ.setdefault("SYSTEMC_INCLUDE", systemc.include_path())
environ.setdefault("SYSTEMC_LIBDIR", systemc.lib_path())


def verilator(argv):
build_cmd = [
_get_verilator(),
Expand Down
2 changes: 1 addition & 1 deletion verilator/tests/module/ff_tb.sv
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ program ff_tb(ff_ifc.bench ds);

/* begin testing */
repeat(v.iter) begin
int _ = v.randomize();
static int _ = v.randomize();

ds.reset = 1'b0;
ds.valid_i = 1'b1;
Expand Down
Loading