wavekit 0.5.4__tar.gz → 0.5.6__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. {wavekit-0.5.4 → wavekit-0.5.6}/PKG-INFO +6 -3
  2. {wavekit-0.5.4 → wavekit-0.5.6}/README.md +5 -2
  3. wavekit-0.5.6/build.py +38 -0
  4. {wavekit-0.5.4 → wavekit-0.5.6}/pyproject.toml +1 -1
  5. {wavekit-0.5.4 → wavekit-0.5.6}/src/wavekit/__init__.py +23 -24
  6. wavekit-0.5.6/src/wavekit/readers/fsdb/npi_fsdb.pxd +82 -0
  7. wavekit-0.5.6/src/wavekit/readers/fsdb/npi_fsdb_reader.pyx +727 -0
  8. {wavekit-0.5.4 → wavekit-0.5.6}/src/wavekit/readers/fsdb/reader.py +44 -17
  9. {wavekit-0.5.4 → wavekit-0.5.6}/src/wavekit/waveform.py +19 -6
  10. wavekit-0.5.4/build.py +0 -52
  11. wavekit-0.5.4/src/wavekit/readers/fsdb/npi_fsdb.pxd +0 -122
  12. wavekit-0.5.4/src/wavekit/readers/fsdb/npi_fsdb_reader.pyx +0 -328
  13. {wavekit-0.5.4 → wavekit-0.5.6}/LICENSE +0 -0
  14. {wavekit-0.5.4 → wavekit-0.5.6}/src/wavekit/pattern/__init__.py +0 -0
  15. {wavekit-0.5.4 → wavekit-0.5.6}/src/wavekit/pattern/dsl.py +0 -0
  16. {wavekit-0.5.4 → wavekit-0.5.6}/src/wavekit/pattern/engine.py +0 -0
  17. {wavekit-0.5.4 → wavekit-0.5.6}/src/wavekit/pattern/instance.py +0 -0
  18. {wavekit-0.5.4 → wavekit-0.5.6}/src/wavekit/pattern/result.py +0 -0
  19. {wavekit-0.5.4 → wavekit-0.5.6}/src/wavekit/pattern/steps.py +0 -0
  20. {wavekit-0.5.4 → wavekit-0.5.6}/src/wavekit/readers/base.py +0 -0
  21. {wavekit-0.5.4 → wavekit-0.5.6}/src/wavekit/readers/expr_parser.py +0 -0
  22. {wavekit-0.5.4 → wavekit-0.5.6}/src/wavekit/readers/pattern_parser.py +0 -0
  23. {wavekit-0.5.4 → wavekit-0.5.6}/src/wavekit/readers/value_change.pyx +0 -0
  24. {wavekit-0.5.4 → wavekit-0.5.6}/src/wavekit/readers/vcd/reader.py +0 -0
  25. {wavekit-0.5.4 → wavekit-0.5.6}/src/wavekit/scope.py +0 -0
  26. {wavekit-0.5.4 → wavekit-0.5.6}/src/wavekit/signal.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: wavekit
3
- Version: 0.5.4
3
+ Version: 0.5.6
4
4
  Summary: a fundamental package for digital circuit waveform analysis
5
5
  License-File: LICENSE
6
6
  Author: cxzzzz
@@ -40,7 +40,10 @@ Description-Content-Type: text/markdown
40
40
  pip install wavekit
41
41
  ```
42
42
 
43
- **Note**: To read FSDB files, ensure the `VERDI_HOME` environment variable is set before installation.
43
+ **Note**: To read FSDB files, the Verdi runtime library (`libNPI.so`) must be available at runtime. Configure via:
44
+ - `WAVEKIT_NPI_LIB` — direct path to `libNPI.so`
45
+ - `VERDI_HOME` — Verdi installation directory (searches `$VERDI_HOME/share/NPI/lib/...`)
46
+ - `LD_LIBRARY_PATH` — system library search path
44
47
 
45
48
  ## 🚀 Quick Start
46
49
 
@@ -195,7 +198,7 @@ print(f"Stall durations: {stalls.duration.value} cycles")
195
198
 
196
199
  | Method | Description |
197
200
  |--------|-------------|
198
- | `VcdReader(file)` / `FsdbReader(file)` | Open a waveform file. Use as a context manager. `FsdbReader` requires `VERDI_HOME`. |
201
+ | `VcdReader(file)` / `FsdbReader(file)` | Open a waveform file. Use as a context manager. `FsdbReader` requires Verdi runtime (`WAVEKIT_NPI_LIB`, `VERDI_HOME`, or `LD_LIBRARY_PATH`). |
199
202
  | `reader.load_waveform(signal, clock, ...)` | Load one signal sampled on every clock edge. Returns `Waveform`. |
200
203
  | `reader.load_matched_waveforms(pattern, clock_pattern, ...)` | Batch-load signals matching a brace/regex pattern. Returns `dict[tuple, Waveform]`. |
201
204
  | `reader.eval(expr, clock, mode='single'\|'zip', ...)` | Evaluate an arithmetic expression with embedded signal paths. |
@@ -19,7 +19,10 @@
19
19
  pip install wavekit
20
20
  ```
