wavedrom / bitfield Goto Github PK
View Code? Open in Web Editor NEW:cake: bit field diagram renderer
License: MIT License
:cake: bit field diagram renderer
License: MIT License
Please describe your system environment before submitting your Issue.
Is there any way to put a character to the left of the register, similar to "R", "I", or "J" for types of instruction. For example:
{reg:
[
{bits: 26, name: 'address'},
{bits: 6, name: 'opcode'},
],
config:{bits: 32}
}
You could put a J to the left of the register to signify a Jump instruction from the MIPS ISA.
Memory maps are very useful for giving an overview of a computer system. One system may have multiple maps (such as a multi-core system, an 8051-like system, or a system with multiple buses).
Memory maps are similar to reg
objects turned on their side with non-uniform spacing. Other packages have abused reg
-like constructs to give satisfactory memory maps (e.g. http://www.martin-demling.de/2011/06/memory-maps-in-latex-using-the-bytefield-package/).
It would be nice for Wavedrom to support generation of memory maps.
I would like to try this utility, but I have some troubles by running:
$ node test/basic.js
/home/proj/2016/bitfield/test/basic.js:25
describe('basic', function () {
^
ReferenceError: describe is not defined
at Object.<anonymous> (/home/proj/2016/bitfield/test/basic.js:25:1)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:935:3
the install script
npm install
was completed successful:
$ ls -l node_modules
chai
eslint
istanbul
jsof
mocha
onml
my system:
centOS7 x86_64
$ node -v
v0.10.42
What i'm doing wrong?
PS sorry for stupid question, I'm totaly newbie in js/node matters
Hi, I've added a feature to auto-detect the number of bits by summing all in the input file.
I wasn't sure whether to use a numeric default (e.g. -1, 0), a string default ('auto') or 'undefined' so I went with the last one.
I can open a PR if you are interested.
Here is the code if you want to check
63a46c3
add node 8, removed node <4
updated dependencies to latest versions
Change the color property from Hsl to Hex since some svg to pdf converters doesn't support Hsl format, i.e. CairoSVG.
The change should match the one from wavedrompy, and the argument is the same.
Change from
const colors = { // TODO compare with WaveDrom
2: 0,
3: 80,
4: 170,
5: 45,
6: 126,
7: 215
};
const typeStyle = t => (colors[t] !== undefined)
? ';fill:hsl(' + colors[t] + ',100%,50%)'
: '';
To
const colors = { // TODO compare with WaveDrom
2: "FF0000",
3: "AAFF00",
4: "00FFD5",
5: "FFBF00",
6: "00FF1A",
7: "006AFF"
};
const typeStyle = t => (colors[t] !== undefined)
? ';fill(#' + colors[t] + ')'
: '';
Currently, there is no way to have an integer value appear in the attr section. Integer values are interpolated in binary automatically, which prevents me from displaying the number of bits in the case below. Hack is to put parentheses around the int value to force the attributes to appear as a string.
Hi @drom, do you think there could be a way to export the resulting bitfield diagram as PNG? Thanks for the great work.
[
{
"attr": "ABCDEFGHIJKLMNPQRSTUVWXZ",
"bits": 8
},
{
"attr": "abcdefghijklmnopqrstuvwxyz",
"bits": 8
},
{
"attr": "ABCDEFGHIJKLMNPQRSTUVWXZ",
"bits": 8
},
{
"attr": "abcdefghijklmnopqrstuvwxyz",
"bits": 8
}
]
$ bitfield --bits 32 --lanes 2 --input bitfield.json> svg.svg
$ rsvg-convert svg.svg --format=png --output=png.png
I found lower image border is too close to attribute area and some characters are cut out.
Hello
How can I declare multiple registers using bitfield .
For eg :
{reg: [
{bits: 7, name: 'opcode', attr: 'OP-IMM'},
{bits: 5, name: 'rd', attr: 'dest'},
{bits: 3, name: 'func3', attr: ['ADDI']},
{bits: 5, name: 'rs1', attr: 'src'},
{bits: 12, name: 'imm[11:0]', attr: 'I-immediate[11:0]', type: 3}
],
}
works just fine. If I want to create another reg or a duplicate of this ; How can I do it in the editor ?
Add class to the (path, line) elements for each field.
Hi,
Is it possible to represent a data structure at the byte level and not only bit level ? It could be a more generic protocol spec generator. I cannot find any tool on the web to do it like wavedrom . The closest tool is a latex macro :-/
@nopeslide I have updated wavedrom.com
to support compact mode. #23
{reg:[
{name: 'IPO', bits: 8, attr: 'RO', type: 6},
{ bits: 7},
{name: 'BRK', bits: 5, attr: 'RW', type: 4},
{name: 'CPK', bits: 1 },
{name: 'Clear', bits: 3 },
{bits: 8 }
], config: {lanes: 4, compact: true}}
One issue is the field attributes. (RO, RW) In example above. Do you have ideas how we can place attributes in the compact mode?
You described a workaround for representing bytes using a wavedrom bitfield in #10.
I would like to document the following byte/character based protocol command structure:
Command structure:
* DT: this specific command uses 0x00
00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
-----------------------------------------------------------------------------------------------------------------------
|<------------------- CRC16 --------------------->|
15 01 23 45 67 98 76 54 32 80 00 00 65 72 06 B8 00 00 00 00 00 00 00 00 00 00 00 -- -- -- -- --
^^ ^^^^^^^^^^^ ^^^^^^^^^^^ ^^ ^^ ^^ ^^^^^^^^^^^ ^^^^^ ^^^^^^^^^^^ ^^^^^ ^^
ID TargetAddr# SourceAddr# Idx DT ? TimeStamp Gap Password CRC16 CRC8
However the main difficulty here is that the legend of the bytes is ordered ascending,
while a common bitfield is ordered from most significant to least significant bits, ie. descending.
Are there options to reverse the order, e.g. bytes 00 .. 31 for a byte based protocol instead of bit 31 .. 00 for bitfields.
Side note: for bitfields it also might be interesting to specify big- vs little-endianness for display of a register block ?
I could workaround it by using a wavedrom signal, but I would prefer something like the register view with byte order.
{signal: [
{name:'Clock', wave: 'p...........' },
{name:'Data', wave: 'x345.6.78.9x', data: '7E 07 00000000 00000000 00 07 7F' },
{name:'Description', wave: 'x345.6.78.9x', data: 'SOF ID TargetAddr# SourceAddr# 0x00 CRC8 EOF' },
{name:'Request', wave: '01.........0' }
],
head:{
text:'Messages: DTU to INV: "Init" (0x07)',
tick:0,
every:2
},
foot:{
text:'Messages 0x07',
tock:9
},
}
Shorten field name if it doesn't fit into box.
Use https://github.com/danziamo/fontometer to measure text width.
Abbreviation of the full name of the field, if provided.
Just beginning of the field name + ...
Looking at the code here: https://github.com/drom/bitfield/blob/master/lib/render.js#L209
I don't see how setting --bigendian true
does anything
Issue moved from https://github.com/wavedrom/wavedrom/issues/257
Memory maps are conceptually similar to bitfields, except they're rotated on their sides. Memory maps may also be non-uniform in size, though that may be a future enhancement.
It may be possible to reuse the compact view (#23) to create memory maps, by setting the number of lanes to the number of memory sections (e.g. 16
), and the width to 1
.
If this had an option to reverse the order of the bits, it would also be useful for documenting network / file binary formats.
Is it possible to display longer registers, 64 bits, 128 bits, or even some custom number x
bits?
Thank you,
If attr
property of the field is number, render as binary. Align bits to the columns.
Should we support for ?
, x
, z
?
The fields may overlap.
intentional / non-intentional.
Require specification to have independent (offset, width)
Fields may go out of bounds of the register.
The "reg" class is an exciting development in WaveDrom and WaveJSON. It allows for a uniform way to describe registers.
Currently, it appears largely undocumented. There is an example in the README.md
, but it is missing from WaveJSON wiki, the WaveJSON schema, and the tutorial.
When installed from NPM bin/bitfield CLI should be useful and not heavy on dependencies.
If attr
property of the field is Array, then render attributes under each other.
Would it be possible to also add an option so that ASCII output (not image) can be set?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.