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

To install with LaTeX support:

pip install sphinxcontrib-bitfield[LaTeX]

Enable Extension

Add sphinxcontrib.bitfield in extensions of conf.py:

extensions = ['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

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-1.0.0.tar.gz (3.4 kB view hashes)

Uploaded Source

Built Distribution

sphinxcontrib_bitfield-1.0.0-py3-none-any.whl (4.0 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