]> sigrok.org Git - libsigrok.git/commit
output/vcd: support smaller timescales with higher resolution
authorGerhard Sittig <redacted>
Fri, 12 Oct 2018 10:35:50 +0000 (12:35 +0200)
committerUwe Hermann <redacted>
Sat, 21 Dec 2019 16:19:50 +0000 (17:19 +0100)
commit17c30d0593ae8db4cd8b185e8bc45a15e4beed5d
treec9add9deab244dc0edd13d5588ab2e60c3f1ba7e
parent4ddea31451922d596b34cc2c07825fbbabb14bfc
output/vcd: support smaller timescales with higher resolution

The previous implementation inspected the input stream's samplerate, and
simply used the next 1kHz/1MHz/1GHz timescale for VCD export. Re-import
of the exported file might suffer from rather high an overhead, where
users might have to downsample the input stream. Also exported data
might use an "odd" timescale which doesn't represent the input stream's
timing well.

Rephrase the samplerate to VCD timescale conversion such that the lowest
frequency is used which satisfies the file format's constraints as well
as provides high enough a resolution to communicate the input stream's
timing with minimal loss. Do limit this scaling support to at most three
orders above the input samplerate, to most appropriately cope with odd
rates.

As a byproduct the rephrased implementation transparently supports rates
above 1GHz. Input streams with no samplerate now result in 1s timescale
instead of the 1ms timescale of the previous implementation.
src/output/vcd.c