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 details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

Details for the file bitslice-0.3.0.tar.gz.

File metadata

  • Download URL: bitslice-0.3.0.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.5 CPython/3.8.5 Linux/5.8.0-48-generic

File hashes

Hashes for bitslice-0.3.0.tar.gz
Algorithm Hash digest
SHA256 57918d8828a673561013dff32c5dacb7619b33b6db543007088141d964817bfb
MD5 9c4dd81ebaa46e40bcc4e7923126dab6
BLAKE2b-256 b3f12bfd48d1247f7fd19647d9a1af59e41f533cc02f69bc8a3f50bff644b991

See more details on using hashes here.

File details

Details for the file bitslice-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: bitslice-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.5 CPython/3.8.5 Linux/5.8.0-48-generic

File hashes

Hashes for bitslice-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 092a898746020be9b349110ec1507677bb0f489867020bffd9a858065e5b217a
MD5 e4d3584f3ab971fb5cf03ea6199a791e
BLAKE2b-256 c0f97ab9937e208c66ea185ca0e59826c845901851f09989ac6207236c47d504

See more details on using hashes here.

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