Skip to main content

Verilog-like bitvector slicing

Project description

Bitslice

Verilog-like bitslicing for Python.

Installation

Install the library from PyPI:

pip install bitslice

Quickstart

Bitslice is designed to behave as an integer value as much as possible. All operators defined on int should be supported.

Bitslice adds the ability to extract or set one or more bits of the value:

from bitslice import Bitslice
value = Bitslice(5, size=4)
value[3:1] - 1

Advanced features: slice aliasing

value = Bitslice(5, size=4)
value.add_alias('lower', start=0, end=1)
value.add_alias('upper', start=2, end=3)

value['lower'] == value[1:0]

See bitslice.py for more examples.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bitslice-0.3.0.tar.gz (4.4 kB view hashes)

Uploaded source

Built Distribution

bitslice-0.3.0-py3-none-any.whl (4.7 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page