Skip to main content

Sphinx "bitfield" extension

Project description

A Sphinx extension to generate bit field diagrams with the bit_field Python package.

Installation

pip install sphinxcontrib-bitfield

Enable Extension

Add sphinxcontrib.bitfield in extensions of conf.py:

extensions = ['sphinxcontrib.bitfield']

To enable output with LaTeX support, add an image converter from SVG to PNG:

extensions = ['sphinx.ext.imgconverter', 'sphinxcontrib.bitfield']

Usage

Use directive bitfield with the description of the bitfield in JSON format:

.. bitfield::
    :bits: 32
    :lanes: 2

        [
            { "name": "IPO",   "bits": 8, "attr": "RO" },
            {                  "bits": 7 },
            { "name": "BRK",   "bits": 5, "attr": "RW", "type": 4 },
            { "name": "CPK",   "bits": 1 },
            { "name": "Clear", "bits": 3 },
            { "bits": 8 }
        ]
https://raw.githubusercontent.com/Arth-ur/bitfield/master/bit_field/test/alpha.svg?sanitize=true
The bitfield directive accepts the following options:
vspace:

vertical space - default 80

hspace:

horizontal space - default 640

lanes:

rectangle lanes - default 2

bits:

overall bitwidth - default 32

fontfamily:

default sans-serif

fontweight:

default normal

fontsize:

default 14

strokewidth:

default 1

compact:

compact rendering mode

hflip:

horizontal flip

vflip:

vertical flip

uneven:

uneven lanes

trim:

trim long bitfield names, must provide the horizontal space available for a single character

legend:

space separated list of name and type optionally enclosed in quotes

caption:

String caption for the bitfield. If specified, the bitfield will be rendered as a figure

For more details, see the bit_field package.

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

sphinxcontrib_bitfield-2.0.0.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

sphinxcontrib_bitfield-2.0.0-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

Details for the file sphinxcontrib_bitfield-2.0.0.tar.gz.

File metadata

  • Download URL: sphinxcontrib_bitfield-2.0.0.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.8

File hashes

Hashes for sphinxcontrib_bitfield-2.0.0.tar.gz
Algorithm Hash digest
SHA256 425011aab8234182aad84877092c76599ba4aa04aab0ed530e3ae19655c594a6
MD5 366b11016b94fa0e99e0533c5555412a
BLAKE2b-256 67febaf861da52bd5b7374fda1e62d8b104098a636a3f2ff55466a62cadf940f

See more details on using hashes here.

File details

Details for the file sphinxcontrib_bitfield-2.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for sphinxcontrib_bitfield-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9189c375281ed4fbbcb9770d908275d0a5961382c1d1da1176b5b518e71a4db1
MD5 02982fba53247dd06c85d01b150a4a3f
BLAKE2b-256 9452bc44526f95d3a9b52f44f386da2d264c17dcc70c841b5ddc42567fe94b82

See more details on using hashes here.

Supported by

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