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
50 changes: 35 additions & 15 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
outputs:
artifact_name: parser-generated-sources
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@v7
with:
submodules: true

Expand All @@ -44,7 +44,7 @@ jobs:
cp -v /usr/include/FlexLexer.h ../../generated

- name: Upload parser artifact
uses: actions/upload-artifact@v7
uses: actions/upload-artifact@v7.0.1
with:
name: parser-generated-sources
path: generated/*
Expand Down Expand Up @@ -162,11 +162,11 @@ jobs:

steps:
# build steps
- uses: actions/checkout@v6
- uses: actions/checkout@v7
with:
submodules: true
- name: Setup Python
uses: actions/setup-python@v6
uses: actions/setup-python@v7
with:
python-version: "3.11"
- name: Download parser-generated sources
Expand All @@ -189,6 +189,33 @@ jobs:
brew install -q boost
- name: Install cibuildwheel (and delvewheel for Windows)
run: python -m pip install cibuildwheel==4.2.1 delvewheel
- name: Configure Windows dependency cache
if: runner.os == 'Windows'
shell: pwsh
run: |
$cachePath = Join-Path $env:RUNNER_TEMP 'vcpkg-binary-cache'
New-Item -ItemType Directory -Force -Path $cachePath | Out-Null
Add-Content $env:GITHUB_ENV "VCPKG_BINARY_SOURCES=clear;files,$cachePath,readwrite"
Add-Content $env:GITHUB_ENV "VCPKG_CACHE_IMAGE=$env:ImageOS-$env:ImageVersion"
- name: Restore Windows dependency cache
if: runner.os == 'Windows'
id: vcpkg-cache
uses: actions/cache/restore@v6
with:
path: ${{ runner.temp }}/vcpkg-binary-cache
# Share native dependencies across Python versions; refresh on runner
# image updates so a new compiler can populate its own cache.
key: vcpkg-${{ runner.os }}-${{ runner.arch }}-${{ env.VCPKG_CACHE_IMAGE }}-${{ hashFiles('ci/windows_setup.ps1') }}
- name: Install Windows dependencies
if: runner.os == 'Windows'
shell: pwsh
run: ./ci/windows_setup.ps1
- name: Save Windows dependency cache
if: runner.os == 'Windows' && steps.vcpkg-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v6
with:
path: ${{ runner.temp }}/vcpkg-binary-cache
key: ${{ steps.vcpkg-cache.outputs.cache-primary-key }}
- name: Build wheels
env:
CIBW_ENVIRONMENT: SKLEARN_SKIP_NETWORK_TESTS=1
Expand All @@ -202,9 +229,6 @@ jobs:
CIBW_MANYLINUX_X86_64_IMAGE: ${{ matrix.manylinux_image }}
CIBW_MANYLINUX_AARCH64_IMAGE: ${{ matrix.manylinux_image }}
CIBW_MANYLINUX_I686_IMAGE: ${{ matrix.manylinux_image }}
CIBW_BEFORE_ALL_WINDOWS: >
pwsh -NoProfile -NonInteractive -ExecutionPolicy Bypass
-File {project}\ci\windows_setup.ps1
CIBW_BEFORE_BUILD_WINDOWS: "pwsh -Command \"foreach($d in 'build','dist'){ if(Test-Path $d){ Remove-Item -Recurse -Force $d -ErrorAction SilentlyContinue } }\""
CIBW_CONFIG_SETTINGS_WINDOWS: >
cmake.args=-DCMAKE_TOOLCHAIN_FILE=C:/Users/runneradmin/vcpkg/scripts/buildsystems/vcpkg.cmake
Expand Down Expand Up @@ -274,8 +298,6 @@ jobs:
echo "macOS wheel compatibility check failed."
exit 1
fi
#Reminder!!: actions/upload-artifact and actions/download-artifact
#need to have same version
- uses: actions/upload-artifact@v7
with:
name: cibw-wheels-cp${{ matrix.python }}-${{ matrix.platform_id }}
Expand All @@ -286,12 +308,12 @@ jobs:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@v7
with:
submodules: true

- name: Setup Python
uses: actions/setup-python@v6
uses: actions/setup-python@v7
with:
python-version: "3.11"

Expand Down Expand Up @@ -338,8 +360,6 @@ jobs:
permissions:
id-token: write
steps:
#Reminder!!: actions/upload-artifact and actions/download-artifact
#need to have same version
- uses: actions/download-artifact@v8
with:
pattern: cibw-*
Expand All @@ -351,7 +371,7 @@ jobs:
name: sdist
path: dist

- uses: pypa/gh-action-pypi-publish@v1.14.0
- uses: pypa/gh-action-pypi-publish@v1.14.2
with:
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository-url: https://test.pypi.org/legacy/
Expand All @@ -374,7 +394,7 @@ jobs:
with:
name: sdist
path: dist
- uses: pypa/gh-action-pypi-publish@v1.14.0
- uses: pypa/gh-action-pypi-publish@v1.14.2
with:
password: ${{ secrets.PYPI_API_TOKEN }}
skip-existing: true
1 change: 1 addition & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ ci/check_submodule_bazel_sync.py`.

## Conventions

- Whenever the `najaeda` version is incremented, update the pinned `najaeda` version in all Colab tutorials under `tutorials/notebooks/` and the local installation command in `tutorials/README.md` in the same change.
- Every new file, including test fixtures and helper scripts, must have both copyright and licensing information. For Naja-authored files, add `SPDX-FileCopyrightText: <year> The Naja authors <https://github.com/najaeda/naja/blob/main/AUTHORS>` and `SPDX-License-Identifier: Apache-2.0` using the file format's comment syntax. Preserve third-party attribution and licenses. For files that cannot contain comments, add coverage in `.reuse/dep5`. Before finishing a change that adds files or changes licensing metadata, run `reuse lint` and fix any missing copyright or licensing information introduced by the change.
- Match the surrounding code's style, naming, and comment density — the SNL layer uses `NL*`/`SNL*` prefixes; follow the local idiom.
- The SystemVerilog frontend is built on **slang**; sequential lowering and always-block handling live in `SNLSVConstructor` and the "Sequential Assignment Lowering" community — query the graph before touching them.
Expand Down
33 changes: 22 additions & 11 deletions ci/windows_setup.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,30 @@
#
# SPDX-License-Identifier: Apache-2.0

Write-Host "Installing vcpkg (latest)"
$ErrorActionPreference = 'Stop'
$PSNativeCommandUseErrorActionPreference = $true

git clone https://github.com/microsoft/vcpkg.git $env:USERPROFILE/vcpkg
& "$env:USERPROFILE/vcpkg/bootstrap-vcpkg.bat"
# The wheel cache key includes this script, so dependency changes refresh it.
$vcpkgRevision = '10541e317a660f4165ba4ac2851ab54a8d4577b1'
$vcpkgRoot = "$env:USERPROFILE/vcpkg"
Write-Host "Installing vcpkg ($vcpkgRevision)"

# Install dependencies
& "$env:USERPROFILE/vcpkg/vcpkg.exe" install capnproto:x64-windows
& "$env:USERPROFILE/vcpkg/vcpkg.exe" install tbb:x64-windows
& "$env:USERPROFILE/vcpkg/vcpkg.exe" install boost-intrusive:x64-windows
& "$env:USERPROFILE/vcpkg/vcpkg.exe" install boost-dynamic-bitset:x64-windows
& "$env:USERPROFILE/vcpkg/vcpkg.exe" install boost-multiprecision:x64-windows
& "$env:USERPROFILE/vcpkg/vcpkg.exe" install boost-unordered:x64-windows
& "$env:USERPROFILE/vcpkg/vcpkg.exe" install boost-regex:x64-windows
git init $vcpkgRoot
git -C $vcpkgRoot fetch --depth 1 https://github.com/microsoft/vcpkg.git $vcpkgRevision
git -C $vcpkgRoot checkout --detach FETCH_HEAD
& "$vcpkgRoot/bootstrap-vcpkg.bat" -disableMetrics

# vcpkg validates each binary's ABI before reusing it from the restored cache.
$packages = @(
'capnproto:x64-windows'
'tbb:x64-windows'
'boost-intrusive:x64-windows'
'boost-dynamic-bitset:x64-windows'
'boost-multiprecision:x64-windows'
'boost-unordered:x64-windows'
'boost-regex:x64-windows'
)
& "$vcpkgRoot/vcpkg.exe" install @packages

# Export for CMake
Add-Content $env:GITHUB_ENV "CMAKE_TOOLCHAIN_FILE=$env:USERPROFILE/vcpkg/scripts/buildsystems/vcpkg.cmake"
Expand Down
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ classifiers = [
"Topic :: Scientific/Engineering :: Electronic Design Automation (EDA)"
]

[project.optional-dependencies]
schematic = ["naja-schematic>=0.1.1"]

[tool.scikit-build.cmake.define]
CMAKE_BUILD_TYPE="Release"
BUILD_NAJA_PYTHON="ON"
Expand Down
2 changes: 1 addition & 1 deletion src/core/NajaVersion.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ inline std::string getVersionPart(const std::string& version, int index) {

} // namespace detail

const std::string NAJA_VERSION { "0.7.25" };
const std::string NAJA_VERSION { "0.7.26" };
const std::string NAJA_MAJOR { detail::getVersionPart(NAJA_VERSION, 0) };
const std::string NAJA_MINOR { detail::getVersionPart(NAJA_VERSION, 1) };
const std::string NAJA_PATCH { detail::getVersionPart(NAJA_VERSION, 2) };
Expand Down
4 changes: 4 additions & 0 deletions src/najaeda/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ Installation

pip install najaeda

For the optional `schematic viewer <https://github.com/najaeda/naja-schematic>`_,
run ``pip install "najaeda[schematic]"``. In a notebook, use
``from najaeda.schematic import show; show()`` to display the currently loaded design.

Requires Python 3.10 or later. Pre-built wheels are published for:

* Linux x86_64 and AArch64 (``manylinux_2_28``; glibc 2.28 or later)
Expand Down
12 changes: 9 additions & 3 deletions src/najaeda/najaeda/docs/.readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,14 @@ build:
python: "3.12"
jobs:
post_install:
# Build this revision, including the extension used by autodoc.
- python -m pip install . --config-settings=cmake.define.PREGENERATED_PARSER_SOURCES=OFF --config-settings=build.tool-args=-j2
# Autodoc needs this revision's extension, but not optimized machine code.
# Avoid spending the documentation build time limit optimizing the frontends.
- >-
python -m pip install . --verbose
--config-settings=cmake.define.PREGENERATED_PARSER_SOURCES=OFF
--config-settings=cmake.define.CMAKE_CXX_FLAGS_RELEASE="-O0 -DNDEBUG"
--config-settings=cmake.define.CMAKE_C_FLAGS_RELEASE="-O0 -DNDEBUG"
--config-settings=build.tool-args=-j2

submodules:
include: all
Expand All @@ -41,4 +47,4 @@ sphinx:
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
python:
install:
- requirements: src/najaeda/najaeda/docs/requirements.txt
- requirements: src/najaeda/najaeda/docs/requirements.txt
35 changes: 35 additions & 0 deletions src/najaeda/najaeda/docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
import re
import sys

from docutils import nodes
from sphinx.errors import ExtensionError

# Prefer the installed package (including its compiled extension). Fall back
# to the source package for local builds with the extension on PYTHONPATH.
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '../../..')))
Expand Down Expand Up @@ -52,6 +55,38 @@ def read_naja_release():
) from error
sys.modules.setdefault("najaeda.naja", raw_naja)


def check_raw_api_links(app, doctree, docname):
"""Reject dangling raw API links, including targets removed by ``only``."""
if docname != 'raw_api':
return
target_ids = {
target_id
for node in doctree.findall(nodes.Element)
for target_id in node.get('ids', [])
}
missing = {
node['refid']
for node in doctree.findall(nodes.reference)
if node.get('refid', '').startswith('najaeda.naja.')
and node['refid'] not in target_ids
}
if missing:
raise ExtensionError(
'Raw API reference targets are missing: ' + ', '.join(sorted(missing))
)


def check_raw_api_reference(app, env, node, contnode):
target = node.get('reftarget', '')
if target.startswith('najaeda.naja.'):
raise ExtensionError(f'Unresolved raw API reference: {target}')


def setup(app):
app.connect('doctree-resolved', check_raw_api_links)
app.connect('missing-reference', check_raw_api_reference)

templates_path = ['_templates']
exclude_patterns = []

Expand Down
4 changes: 4 additions & 0 deletions src/najaeda/najaeda/docs/source/introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ Installation

pip install najaeda

For the optional `schematic viewer <https://github.com/najaeda/naja-schematic>`_,
run ``pip install "najaeda[schematic]"``. In a notebook, use
``from najaeda.schematic import show; show()`` to display the currently loaded design.

Requires Python 3.10 or later. Pre-built wheels are published for:

* Linux x86_64 and AArch64 (``manylinux_2_28``; glibc 2.28 or later)
Expand Down
11 changes: 11 additions & 0 deletions src/najaeda/najaeda/docs/source/loading.rst
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,17 @@ at ``neorv32_top.vhd:30`` in the development checkout. Vector generics, runtime
vector helpers, and further elaboration constructs remain unsupported; the
complete top has not been validated.

Dynamic array reads lower to ``naja_table_select`` for constant arrays,
constant-driven ROM signals, and general signal or variable arrays. Identical
lookups within a design share the primitive. Nonnegative ascending and descending
bounds are supported, including nonzero lower bounds. Indices can use
``conv_integer`` with the Synopsys packages or ``to_integer(unsigned(...))``
with ``numeric_std`` (up to 31 input bits). Address bits are preserved so
out-of-range or unknown addresses produce X in exported Verilog rather than
wrapping to a valid entry. Dynamic negative bounds and signed ``to_integer``
remain unsupported. Inferred writable memories retain their existing memory
primitive lowering.

The RTL path supports ``numeric_std.unsigned`` and ``numeric_std.signed`` addition, subtraction,
multiplication, equality/inequality and concatenation. Static
``to_unsigned(value, size)`` calls and conversions between ``unsigned``, ``signed``,
Expand Down
14 changes: 13 additions & 1 deletion src/najaeda/najaeda/docs/source/raw_api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ semantic source of truth.
* - Object
- Main public methods and values
* - :class:`najaeda.naja.SNLParameter`
- ``create_decimal``, ``create_binary``, ``create_boolean``, ``create_string`` (optional default value), ``hasDefaultValue``, ``getValue``, ``getName``, ``getDesign``, ``destroy``
- :meth:`create_decimal <najaeda.naja.SNLParameter.create_decimal>`, :meth:`create_binary <najaeda.naja.SNLParameter.create_binary>`, :meth:`create_boolean <najaeda.naja.SNLParameter.create_boolean>`, :meth:`create_string <najaeda.naja.SNLParameter.create_string>` (optional default value), :meth:`hasDefaultValue <najaeda.naja.SNLParameter.hasDefaultValue>`, :meth:`getValue <najaeda.naja.SNLParameter.getValue>`, :meth:`getName <najaeda.naja.SNLParameter.getName>`, :meth:`getDesign <najaeda.naja.SNLParameter.getDesign>`, :meth:`destroy <najaeda.naja.SNLParameter.destroy>`
* - :class:`najaeda.naja.NLUniverse`
- :meth:`create <najaeda.naja.NLUniverse.create>`, :meth:`destroy <najaeda.naja.NLUniverse.destroy>`, :meth:`get <najaeda.naja.NLUniverse.get>`, :meth:`getDB <najaeda.naja.NLUniverse.getDB>`, :meth:`getTopDB <najaeda.naja.NLUniverse.getTopDB>`, :meth:`setTopDB <najaeda.naja.NLUniverse.setTopDB>`, :meth:`getTopDesign <najaeda.naja.NLUniverse.getTopDesign>`, :meth:`setTopDesign <najaeda.naja.NLUniverse.setTopDesign>`, :meth:`getUserDBs <najaeda.naja.NLUniverse.getUserDBs>`, :meth:`getSNLDesign <najaeda.naja.NLUniverse.getSNLDesign>`, :meth:`getObject <najaeda.naja.NLUniverse.getObject>`, :meth:`applyDLE <najaeda.naja.NLUniverse.applyDLE>`, :meth:`applyConstantPropagation <najaeda.naja.NLUniverse.applyConstantPropagation>`, :meth:`getMaxFanout <najaeda.naja.NLUniverse.getMaxFanout>`, :meth:`getMaxLogicLevel <najaeda.naja.NLUniverse.getMaxLogicLevel>`
* - :class:`najaeda.naja.NLDB`
Expand Down Expand Up @@ -759,3 +759,15 @@ values with the reader build; regenerate snapshots after changing builds.
.. autofunction:: najaeda.naja.intent_parameters_of
.. autofunction:: najaeda.naja.intent_type_of
.. autofunction:: najaeda.naja.intent_package_member

Memory reset roles
------------------

For DB0 ``naja_mem__*`` primitives and other designs with a memory interface,
``SNLBitTerm.getRole()`` reports ``SNLTermRole.SyncReset`` for synchronous
resets and ``SNLTermRole.AsyncReset`` for asynchronous resets. Both satisfy
``is_reset()``; synchronous resets also satisfy ``is_sync_reset()``.
``getResetActiveLevel()`` returns ``SNLActiveLevel.Low`` for either active-low
reset mode and ``SNLActiveLevel.High`` for either active-high mode. With no
reset enabled, the reset pin has role ``Other`` and active level ``NA``.
The same queries on ``SNLInstTerm`` follow the model's bit term.
Empty file.
Loading
Loading