Skip to main content

Verilog-like bitvector slicing

Project description


Verilog-like bitslicing for Python.


Install the library from PyPI:

pip install bitslice


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 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 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page