🍰 bit field diagram renderer
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
bin moved defaults into the library code Nov 7, 2017
lib module.exports -> exports Aug 12, 2018
test made alpha wider Jul 22, 2017
.eslintrc.js minor cleanup Jul 17, 2017
.gitignore dependency bump Jun 8, 2018
.npmignore bumped dependencies Jul 17, 2017
.travis.yml dependency bump Jun 8, 2018
LICENSE dependency bump Jun 8, 2018
README.md Update README.md Nov 28, 2017
appveyor.yml dependency bump Jun 8, 2018
package.json 0.6.1 Aug 12, 2018

README.md

NPM version Travis appVeyor

Install

npm i bit-field

Library usage

var render = require('bit-filed/lib/render');
var onml = require('onml');

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

var options = {
  hspace: 888
};

var jsonml = render(reg, options);
var html = onml.stringify(jsonml);
// <svg...>

CLI Usage

bin/bitfield.js [options] > alpha.svg

options

--input      : input JSON filename - must be specified always
--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

alpha.json

[
    { "name": "IPO",   "bits": 8, "attr": "RO" },
    {                  "bits": 7 },
    { "name": "BRK",   "bits": 5, "attr": "RW" },
    { "name": "CPK",   "bits": 1 },
    { "name": "Clear", "bits": 3 },
    {                  "bits": 8 }
]

alpha.svg

Heat Sink