Skip to main content

A bitfield diagram renderer

Project description

A Python3 port of the javascript bit-field library by Aliaksei Chapyzhenka.

Install

pip install bit_field

Library usage

from bit_field import render, jsonml_stringify

reg = [
  {'bits': 8, 'name': 'data'}
]

jsonml = render(reg, hspace=888)
html = jsonml_stringify(jsonml)
# <svg...>

CLI Usage

python3 -m bit_field [options] input > alpha.svg

options

input        : input JSON filename - must be specified always
--input      : input JSON filename (kept for compatibility)
--vspace     : vertical space - default 80
--hspace     : horizontal space - default 640
--lanes      : rectangle lanes - default 2
--bits       : overall bitwidth - default 32
--bigendian  : - default false
--fontfamily : - default sans-serif
--fontweight : - default normal
--fontsize   : - default 14

--beautify   : use xml beautifier

alpha.json

[
    { "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 }
]

alpha.svg

Heat Sink

Licensing

This work is based on original work by Aliaksei Chapyzhenka under the MIT license (see LICENSE-ORIGINAL).

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

bit_field-0.2.0.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

bit_field-0.2.0-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file bit_field-0.2.0.tar.gz.

File metadata

  • Download URL: bit_field-0.2.0.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.4.2 requests/2.18.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.5.2

File hashes

Hashes for bit_field-0.2.0.tar.gz
Algorithm Hash digest
SHA256 f130cde447c7d5715850fe35fcf7deb30e9edca487412330a32958ee20bf0bfe
MD5 38f3477d9bd80dbbaf636c0631fb84aa
BLAKE2b-256 5cefb57c93dcd462e85a54f1006eb397e99a41bbf1853407a32d419d36c10bfb

See more details on using hashes here.

File details

Details for the file bit_field-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: bit_field-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 5.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.4.2 requests/2.18.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.5.2

File hashes

Hashes for bit_field-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5a6f706359b6b75e1c7754c7f72e77b7a7550d0534f307e80b0dcec65d685171
MD5 43b8bff70bb0de26a6d01de2bd6c791f
BLAKE2b-256 ec7293c29515fc0b689739406d2805c9cce8b77a862a954a8e2dfaefe727b90a

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