21
21
 
22
- **Note**: To read FSDB files, ensure the `VERDI_HOME` environment variable is set before installation.
22
+ **Note**: To read FSDB files, the Verdi runtime library (`libNPI.so`) must be available at runtime. Configure via:
23
+ - `WAVEKIT_NPI_LIB` — direct path to `libNPI.so`
24
+ - `VERDI_HOME` — Verdi installation directory (searches `$VERDI_HOME/share/NPI/lib/...`)
25
+ - `LD_LIBRARY_PATH` — system library search path
23
26
 
24
27
  ## 🚀 Quick Start
25
28
 
@@ -174,7 +177,7 @@ print(f"Stall durations: {stalls.duration.value} cycles")
174
177
 
175
178
  | Method | Description |
176
179
  |--------|-------------|
177
- | `VcdReader(file)` / `FsdbReader(file)` | Open a waveform file. Use as a context manager. `FsdbReader` requires `VERDI_HOME`. |
180
+ | `VcdReader(file)` / `FsdbReader(file)` | Open a waveform file. Use as a context manager. `FsdbReader` requires Verdi runtime (`WAVEKIT_NPI_LIB`, `VERDI_HOME`, or `LD_LIBRARY_PATH`). |
178
181
  | `reader.load_waveform(signal, clock, ...)` | Load one signal sampled on every clock edge. Returns `Waveform`. |
179
182
  | `reader.load_matched_waveforms(pattern, clock_pattern, ...)` | Batch-load signals matching a brace/regex pattern. Returns `dict[tuple, Waveform]`. |
180
183
  | `reader.eval(expr, clock, mode='single'\|'zip', ...)` | Evaluate an arithmetic expression with embedded signal paths. |
wavekit-0.5.6/build.py ADDED
@@ -0,0 +1,38 @@
1
+ import numpy as np
2
+ from Cython.Build import cythonize
3
+ from setuptools import Extension, setup
4
+
5
+ extensions = [
6
+ Extension(
7
+ 'src.wavekit.readers.value_change',
8
+ sources=['src/wavekit/readers/value_change.pyx'],
9
+ include_dirs=[np.get_include()],
10
+ extra_compile_args=['-fpic', '-O3', '-march=native'],
11
+ extra_link_args=['-O3', '-march=native'],
12
+ language='c++',
13
+ ),
14
+ Extension(
15
+ 'src.wavekit.readers.fsdb.npi_fsdb_reader',
16
+ sources=['src/wavekit/readers/fsdb/npi_fsdb_reader.pyx'],
17
+ include_dirs=[np.get_include()],
18
+ libraries=['dl'],
19
+ extra_compile_args=['-fpic', '-O3', '-march=native'],
20
+ extra_link_args=['-O3', '-march=native'],
21
+ language='c++',
22
+ ),
23
+ ]
24
+
25
+ setup(
26
+ ext_modules=cythonize(
27
+ extensions,
28
+ compiler_directives={
29
+ 'language_level': 3,
30
+ 'embedsignature': True,
31
+ 'boundscheck': False,
32
+ 'wraparound': False,
33
+ 'cdivision': True,
34
+ 'nonecheck': False,
35
+ },
36
+ ),
37
+ script_args=['build_ext', '--inplace'],
38
+ )
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "wavekit"
3
- version = "0.5.4"
3
+ version = "0.5.6"
4
4
  description = "a fundamental package for digital circuit waveform analysis"
5
5
  authors = ["cxzzzz <cxz19961010@outlook.com>"]
6
6
  readme = "README.md"
@@ -37,32 +37,31 @@ __all__ = [
37
37
  'has_fsdb_support',
38
38
  ]
39
39
 
40
- # Detect if FSDB support is available (compiled with VERDI_HOME)
41
- import importlib.util
42
-
43
- _fsdb_available = (
44
- importlib.util.find_spec('.readers.fsdb.npi_fsdb_reader', package=__name__) is not None
45
- )
46
-
47
-
48
- def has_fsdb_support() -> bool:
49
- """Check if FsdbReader is available in the current installation."""
50
- return _fsdb_available
51
-
40
+ try:
41
+ from .readers.fsdb.npi_fsdb_reader import fsdb_runtime_available as _fsdb_runtime_available
42
+ from .readers.fsdb.reader import FsdbReader as FsdbReader
43
+ except Exception as _fsdb_import_error:
44
+ _fsdb_available = False
52
45
 
53
- class _FsdbReaderStub:
54
- """Placeholder that raises an error when FsdbReader is used without Verdi support."""
46
+ def has_fsdb_support() -> bool:
47
+ """Check whether the Verdi FSDB runtime is available."""
48
+ return False
55
49
 
