2

I am looking for some software to draw Timing Diagrams from a plain text input file.

Note that I do not solely want some sort of paint program, although I do not object to that functionality being present. I will be coding a script to parse a log file and output the input file for the timing diagram app.

Windows or Linux, with source would be nice, preferably gratis.


[Update] I forgot to say, I want it to be runnable from the command line, which, fortuntaley, every answer until now (except for mine) has been.

1
  • Gnuplot. Too lazy to post config.
    – Basilevs
    Commented Aug 5, 2015 at 19:27

4 Answers 4

1

Drawtiming

I have not used this software, but fromt he description and Tutorial on their webpage, it looks like it fits your description. Drawtiming is a command line tool for plotting timing diagrams. It's like dot in GraphViz, but only for timing diagrams

Features

  • Free of charge
  • Runs on Windows and Linux (you need to build the source yourself on Linux)
  • open source

Drawbacks

  • The latest update was in 2009
  • It is still labeled beta

[Update, from OP] the input looks like this:

# initialize the signals
POWER=0, FIRE=0, ARMED=0, LED=OFF, COUNT=N.
# turn on the power
POWER=1 => LED=GREEN.
# fire once to arm
FIRE=1.
FIRE => ARMED=1.
FIRE=0.
# fire a second time
FIRE=1.
FIRE, ARMED => LED=RED;
FIRE => COUNT="N+1".

and the output looks like this: enter image description here


If you are already familiar with TikZ, there is a Latex package called tikz-timing whose author is an active user and moderator on TeX.SE. So you are likely to find better support than with drawtiming

2
  • This is probably a better generic answer, but I will accept Steve's because I wanted to script in Python. His answer is more specific to me, while yours is a more general answer. I wish that I could award both.
    – Mawg
    Commented Aug 6, 2015 at 10:04
  • 1
    @Mawg Quite understandable. I prefer Steve's answer as well, since it's often easier to use a language you already know than learn a new one for a single special purpose
    – Tymric
    Commented Aug 6, 2015 at 10:31
1

I would suggest using python plus matplotlib - e.g.:

#! /usr/bin/env python
#coding=utf-8
"""
    mpl_time.py Example of generating timing diagrams in matplotlib.
"""

import matplotlib.pyplot as plt
from datetime import datetime, timedelta
import random
# assuming your timing data in a csv file you could import csv and read the data

def GetData(samplelen=20):
    """ As I don't wish to spend the time generating a csv file I will dummy!"""
    data = {'t':[], 's1':[], 's2':[], 's3':[],}
    vals = {'s1':0, 's2':0, 's3':0,}
    t_current = 0.0  #datetime.now()
    t_increment = 0.01  #timedelta(0, 100)
    for step in xrange(samplelen*10):
        data['t'].append(t_current)
        if step % 9 == 0:
            for s in ['s1', 's2']:
                vals[s] = random.choice([0, 1])
        vals['s3'] = random.choice([0, 1])
        for s in ['s1', 's2', 's3']:
            data[s].append(vals[s])
        t_current = t_current + t_increment
    return data

def PlotData(data, timename='t'):
    """
    Expects a dictionary of named items with a list of states in all but the
    time axis named in it.
    """
    plotlist = sorted([k for k in data.keys() if k < timename])
    print plotlist
    timeax = data.get(timename)
    print timeax
    f, axes = plt.subplots(len(plotlist), sharex=True, sharey=True)
    for k, ax in zip(plotlist, axes):
        #assert isinstance(ax, plt.axes.subplot)
        ax.set_title(k)
        ax.plot(timeax, data[k])
        ax.set_ybound(1.2, -0.2)
        #ax.set_xbound(timeax[0], timeax[-1])

    # Fine-tune figure; make subplots close to each other and hide x ticks for
    # all but bottom plot.
    f.subplots_adjust(hspace=0)
    plt.setp([a.get_xticklabels() for a in f.axes[:-1]], visible=False)
    plt.show()

if __name__ == "__main__":
    DATA = GetData(50)
    print DATA
    PlotData(DATA)

Gives: enter image description here There is a bit of a learning curve but the flexibility is very high.

  • Free/Gratis
  • Open Source
1

PlantUML

As of 2017-02-01, PlantUML has a timing diagram feature. The feature is still in beta but is very intuitive and easy to pick up.

Features

  • Cross-platform
  • Free and open source
  • Input is a text file
  • Runnable from the command line
  • Frequently updated
1

I have also found WaveDrom, which looks very promising. Just noting it here for future searchers.

From http://wavedrom.com/editor.html

{signal: [
  {name: 'clk', wave: 'p.....|...'},
  {name: 'dat', wave: 'x.345x|=.x', data: ['head', 'body', 'tail', 'data']},
  {name: 'req', wave: '0.1..0|1.0'},
  {},
  {name: 'ack', wave: '1.....|01.'}
]}

Which generates this. Export to PNG and SVG is available.

Sample output image

Btw, it looks like it is a front end to Google analytics, so of less interest to me, but it may be of interest to others.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.