nifpga-fast-fifo-recv
An unofficial Python module for fast reading of data from NI FPGA FIFOs with a separate thread.
This module provides in Python a class and the methods to start a separate thread which acquire continously data and store them into a queue which can be read asynchronously. This allows to receive data from FPGA in Python ideally without loosing data even for fast data-rate.
The module is developed in Rust by using maturin, pyo3 and the Rust library nifpga-dll, an unofficial Rust bindings to NiFpga.dll library.
As described in the example below, nifpga-fast-fifo-recv does not require the nifpga Python module but in typical applications is strongly recommended to use with it.
Disclaimer: The nifpga-fast-fifo-recv Python module is NOT an official NI library! This library is an independent and autonomous development, unaffiliated with NI.
Usage
Installation
pip install nifpga-fast-fifo-recv
Example
from nifpga_fast_fifo_recv import NifpgaFastFifoRecv
fifo = NifpgaFastFifoRecv(bitfile = "myfile.lvbitx",
signature = bitfile_signature,
ni_address = "RIO0",
run = False,
close_on_reset = True,
fifo = fifo_number,
dma_buffer_size = 500000,
fifo_reading_buffer = 10000,
min_packet = 2,
)
fifo.thread_start()
assert(fifo.thread_status()==True)
for i in range(0,100):
data=fifo.get_data()
print(data)
do_something_complicate(data)
fifo.thread_stop()
assert(fifo.thread_status()==False)
Please note that in the example above run = False that means that the FPGA suppose to be already programmed
with the identical bitfile and in a run state. This can be done by external program or a high-level LabView code,
or the python script before or in a separate thread/process. For example, it is possible to make a script load,
configure some register and run the bitfile by the standard nifpga library.
Once it is running it is possible at the same time use into another thread or process the
NifpgaFastFifoRecv, do the thread_start() and get_data().
If you do not need to control registers or other things you can directly run the bitfile from NifpgaFastFifoRecv
simply by set run = True.
How to get the signature and the fifo_number (from FIFO name)
The nifpga_fast_fifo_recv in can work alone but in real application is used with nifpga.
The bit file .lvbitx is actually an XML file. There is possible to find its signature and the correspondence between
FIFO-number and FIFO name given at LabView compilation time.
Note typically if you have a single fifo in the bitfile, fifo=0.
The nifpga library can ease to extract the signature and the fifo number from the bitfile.
import nifpga
bitfile_reader = nifpga.Bitfile(bitfile)
bitfile_signature = bitfile_reader.signature
bitfile_fifo_number = {i: n for n, i in enumerate(self.bitfile_reader.fifos.keys())}
fifo_number = bitfile_fifo_number["MYFIFO"]
Object structure
The module structure is the following:
class NifpgaFastFifoRecv(object)
|
| NifpgaFastFifoRecv(bitfile='X', signature='ABCD12345678', ni_address='RI0', run=False, close_on_reset=False, fifo=0, dma_buffer_size=50000, fifo_reading_buffer=10000, min_packet=1)
|
| Methods defined here:
|
| get_conf(self, /)
| get the current configuration
|
| get_data(self, /)
| get data from the internal queue
|
| thread_is_running(self, /)
| thread_is_running return true is thread is running
|
| thread_start(self, /)
| thread_start run the thread
|
| thread_stop(self, /)
| thread_stop stop the thread
Developer
In order to compile this project you need maturin
pip install maturin
and you need also the NiFpga.dll installed in your system.
Build and publish Windows wheels locally
GitHub Actions cannot build this project because the proprietary NI libraries are required. On a Windows machine with the NI FPGA runtime, Rust, MSYS2 UCRT64, and the desired CPython versions installed, run:
powershell -NoProfile -ExecutionPolicy Bypass -File .\scripts\release.ps1
The script adds C:\msys64\ucrt64\bin to PATH, discovers every CPython 3.10+
registered with the Windows py launcher, builds a release wheel for each one,
checks the wheel metadata, and tests each wheel in a clean virtual environment.
When an explicitly requested version is not installed system-wide, the script
downloads an isolated, uv-managed CPython into .release-python. This directory
is ignored by Git and can be deleted after the release. At least one system
Python 3.10+ installation is needed to bootstrap the release tools. Use
-PythonInstallDir to select a different temporary location.
The same workflow is available through the batch wrapper:
build-wheels.bat
To require a specific complete set of interpreters (and fail if one is missing), use for example:
powershell -NoProfile -ExecutionPolicy Bypass -File .\scripts\release.ps1 -PythonVersion 3.10,3.11,3.12,3.13,3.14
Wheels are written to dist. Upload is intentionally separate from the default
build. Configure a PyPI API token in $env:TWINE_PASSWORD and use __token__ as
the username:
$env:TWINE_USERNAME = "__token__"
$env:TWINE_PASSWORD = "pypi-your-token"
powershell -NoProfile -ExecutionPolicy Bypass -File .\scripts\release.ps1 -PythonVersion 3.10,3.11,3.12,3.13,3.14 -Publish
Use -Repository testpypi -Publish for a TestPyPI trial. Existing files in
dist are included in validation and upload, so use a fresh output directory
for each release (for example, -OutDir dist-0.101.11).
The publishing batch wrapper automatically supplies -Publish and forwards any
additional options:
publish-wheels.bat -PythonVersion 3.10,3.11,3.12,3.13,3.14
publish-wheels.bat -Repository testpypi -PythonVersion 3.13
License
Copyright (c) 2023 Istituto Italiano di Tecnologia
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Metadata
Release files for nifpga-fast-fifo-recv 0.102.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| nifpga_fast_fifo_recv-0.102.0.tar.gz | 14.0 kB | Without provenance | Details for nifpga_fast_fifo_recv-0.102.0.tar.gz |
Built distributions (wheels)
| File | Actions Reset | |||
|---|---|---|---|---|
| nifpga_fast_fifo_recv-0.102.0-cp314-cp314-win_amd64.whl | CPython 3.14 | CPython 3.14 | Windows x86-64 | Details for nifpga_fast_fifo_recv-0.102.0-cp314-cp314-win_amd64.whl |
| nifpga_fast_fifo_recv-0.102.0-cp313-cp313-win_amd64.whl | CPython 3.13 | CPython 3.13 | Windows x86-64 | Details for nifpga_fast_fifo_recv-0.102.0-cp313-cp313-win_amd64.whl |
| nifpga_fast_fifo_recv-0.102.0-cp312-cp312-win_amd64.whl | CPython 3.12 | CPython 3.12 | Windows x86-64 | Details for nifpga_fast_fifo_recv-0.102.0-cp312-cp312-win_amd64.whl |
| nifpga_fast_fifo_recv-0.102.0-cp311-cp311-win_amd64.whl | CPython 3.11 | CPython 3.11 | Windows x86-64 | Details for nifpga_fast_fifo_recv-0.102.0-cp311-cp311-win_amd64.whl |
| nifpga_fast_fifo_recv-0.102.0-cp310-cp310-win_amd64.whl | CPython 3.10 | CPython 3.10 | Windows x86-64 | Details for nifpga_fast_fifo_recv-0.102.0-cp310-cp310-win_amd64.whl |
Total release size: 3.8 MB
Release files / nifpga_fast_fifo_recv-0.102.0.tar.gz
| Download URL | nifpga_fast_fifo_recv-0.102.0.tar.gz |
|---|---|
| Size | 14.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2726e9368b76b007a43b54f0cad1106dc025dc0a272738869314e0bee4b0878b
|
|
BLAKE2b-256 checksum How to use checksums |
72f1ac286c024ce39809eaef4cb0338c8d12fb72ace3d3ef2a7cda55333de8ae
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.0
|
Release files / nifpga_fast_fifo_recv-0.102.0-cp314-cp314-win_amd64.whl
| Download URL | nifpga_fast_fifo_recv-0.102.0-cp314-cp314-win_amd64.whl |
|---|---|
| Size | 756.1 kB |
| Tags | CPython 3.14 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
2061917ecb6518e0e22984e3a2b83d963f6d997cdc7cfe947949366de4e38d25
|
|
BLAKE2b-256 checksum How to use checksums |
7156c2ad4003368c0daaddf232d23d0ba5577aa3b25cf40791e55d43dd7f8c31
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.0
|
Release files / nifpga_fast_fifo_recv-0.102.0-cp313-cp313-win_amd64.whl
| Download URL | nifpga_fast_fifo_recv-0.102.0-cp313-cp313-win_amd64.whl |
|---|---|
| Size | 753.9 kB |
| Tags | CPython 3.13 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
e43005be01ed59ccab8da9d5fdec7cb1a7ca9afd216b67f6cc4f08fff0b32f30
|
|
BLAKE2b-256 checksum How to use checksums |
64d8289947531c6c31eaff2cfdbc53330e4b9dfbc3d7b019597352bed86b8035
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.0
|
Release files / nifpga_fast_fifo_recv-0.102.0-cp312-cp312-win_amd64.whl
| Download URL | nifpga_fast_fifo_recv-0.102.0-cp312-cp312-win_amd64.whl |
|---|---|
| Size | 755.1 kB |
| Tags | CPython 3.12 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
84346a9dd5d9d1767c6e86d6dabcd097138a6fc9d481b1c2f20352fc39f841a2
|
|
BLAKE2b-256 checksum How to use checksums |
985cea2c27d403ee4c2f8e95d45bc470a977b82af46dc24d631dc54741ca76b6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.0
|
Release files / nifpga_fast_fifo_recv-0.102.0-cp311-cp311-win_amd64.whl
| Download URL | nifpga_fast_fifo_recv-0.102.0-cp311-cp311-win_amd64.whl |
|---|---|
| Size | 756.8 kB |
| Tags | CPython 3.11 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
4f6b63136ebc7fdd76f343c0044834c460282db1f6b9208845b9e61b95582d74
|
|
BLAKE2b-256 checksum How to use checksums |
6e1ae6387b6d45cc434cc24b29d0091d990b011bd7afbd60c5bdfd3891a6fc69
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.0
|
Release files / nifpga_fast_fifo_recv-0.102.0-cp310-cp310-win_amd64.whl
| Download URL | nifpga_fast_fifo_recv-0.102.0-cp310-cp310-win_amd64.whl |
|---|---|
| Size | 756.5 kB |
| Tags | CPython 3.10 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
1b9a482ea9e0d0caf67aa3d36e660ad50b710145f3d2bcc852036942d7ee1272
|
|
BLAKE2b-256 checksum How to use checksums |
5e610f6f2b9202fb9f2d6a7c4f635d792a26c09a06c08b9352e7953625c7914a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.0
|
Security for nifpga-fast-fifo-recv 0.102.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.