56
- def __init__(self, *args, **kwargs):
57
- raise RuntimeError(
58
- 'FsdbReader requires Verdi to be installed and configured.\n\n'
59
- '1. Set VERDI_HOME environment variable to your Verdi installation path.\n'
60
- '2. Reinstall wavekit:\n'
61
- ' pip install --force-reinstall --no-cache-dir --no-deps wavekit'
62
- )
50
+ class _FsdbReaderStub:
51
+ """Placeholder that raises an error when the Verdi FSDB runtime is unavailable."""
63
52
 
53
+ def __init__(self, *args, **kwargs):
54
+ raise RuntimeError(
55
+ 'FsdbReader requires the Verdi FSDB runtime (libNPI.so).\n\n'
56
+ 'Set WAVEKIT_NPI_LIB to the library path, set VERDI_HOME to the Verdi '
57
+ 'installation directory, or ensure libNPI.so is in LD_LIBRARY_PATH.\n\n'
58
+ f'Import error: {_fsdb_import_error}' # noqa: F821
59
+ )
64
60
 
65
- if _fsdb_available:
66
- from .readers.fsdb.reader import FsdbReader as FsdbReader
67
- else:
68
61
  FsdbReader = _FsdbReaderStub # type: ignore[assignment]
62
+ else:
63
+ _fsdb_available = True
64
+
65
+ def has_fsdb_support() -> bool:
66
+ """Check whether the Verdi FSDB runtime is available right now."""
67
+ return _fsdb_runtime_available()
@@ -0,0 +1,82 @@
1
+ ctypedef unsigned long long NPI_UINT64
2
+ ctypedef long long NPI_INT64
3
+ ctypedef int NPI_INT32
4
+ ctypedef unsigned int NPI_UINT32
5
+ ctypedef short NPI_INT16
6
+ ctypedef unsigned short NPI_UINT16
7
+ ctypedef char NPI_BYTE8
8
+ ctypedef unsigned char NPI_UBYTE8
9
+
10
+ ctypedef void* npiFsdbFileHandle
11
+ ctypedef void* npiFsdbScopeHandle
12
+ ctypedef void* npiFsdbSigHandle
13
+ ctypedef void* npiFsdbSigdbHandle
14
+ ctypedef void* npiFsdbVctHandle
15
+ ctypedef void* npiFsdbFtHandle
16
+
17
+ ctypedef void* npiFsdbScopeIter
18
+ ctypedef void* npiFsdbSigIter
19
+ ctypedef void* npiFsdbEnumIter
20
+ ctypedef NPI_UINT64 npiFsdbTime
21
+
22
+ ctypedef enum npiFsdbValType:
23
+ npiFsdbBinStrVal
24
+ npiFsdbOctStrVal
25
+ npiFsdbDecStrVal
26
+ npiFsdbHexStrVal
27
+ npiFsdbSintVal
28
+ npiFsdbUintVal
29
+ npiFsdbRealVal
30
+ npiFsdbStringVal
31
+ npiFsdbEnumStrVal
32
+ npiFsdbSint64Val
33
+ npiFsdbUint64Val
34
+ npiFsdbObjTypeVal
35
+
36
+ ctypedef struct npiFsdbValueValue:
37
+ char* str
38
+ int sint
39
+ unsigned int uint
40
+ long long sint64
41
+ unsigned long long uint64
42
+ double real
43
+
44
+ ctypedef struct npiFsdbValue:
45
+ npiFsdbValType format
46
+ npiFsdbValueValue value
47
+
48
+ ctypedef enum npiFsdbSigPropertyType:
49
+ npiFsdbSigName
50
+ npiFsdbSigFullName
51
+ npiFsdbSigIsReal
52
+ npiFsdbSigHasMember
53
+ npiFsdbSigLeftRange
54
+ npiFsdbSigRightRange
55
+ npiFsdbSigRangeSize
56
+ npiFsdbSigIsString
57
+ npiFsdbSigDirection
58
+ npiFsdbSigAssertionType
59
+ npiFsdbSigCompositeType
60
+ npiFsdbSigIsPacked
61
+ npiFsdbSigHasReasonCode
62
+ npiFsdbSigReasonCode
63
+ npiFsdbSigReasonCodeDesc
64
+ npiFsdbSigIsParam
65
+ npiFsdbSigHasEnum
66
+ npiFsdbSigPowerType
67
+ npiFsdbSigHasForceTag
68
+ npiFsdbSigSpType
69
+ npiFsdbSigEnumId
70
+
71
+ ctypedef enum npiFsdbScopePropertyType:
72
+ npiFsdbScopeName
73
+ npiFsdbScopeFullName
74
+ npiFsdbScopeDefName
75
+ npiFsdbScopeType
76
+
77
+ ctypedef enum npiFsdbSigCompositeType_e:
78
+ npiFsdbSigCtArray
79
+ npiFsdbSigCtStruct
80
+ npiFsdbSigCtUnion
81
+ npiFsdbSigCtTaggedUnion
82
+ npiFsdbSigCtRecord