Man Linux: Main Page and Category List


     drawtiming - generate timing diagram from signal description


     drawtiming [--verbose] [--scale factor] [--pagesize WxH] [--aspect]
                [--cell-height H] [--cell-width W] [--font-size pts]
                [--line-width W] --output target file ...


     This application provides a command line tool for documenting hardware
     and software designs through ideal timing diagrams.  It reads signal
     descriptions from a text file with an intuitive syntax, and outputs an
     ideal timing diagram to an image file.  Notation typical of timing
     diagrams found in the Electrical Engineering discipline is used,
     including arrows indicating causal relationships between signal

     The options are as follows:

     --help      Show usage reminder.

     --verbose   Increase diagnostic output.

     --scale factor
                 Scale the diagram by the given factor.  The default scaling
                 factor is 1.0.

     --pagesize WidthxHeight
                 Scale the diagram to fit given image size.

     --aspect    Maintain fixed aspect ratio if --pagesize given.

     --cell-height H
                 Height of the each signal in pixels. Default is 32.

     --cell-width W
                 Width for the time unit in pixels. Defaults is 64.

     --font-size pts
                 Font size in pts. Default is 18.

     --line-width W
                 Line width for drawings in pixels. Default is 1.

     --output target
                 The name and format of the output image is determined by

     file ...    The input files describe the signals to be diagrammed.  See
                 the FILES and EXAMPLES sections for a description of their


     The following is a technical description of the input file syntax and
     semantics.  If you are reading this for the first time, you may want to
     skip ahead to the EXAMPLES section.

     The input file consists of a series of statements describing the signal
     transitions during each clock period of the timing diagram.  Whitespace
     and comments following a ‘#’ are ignored.

     SIGNAL=VALUE  This statement changes the value of a signal at the
                   beginning of the current clock, and adds it to the list of
                   signal dependencies.  The signal name may consist of one or
                   more words consisting of alphanumerics and underscores
                   joined by periods, ‘’, for example.  The signal
                   value format is described further on.

     SIGNAL        This statement adds a signal to the list of dependencies
                   without changing its value.

     Statements are seperated by the following symbols:

     ,     The comma seperator is used to seperate statements without
           affecting the dependency list or clock (ie: the next statement will
           add to the dependency list).

     ;     The semicolon seperator resets the list of dependencies without
           incrementing the clock

     .     The period seperator resets the list of dependencies and increments
           the clock.

     =>    The "causes" seperator renders dependency arrows based on the
           current list of dependencies and then resets the dependency list.

     -tD>  The "delay" seperator renders a delay arrow from the last
           dependency with the annotation tD.

     Signal values are rendered according to the following rules:

     0, 1, true, false  A binary high/low signal.

     tick               A clock pulse which repeats.

     pulse              A one-shot clock pulse.

     X                  A don’t care value.

     Z                  A tristate value.

     "ABC"              Any other alphanumeric token, or text enclosed in
                        quotes is rendered as a state.  For example, ‘"1"’, is
                        rendered as a state, whereas, ‘1’, is rendered as a
                        high signal.


     Let’s look at an example input file, and parse its meaning.

           POWER=0, FIRE=0, ARMED=0, LED=OFF, COUNT=N.
           POWER=1 => LED=GREEN.
           FIRE => ARMED=1.
           FIRE, ARMED => LED=RED;
           FIRE => COUNT="N+1".

     This input file descibes the changes in five signals over a period of
     seven clock cycles.  The end of each clock cycle is indicated with a
     period.  For example, the following line indicates a single signal, named
     ‘FIRE’ became true during a clock cycle:


     The first clock period of the input file provides the initial value for
     all signals to be diagrammed.  The signals will appear on the timing
     diagram in the order they first appear in the input file.  Signals are
     assumed to have the "don’t care" value if their initial value is not

     Independent signal transitions which occur simultaneously are normally
     seperated by commas. Since signals aren’t normally expected to change
     simultaneously, the initial state is a good example of this:

           POWER=0, FIRE=0, ARMED=0, LED=OFF, COUNT=N.

     Dependencies can also be indicated for a signal transition.  Dependencies
     are rendered as arrows on the timing diagram from the last change in each
     dependency to the dependent signal transition.  Here, the previous change
     in the state of ‘FIRE’ causes a change in the ‘ARMED’ signal.

           FIRE => ARMED=1.

     To indicate that a change in one signal causes an immediate change in
     another signal, list both signal changes in the same clock period:

           POWER=1 => LED=GREEN.

     For signal state changes with multiple dependencies, seperate the
     dependencies with commas:

           FIRE, ARMED => LED=RED.

     Sometimes, a single dependency causes multiple independent signals to
     change.  Use a semicolon to start a new list of dependencies.  Modifying
     the previous line to indicate that ‘FIRE’ also causes ‘COUNT’ to
     increment yields:

           FIRE, ARMED => LED=RED;
           FIRE => COUNT="N+1".

     You can find this example and others along with their generated timing
     diagrams on the homepage for drawtiming at


     Exit status is 0 on success, and 2 if the command fails.


     The drawtiming command has been tested on FreeBSD, Linux, and Cygwin.


     This software package was written by Edward Counce
     〈〉 Additional modifications by
     Salvador E. Tropea 〈〉
     Daniel Beer


     None reported.