wavedrom / wavedrom.github.io

Digital timing diagram editor
https://wavedrom.com
MIT License
915 stars 158 forks source link

Command line interface #38

Closed Bamban closed 4 years ago

Bamban commented 7 years ago

Hi ! First of all thanks a lot for this awesome tool. I'm using it to generate waveforms for some documentation. I currently have some json wave files in a directory. In order to process them with latex, I need pdf. I can easily go from svg to pdf (which is great because everything is vector) with inkscape. The only thing I can't automate is the export of json to svg. I currently open the editor and click "export svg".

Hence my question : would it be possible to imagine a command line interface doing something like this ? ./wavedrom --in wave.json --export-svg --out wave.svg

Thanks for your time !

drom commented 7 years ago

Hi @Bamban . Thank you for the kind words. Here is CLI version of wavedrom https://github.com/wavedrom/cli Please try.

3DES commented 5 years ago

CLI is really a great idea!

Any chance to get it implemented directly into the standalone waveformeditor, since the editor has all needed options already implemented and especially since PhantomJS project has been suspended?

Thanks a lot spending your time!

drom commented 5 years ago

Yes, It is possible since chromium has headless mode now: https://developers.google.com/web/updates/2017/04/headless-chrome

And if NWJS supports it I will implement CLI for it. https://github.com/nwjs/nw.js/issues/769

wysman commented 5 years ago

I am waiting this feature to be able to create svg for documentations

drom commented 5 years ago

I have created CLI version of wavedrom here: https://github.com/wavedrom/wavedrom/releases/tag/v2.1.2

For help:

node wavedrom.js --help

To generate SVG file from JSON5 file.

node wavedrom.js -i mysignal.json5 > mysignal.svg

Please try.

yunqu commented 5 years ago

In general these command line interfaces work fine. I have tested on armhf and aarch64. The main concern is the performance; suppose we have a long waveform to render, it can takes 6 seconds to render something like:

clock = {'signal': [{'name': 'clock_0', 'wave': 'hlhlhlhlhlhlhlhl'*20}]*4,
                 'foot': {'tock': 1},
                 'head': {'text': 'Clock Signal'}}

This is only 320 samples with 4 channels. I did some extensive tests; it may take 15 seconds to render 1000 samples.

I was hoping that we could get something even faster - not sure if we could do this with chromium browser or other technologies.

drom commented 5 years ago

wavedrom was not designed for the rendering of long simulation traces. I have started another project for that https://github.com/wavedrom/zoom

yunqu commented 5 years ago

@drom This is awesome. Do you have any example/ instructions on how to use zoom?