chore: PyPI metadata, Linux-only note, auto-close default trace at exit
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
f05d29e090
commit
6e79bf9ed0
3 files changed
+26
-5
No files matched your search
@@ -13,6 +13,7 @@ $ dlv build counter.v --clock clk -o out/
|
||||
|
||||
## Requirements
|
||||
|
||||
- Linux only (the extension is built with `g++`; macOS/Windows are not supported yet)
|
||||
- Python ≥ 3.10
|
||||
- `verilator` ≥ 5.022 in `PATH` (ports are read with `verilator --json-only`)
|
||||
- `g++` (C++17) in `PATH`
|
||||
@@ -85,9 +86,9 @@ The module name is the Verilog module name. `Model()` creates an independent sim
|
||||
| `cycle_ris(n=1)` / `cycle_fal(n=1)` | `n` more clock periods |
|
||||
| `get()` | `{output: int}` for all outputs |
|
||||
| `step(n, inputs={})` | `n` rising-edge clock periods in a C++ loop. `inputs` maps names to array-likes of length `n` (or length 1 = constant). Returns `{output: numpy array}` (uint8/16/32/64 by width), sampled after each period. |
|
||||
| `trace_open(path)` / `trace_close()` | Only with `--trace`: write an FST waveform. Call `trace_close()` to flush. |
|
||||
| `trace_open(path)` / `trace_close()` | Only with `--trace`: write an FST waveform. The default instance's trace is closed automatically at exit; call `trace_close()` on your own `Model()` instances. |
|
||||
|
||||
Ports up to 64 bits are Python `int`s. The clock cannot be set via `inputs`. Don't mix `_ris` and `_fal` calls on the same instance unless you accept an extra clock edge when switching.
|
||||
Ports up to 64 bits are Python `int`s. Values are always unsigned, also for `signed` ports (convert yourself, e.g. two's complement). The clock cannot be set via `inputs`. Don't mix `_ris` and `_fal` calls on the same instance unless you accept an extra clock edge when switching.
|
||||
|
||||
## Shell completion
|
||||
|
||||
|
||||
@@ -10,8 +10,24 @@ readme = "README.md"
|
||||
license = "MIT"
|
||||
license-files = ["LICENSE"]
|
||||
requires-python = ">=3.10"
|
||||
authors = [{ name = "Thomas Kirchner", email = "thomas.kirchner5@web.de" }]
|
||||
keywords = ["verilog", "verilator", "nanobind", "simulation", "hdl", "fpga"]
|
||||
classifiers = [
|
||||
"Development Status :: 3 - Alpha",
|
||||
"Intended Audience :: Developers",
|
||||
"Intended Audience :: Science/Research",
|
||||
"Operating System :: POSIX :: Linux",
|
||||
"Programming Language :: Python :: 3",
|
||||
"Programming Language :: C++",
|
||||
"Topic :: Scientific/Engineering :: Electronic Design Automation (EDA)",
|
||||
]
|
||||
dependencies = ["nanobind", "jinja2", "argcomplete", "rich", "numpy"]
|
||||
|
||||
[project.urls]
|
||||
Homepage = "https://github.com/pythagorasDesaster/dlv"
|
||||
Source = "https://git.cloud.servinpythagoras.online/thomas/dlv"
|
||||
Issues = "https://github.com/pythagorasDesaster/dlv/issues"
|
||||
|
||||
[project.scripts]
|
||||
dlv = "dlv.cli:main"
|
||||
|
||||
|
||||
@@ -151,9 +151,10 @@ struct Model {
|
||||
};
|
||||
|
||||
// Default instance behind the module-level functions, created on first use.
|
||||
Model* g_dflt = nullptr;
|
||||
Model& dflt() {
|
||||
static Model* m = new Model();
|
||||
return *m;
|
||||
if (!g_dflt) g_dflt = new Model();
|
||||
return *g_dflt;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
@@ -179,5 +180,8 @@ NB_MODULE({{ top }}, m) {
|
||||
m.def("get", [] { return dflt().get(); });
|
||||
m.def("step", [](size_t n, nb::dict d) { return dflt().step(n, d); }, "n"_a, "inputs"_a = nb::dict());{% if trace %}
|
||||
m.def("trace_open", [](const std::string& p) { dflt().trace_open(p); }, "path"_a);
|
||||
m.def("trace_close", [] { dflt().trace_close(); });{% endif %}
|
||||
m.def("trace_close", [] { dflt().trace_close(); });
|
||||
// Flush the default instance's FST at interpreter exit.
|
||||
m.def("_atexit", [] { if (g_dflt) g_dflt->trace_close(); });
|
||||
nb::module_::import_("atexit").attr("register")(m.attr("_atexit"));{% endif %}
|
||||
}
|
||||
Reference in new issue
Block a user