Debian Codegraph @

texmf-dist/source/latex/tikz-timing/tikz-timing.dtx

raw
1 % \iffalse meta-comment
2 %<=*COPYRIGHT>
3 %% Copyright (C) 2009-2012 by Martin Scharrer <[email protected]>
4 %% ----------------------------------------------------------------------
5 %% This work may be distributed and/or modified under the
6 %% conditions of the LaTeX Project Public License, either version 1.3
7 %% of this license or (at your option) any later version.
8 %% The latest version of this license is in
9 %% http://www.latex-project.org/lppl.txt
10 %% and version 1.3 or later is part of all distributions of LaTeX
11 %% version 2005/12/01 or later.
12 %%
13 %% This work has the LPPL maintenance status `maintained'.
14 %%
15 %% The Current Maintainer of this work is Martin Scharrer.
16 %%
17 %% This work consists of the files tikz-timing.dtx and tikz-timing.ins
18 %% and the derived filebase tikz-timing*.sty.
19 %%
20 %<=/COPYRIGHT>
21 % \fi
22 %
23 % \iffalse
24 %<*driver>
25 \ProvidesFile{tikz-timing.dtx}[%
26 %<=*DATE>
27 2017/12/20
28 %<=/DATE>
29 %<=*VERSION>
30 v0.7f
31 %<=/VERSION>
32 DTX-File of 'tikz-timing' package.]
33 \newif\ifprintversion % \fi
34 \ifdefined\printversion
35 \printversiontrue
36 \fi
37
38 \RequirePackage{filecontents}
39 \begin{filecontents}{ydoc.cfg}
40 % Intensionally empty
41 \end{filecontents}
42
43 \ifprintversion
44 \documentclass{ltxdoc}
45 \let\chapter\section
46 \let\section\subsection
47 \let\subsection\subsubsection
48 \else
49 \documentclass[landscape,12pt]{scrreprt}
50 \usepackage{ydoc}
51 \fi
52 \GetFileInfo{tikz-timing.dtx}
53 \usepackage{tikz-timing}[\filedate]
54
55 \usepackage{hyperref}
56 \usepackage{atbegshi}
57 \usetikztiminglibrary{arrows,either,overlays,clockarrows,columntype}
58 \usetikztiminglibrary{nicetabs,counters,advnodes,interval,ifsym}
59 \tikzset{timing/no nice tabs}
60 \tikzset{timing/interval/normal}
61 \tikzset{timing/nodes/old center}
62 \usetikzlibrary{plotmarks}
63 \makeatother
64 %%%^^A\usepackage[electronic]{ifsym}
65 \usepackage{calc}
66 \usepackage{graphicx}
67 \usepackage{xcolor}
68 \usepackage{tabularx}
69 \usepackage{array}
70 \usepackage{flafter,fnpos}
71 \usepackage{booktabs}
72 \usepackage{supertabular}
73 %\usepackage{xtab}
74 \usepackage{amsmath}
75 \usepackage{flafter}
76 \usepackage{placeins}
77 \makeFNbottom
78 \makeFNbelow
79 \usepackage{microtype}[2005/10/28]
80 \DisableLigatures{encoding = T1, family = tt* }%
81 \newsavebox{\mysb}
82 \newsavebox{\sba}
83 \newsavebox{\sbb}
84
85 \def\topfraction{0.91}
86 \def\bottomfraction{0.95}
87 \def\floatpagefraction{0.98}
88 \def\textfraction{0.05}
89 \setcounter{bottomnumber}{2}
90
91 \usepackage{listings}
92 \lstset{basicstyle=\ttfamily}
93
94 \usepackage{shortvrb}
95 \usepackage{newverbs}
96 \MakeSpecialShortVerb{\qverb}{\"}
97
98 \def\NewIn#1{
99 \marginpar{\strut\raggedleft\raisebox{.125ex}{\textcolor{black}{\emph{New in #1}}}}%
100 }
101
102 \def\ExtIn#1{
103 \marginpar{\strut\raggedleft\textcolor{black}{\emph{Extended in #1}}}%
104 }
105
106 \iffalse
107 \def\thesection{\texorpdfstring{\LARGE\texttiming[X]{D{\arabic{section}}.1X[black]}}{\arabic{section}}}
108 \def\thesubsection{\texorpdfstring{\Large\texttiming[X]{D{\arabic{section}}D{\arabic{subsection}}.1X[black]}}{\arabic{section}.\arabic{subsection}}}
109 \def\thesubsubsection{\texorpdfstring{\large\texttiming[X]{D{\arabic{section}}D{\arabic{subsection}}D{\arabic{subsubsection}}.1X[black]}}
110 {\arabic{section}.\arabic{subsection}.\arabic{subsubsection}}}
111
112 %\def\timingsectionformat#1{%
113 % \sbox{\mysb}{\tikz \draw node [timing/d/text] {#1};}%
114 % \texttiming{ $ \wd\mysb / \tikztiming@xunit $ DD{#1} }%
115 %}
116
117 \renewcommand\section{\@startsection {section}{1}{\z@}%
118 {-3.5ex \@plus -1ex \@minus -.2ex}%
119 {2.3ex \@plus.2ex}%
120 {\normalfont\Large\bfseries\sffamily}}
121 %[#1]{\texorpdfstring{\larger\timingsectionformat{#2}}{#2}}}
122 \renewcommand\subsection{\@startsection{subsection}{2}{\z@}%
123 {-3.25ex\@plus -1ex \@minus -.2ex}%
124 {1.5ex \@plus .2ex}%
125 {\normalfont\large\bfseries\sffamily}}
126 \renewcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}%
127 {-3.25ex\@plus -1ex \@minus -.2ex}%
128 {1.5ex \@plus .2ex}%
129 {\normalfont\normalsize\bfseries\sffamily}}
130 \fi
131
132 \let\envv\env
133 \let\css\cs
134 \def\lib{\texttt}
135 \def\library#1#2{\section{#2}\label{lib:#1}}
136
137 \usepackage{xspace}
138 \def\ie{i.e.\xspace}
139 \def\eg{e.g.\xspace}
140
141 \makeatletter
142 % The following code is only needed to produce package examples and therefor not
143 % included in the style file but might be written to an additional file.
144 % \iffalse
145 %</driver>
146 %<*examplecode>
147 % \fi
148 %
149 % \begin{environment}{tikztimingexampletable}
150 % \begin{macrocode}
151 \newenvironment{tikztimingexampletable}{%
152 \begingroup
153 \let\tikztimingtable@row\tikztimingexampletable@row
154 \tikzset{timing/nice tabs}
155 \tikztimingtable
156 }{%
157 \extracode
158 \tableheader{Characters}{Resulting Diagram}%
159 \tablerules
160 \endtikztimingtable
161 \endgroup
162 }%
163 % \end{macrocode}
164 % \end{environment}
165 %
166 % \begin{macro}{\tikztimingexampletable@row}[1]{Row content}
167 % \begin{macrocode}
168 \long\def\tikztimingexampletable@row#1\\{%
169 \def\tikztiming@text{#1}%
170 \@onelevel@sanitize\tikztiming@text
171 \tikztimingtable@row@@{\ttfamily\tikztiming@text}{#1}%
172 }
173 % \end{macrocode}
174 % \end{macro}
175 %
176 % \begin{macro}{\tikztimingfullexampletable}
177 % \begin{macrocode}
178 \def\tikztimingfullexampletable{%^^A
179 \begin{tikzpicture}[timing/picture,x=1em,y=1em,font=\sffamily]
180 \tikzset{timing/d/background/.style={fill={gray!25},fill opacity=0.5}}%
181 \let\chars\tikztiming@chars@default
182 \node (charnode) at (0,0) {%
183 \scalebox{0.4}%
184 {\rotatebox{-45}{$\frac{\mbox{\rotatebox{45}{to}}}%
185 {\mbox{\rotatebox{45}{from}}}$}}%
186 };
187 \coordinate (charnodex) at (0.25,0);%
188 \coordinate (charnodey) at (0,0);%
189 \expandafter\foreach
190 \expandafter\tchar
191 \expandafter i\expandafter n\expandafter{\chars} {%
192 \path (charnodex) ++(+2,0) node (charnodex) {\strut\tchar};
193 \path (charnodey) ++(0,-2) node (charnodey) {\strut\tchar};
194 }%
195 \draw [line width=\heavyrulewidth] (charnodex) +(+1,+1) -- (-1,+1);
196 \draw [line width=\lightrulewidth] (charnodex) +(+1,-1) -- (-1,-1);
197 \draw [line width=\lightrulewidth] (charnodey) +(+1,-0.6) -- (+1,-1.4)
198 (+1,-0.6) -- (+1,+0.6);
199 \draw [line width=\heavyrulewidth] (charnodey) ++(-1,-1) -- +($ (2,0) +
200 (charnodex) $);
201 %
202 \path (1.5,-2) node (charnodex) {\strut};
203 \coordinate (charnodex) at (charnodex.base);
204 \coordinate (charnodey) at ($ (charnodex.base) + (0,2) $);
205 \def\@tempa{\timing at (charnodey)}
206 \foreach\xchar in \chars {
207 \foreach\ychar in \chars {
208 \path (charnodey) +(0,-2) node (charnodey) {};
209 \draw [xstep={\timingwidth/2.},ystep={\timingheight/2.},timing/grid,
210 shift={(charnodey)}]
211 (0,0) grid +(2,1);
212 \expandafter\@tempa\expandafter{\ychar\xchar};
213 }
214 \path (charnodex) ++(+2,0) node (charnodex) {};
215 \path (charnodex) ++(0,2) node (charnodey) {};
216 }
217 \end{tikzpicture}%^^A
218 }
219 % \end{macrocode}
220 % \end{macro}
221 %
222 % \iffalse
223 %</examplecode>
224 %<*driver>
225 % \fi
226
227 \makeatother
228 \EnableCrossrefs
229 %\CodelineIndex
230 \RecordChanges
231 \OnlyDescription
232 \listfiles
233
234 \DeleteShortVerb{\|}
235 \def\pipe{|}
236 \def\Pipe{{\normalfont\normalcolor\pipe}}
237 \MakeShortVerb{\|}
238
239 \begin{document}
240 \DocInput{tikz-timing.dtx}
241 \PrintChanges
242 %\newpage\PrintIndex
243 \end{document}
244 %</driver>
245 %<*doc>
246 % \fi
247 %
248 % \CheckSum{5720}
249 %
250 % \CharacterTable
251 % {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
252 % Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
253 % Digits \0\1\2\3\4\5\6\7\8\9
254 % Exclamation \! Double quote \" Hash (number) \#
255 % Dollar \$ Percent \% Ampersand \&
256 % Acute accent \' Left paren \( Right paren \)
257 % Asterisk \* Plus \+ Comma \,
258 % Minus \- Point \. Solidus \/
259 % Colon \: Semicolon \; Less than \<
260 % Equals \= Greater than \> Question mark \?
261 % Commercial at \@ Left bracket \[ Backslash \\
262 % Right bracket \] Circumflex \^ Underscore \_
263 % Grave accent \` Left brace \{ Vertical bar \|
264 % Right brace \} Tilde \~}
265 %
266 %
267 %
268 % \GetFileInfo{tikz-timing.dtx}
269 %
270 % \DoNotIndex{\newcommand,\newenvironment,\def,\edef,\xdef,\DeclareRobustCommand}
271 % \DoNotIndex{\expandafter,\if,\else,\fi,\ifnum,\ifx,\let,\global,\long}
272 % \DoNotIndex{\newcounter,\newcount,\message,\meaning,\noexpand,\relax,\value}
273 % \DoNotIndex{\setcounter,\addtocounter,\advance,\afterassignment,\AtEndOfPackage}
274 % \DoNotIndex{\ProvidesPackage,\providecommand,\RequirePackage,\empty,\begin,\end}
275 % \DoNotIndex{\begingroup,\bgroup,\egroup,\endgroup,\csname,\endcsname,\@tempa}
276 % \DoNotIndex{\ignorespaces,\lccode,\sffamily,\@gobble,\@ifundefined,\@for,\or}
277 % \DoNotIndex{\@firstoftwo,\@ifnextchar,\@namedef,\@nameuse,\@secondoftwo}
278 % \DoNotIndex{\@temptokena,\toks@,\BODY,\do,\g@addto@macro,\lowercase,\uppercase,\the}
279 % \DoNotIndex{\height,\width,\slope,\style,\draw,\path,\newdraw,\newdrawns}
280 % \DoNotIndex{\dslope,\zslope}
281 %
282 % \ifpdf
283 % \hypersetup{%
284 % pdfauthor = {Martin Scharrer <[email protected]>},
285 % pdftitle = {The tikz-timing package, \fileversion\ from \filedate},
286 % pdfsubject = {Documentation of LaTeX package tikz-timing which allows the
287 % easy creation of timing diagrams inside tikz pictures or text.},
288 % pdfkeywords = {tikz-timing, timing diagram, LaTeX}
289 % }%
290 % \fi
291 %
292 % \unless\ifprintversion
293 % \begingroup
294 % \makeatletter
295 % \title{{\tikz[baseline=(N.base),timing/picture,timing/z/.style={},%
296 % timing/unit=1.44*\f@size pt,timing/d/text/.style={},timing/d/background/.style={fill=black!10},timing/inline node/.append style={rectangle,inner sep=0pt,outer sep=0pt}]
297 % \timing at (0,0) {1L N[shift={(0,0.5)}]{\strut The} .9L 3d{[alias=N]\strut tikz} $.5em/\xunit$Z 5d{\strut timing} 1.75H N[shift={(0,-0.5)}]{Package} 1.75H } ;}}
298 % \author{Martin Scharrer}
299 % \date{Version \fileversion\ -- \filedate}
300 % \thispagestyle{empty}
301 % \begin{titlepage}
302 % \sffamily\bfseries
303 % \parindent=0pt
304 % \centering
305 % \vspace*{2cm}
306 % \resizebox{.75\textwidth}{!}{\Huge\@title}
307 % \par\vspace*{.75cm}
308 % \Large A \LaTeX\ Package for Timing Diagrams
309 % \par\vspace*{1.5cm}
310 % {\LARGE\@date}
311 % \par\vspace*{2cm}
312 % {\LARGE\@author
313 % \par\smallskip}
314 % {\Large\href{mailto:[email protected]}{[email protected]}
315 % \par\vspace*{1.25cm}}
316 % {\Large
317 % WWW: \url{http://latex.scharrer-online.de/tikz-timing}\\[.5ex]
318 % CTAN: \url{http://www.ctan.org/pkg/tikz-timing}\\[1.2ex]
319 % \par\smallskip}
320 % \end{titlepage}
321 % \clearpage
322 % \endgroup
323 %
324 % \else
325 %
326 % \null
327 % \vspace*{-2em}
328 % \begin{center}
329 % \sffamily
330 % \tikzset{timing/z/.style={black},
331 % timing/intext/.style={timing,line width=0.1ex}}
332 % {\LARGE\sffamily The \raisebox{-0.66ex}{\Huge\textsf
333 % {\texttiming[z]{3d{\strut tikz}z5d{\strut timing}0.2z}}} package}\\[3ex]
334 % {\large Version \fileversion\ -- \filedate}\\[2ex]
335 % {\large Martin Scharrer \\\normalsize
336 % \url{[email protected]}\\[.8ex]
337 % WWW: \url{http://latex.scharrer-online.de/tikz-timing}\\[.5ex]
338 % CTAN: \url{http://www.ctan.org/pkg/tikz-timing}\\[1.2ex]}
339 % \end{center}
340 % \vspace{1.2em}%
341 % \fi
342 %
343 % ^^A\vfill \noindent
344 % ^^A\textbf{Note to Advanced Users:} This is a new package which internal
345 % ^^Amacros might still change. Please only rely on the user macros for now.
346 %
347 % \clearpage
348 % \enlargethispage{\baselineskip}
349 % {\let\csd
350 % \texttt\tableofcontents
351 % \listof{example}{List of Examples}
352 % }
353 % \addtocontents{toc}{\vspace*{-1.5em}}
354 %
355 % \chapter{Introduction}
356 % This package uses the \pkg[pgf]{tikz} package to produce timing diagrams
357 % inside text or \envv{tikzpicture} environments. Also a tabular-like
358 % environment is provided to produce a larger timing diagram with multiple
359 % labeled signals and the possibility to add own drawing material.
360 % Additional optional functionality is provided by libraries.
361 %
362 % The signal levels of the timing diagram can be given by corresponding
363 % characters/letters like "H" for \emph{Logical High} or "L" for
364 % \emph{Logical Low}. So e.g.\ "{HLZXD}" gives `\texttiming{HLZXD}'.
365 % In order to fit (in)to normal text the diagram size (\ie its height, width and line width)
366 % is defined relatively to the currently active font size. The diagram height is about the height of an
367 % uppercase "X" (+$2\times\frac12$ line width). This way the diagrams
368 % can also be scaled using font size commands like \cs{small}.
369 % (Example: {\sffamily
370 % \large X\texttiming{LH}X
371 % \normalsize X\texttiming{LH}X
372 % \small X\texttiming{LH}X
373 % \footnotesize X\texttiming{LH}X
374 % \scriptsize X\texttiming{LH}X
375 % \tiny X\texttiming{LH}X
376 % })
377 % \makeatletter
378 % \def\iex#1{^^A
379 % \def\@tempa{#1}\@onelevel@sanitize\@tempa
380 % `\texttt{\@tempa}'~$\rightarrow$~`\texttiming{#1}'}
381 % \makeatother
382 % A single timing character produces a diagram with a width identical to its height
383 % (\iex{H}). Longer diagrams can be produces by either
384 % using the same character multiple times (\iex{HHH})
385 % or writing the width as number in front of the character (\iex{3.2H}).
386 % For (partial) compatibility with similar packages lowercase characters only produce
387 % a signal with half the width (\iex{h}, \iex{3.2h}).
388 %
389 % Recurring character combinations can be repeated using character groups
390 % (\iex{3{hlz}}) or be defined as so called \emph{meta-characters}
391 % ({\tikztimingmetachar{Y}{hlz} "Y"="hlz", \iex{3Y}}),
392 % which are similar to a \TeX~macro.
393 % Since v0.7 meta-characters can also include macro arguments.
394 %
395 % Additional features are the inclusion of in-line TikZ styles (\iex{H ;[orange] L}),
396 % in-line nodes (\iex{2H N[rectangle](Name){Text} 2L}), automatic width calculations
397 % ("H $ 1+\mymacro-\slope $ L "~$\rightarrow$~`\texttiming{H2.5L}')
398 % and much more.
399 %
400 % \iffalse
401 % \medskip
402 % \DeleteShortVerb{\|}
403 % \centerline{\texttiming[D]{
404 % 2{12{[yscale=.9,shift={(0,.05)}]D{}}
405 % 13{[yscale=1.1,shift={(0,-.05)}]D{}};}
406 % $\dslope$ D{}
407 % }}
408 % \MakeShortVerb{\|}
409 % \medskip
410 % \fi
411 %
412 % \iffalse
413 % The package is build to make it possible to define new characters from scratch
414 % or as modified copy of other characters. However, no user macros nor
415 % documentation for this are provided at the moment. Interested \LaTeX\ users
416 % should look at the default definitions at the end of the source code.
417 % \fi
418 %
419 % \iffalse
420 % \section{Similar Packages}
421 % There a some packages which target the same application like the package
422 % presented by this document.
423 %
424 % \begin{description}
425 % \itempkg{ifsym} This package (using the |electronic| option) provides a
426 % special font which contains graphical representation of the logical levels
427 % high and low at the corresponding letter "H" and "L". The lower case
428 % versions have only half the width of the uppercase ones. Also a transition
429 % can be added using the "|" character which will (sometimes) be added
430 % automatically between |HL| and |LH|.
431 % The diagrams are created using the command |\textifsym|\marg{characters},
432 % e.g.\ \verb+\textifsym{H|L|h|l|H|L}+ results in
433 % \DeleteShortVerb{\|} `\textifsym{H|L|h|l|H|L}'.
434 % \MakeShortVerb{\|}
435 %
436 % There is no support for transition slopes and no support for new
437 % user-defined logical levels.
438 %
439 % \itempkg[(CTAN)]{timing} This package also provides a font for the logical
440 % levels but supports transition slopes and larger timing diagrams. This
441 % package seems not been updated for a while.
442 %
443 % \itempkgnoctan[(TikZ Example Page)]{timing}%
444 % {http://www.texample.net/tikz/examples/timing-diagram/} This package is
445 % accidentally also called "timing.sty" and is not published on CTAN but on
446 % the TikZ example website. It is a small package which is meant as an
447 % example for the graphics package \texttt{tikz} which is used to draw the
448 % diagram. The logical levels must be provided using macros like
449 % `|\bit|\marg{0 or 1}\marg{length}'.
450 % \end{description}
451 % \fi
452 %
453 % \clearpage
454 % \section{Changelog}
455 % \begingroup
456 % \renewcommand{\changes}[3]{\paragraph{#1 from #2}\begin{itemize}\item #3\end{itemize}}
457 % \newenvironment{Changes}[2]{\paragraph{#1 from #2}\begin{itemize}\let\change\item}{\end{itemize}}
458 %
459 % \changes{v0.3}{2009/04/24}{First released version}
460 % \changes{v0.4}{2009/05/03}{Added output routine which combines successive
461 % occurrences of the same character. This improves screen display quality and
462 % reduces rendering time and file size.
463 % \item Removed own macros for lowercase characters. They
464 % are now handled by the uppercase macros which receive half of the width.
465 % Exceptions are possible like for the `m' character.
466 % \item Added parser for rows in \env{tikztimingtable}.
467 % This makes the syntax much more stable. Also replaced row counter with TikZ
468 % coordinates which is more user-friendly.
469 % \item User macros to draw grids and lines inside table.
470 % \item In-line Nodes, \eg to mark positions inside the diagram.}
471 % \changes{v0.4a}{2009/05/05}{Added \cs{tablerules} macro. Changed default style
472 % of inline nodes to \texttt{coordinate}.}
473 % \changes{v0.5}{2009/05/15}{Added PGF shape for timing diagrams. Added
474 % meta-characters. Changed `M' character to use PGF decorations. Added special
475 % `B' character to reduce width of next character. Changed \cs{timing} syntax to
476 % include an `at' before the coordinate. Bug fix for use with the `calc'
477 % package.}
478 % \changes{v0.6}{2009/07/27}{Added ``forward'' modifier `\texttt{F}' as reverse
479 % version of the ``backward'' modifier `\texttt{B}'.
480 % \item Added support for
481 % lower-case modifiers ``\texttt{b}', `\texttt{f}' and \texttt{n}'.
482 % \item Added libaries for characters `\texttt{A}'/`\texttt{W}' for arrows and
483 % '\texttt{E}' for uncertain low-to-high and high-to-low transitions.}
484 % \changes{v0.6a}{2009/07/28}{Added library for overlay modifier `\texttt{O}'.}
485 %
486 % \begin{Changes}{v0.7}{2009/12/05}
487 % \change New libraries:
488 % \begin{description}
489 % \item[\lib{clockarrows}] Library for clock arrows.
490 % \item[\lib{columntype}] Library providing a timing column type for |tabular|.
491 % \item[\lib{nicetabs}] Library to format \cs{tikztimingtable} like a |booktab| |tabular|.
492 % \item[\lib{counters}] Library to defined counter characters which display an incrementing
493 % counter value every time there are used.
494 % \item[\lib{advnodes}] Library for advanced nodes with multiple anchor points.
495 % \item[\lib{ifsym}] Library providing the same timing symbols and characters as the |ifsym| package
496 % when loaded with the |electronic| option.
497 % \end{description}
498 % \change Additional experimental libraries:
499 % \begin{description}
500 % \item[\lib{interval}] Library to change color of "ZL", "ZH" etc. transitions to
501 % indicate borders of an interval.
502 % \item[\lib{beamer}] Library providing some marginal beamer overlay support.
503 % \end{description}
504 % \change \lib{overlays} library:
505 % \begin{itemize}
506 % \item Overlays can now be cascaded, \ie an overlay can be inside another one.
507 % \item The second braces around the second part are now optional.
508 % \item Fixed issues with "T" and "C" characters inside overlays.
509 % \end{itemize}
510 % \change Meta-characters can now have arguments.
511 % \change Added more variety for in-line options: "[[ ]]", "[+ +]" and "[| |]".
512 % \change Handling of in-line options and nodes got modified. Options are now placed directly
513 % where placed and are valid until the next ";". Please note that |[/utils/exec={..}]| now
514 % needs to be written as \verb+[|/utils/exec={..}|]+. Otherwise it is re-executed every time
515 % the drawing path is renewed.
516 % \change Added star version of \cs{tablegrid}.
517 % \change Added background to "E" character (\lib{either} library).
518 % \change Some fixes for placing of "D{}" texts.
519 % \change Fixed wrong slopes (\eg |lslope| instead of |zslope|) for some transitions.
520 % \change Major changes on internal character definition macros, parser and output routine.
521 % \change Fixed problems with expanding code content in user input.
522 % \change The \cs{texttiming} macro now uses a \cs{timing} macro internally.
523 % \change The \cs{timing} macro is now only defined inside |tikzpictures|.
524 % This includes |tikztimingtable|.
525 % \change Added TikZ style |timing/draw grid| for grids behind \cs{timing} macros.
526 % \change Replaced macros \cs{texttimingbefore}, \cs{texttimingafter} and \cs{texttiminggrid} with
527 % TikZ settings "timing/before text", "timing/after text" and "timing/draw grid".
528 % \change Added separators "timing/outer sep" around \cs{texttiming}.
529 % \change Graphical improvements for `double line' characters like "D", "U" and "E".
530 % The whole character including both edges is drawn in a single process.
531 % \change Character width can now be scaled using |wscale|.
532 % \change Character width can now be calculated by placing code inside "$ $".
533 % \change Fixed issue with \cs{horlines} macro.
534 % \change The \env{tikztimingtable} environment and associated macros got enhanced:
535 % \begin{itemize}
536 % \item The content is no longer read as macro argument and can now include paragraphs.
537 % \item Multiple |extracode| sections can be now included between rows, not only a single
538 % section at the very end.
539 % \item A \env{extracode} environment has been added. Both macro and environment have now
540 % an optional argument for TikZ settings.
541 % \item Added \cs{tableheader} macro to label both columns. The \cs{tablerules} macro got
542 % adjusted to detect the header line and draw also a middle line.
543 % \item Added \env{background} environment to draw things in the background.
544 % \item Fixed broken optional argument of \cs{tablegrid}.
545 % \item Added macro \cs{marknodes} and associated |debug/nodes| style to mark in-line nodes
546 % for debug purposes/orientation during the diagram creation.
547 % \end{itemize}
548 % \end{Changes}
549 % \changes{v0.7d}{2011/01/09}{Fix for end macro of extracode environment to support etoolbox's environment hooks.}
550 % \changes{v0.7e}{2017/12/10}{Fixed advnodes library to support current PGF version.}
551 % \changes{v0.7e}{2017/12/10}{Documentation update: added usage as float with caption due to user request.}
552 % \changes{v0.7f}{2017/12/20}{Documentation update: added description of several existing styles.}
553 %
554 %
555 % \endgroup
556 %
557 % \section{Dependencies}
558 % \dots
559 %
560 % \clearpage
561 % \chapter{Usage}
562 %
563 % \section{Timing Characters}
564 % The logic levels are described by so called \emph{timing characters}. Actually
565 % all of them are letters, but the general term \emph{character} is used here.
566 % Table~\ref{tab:chars} shows all by default defined logic characters and
567 % Table~\ref{tab:full} all possible two-character transitions. Additional
568 % functionality is provided by the \emph{modifiers} shown in
569 % Table~\ref{tab:modifiers}.
570 %
571 % \sbox{\sba}{%^^A
572 % \sffamily
573 % \tikzset{timing/draw grid}
574 % \begin{tabular}{clccc}
575 % \toprule
576 % Character & Description & Diagram & Transition \\
577 % & & & Example \\
578 % \midrule
579 % \texttt{H} & High & \texttiming{H} & \texttiming[L]{H} \\
580 % \texttt{L} & Low & \texttiming{L} & \texttiming[H]{L} \\
581 % \texttt{Z} & High Impedance & \texttiming{Z} & \texttiming[L]{Z} \\
582 % \texttt{X} & Undefined / Don't Care & \texttiming{X} & \texttiming[L]{X} \\
583 % \texttt{D} & Data / Double & \texttiming{D} & \texttiming[L]{D{A}D} \\
584 % \texttt{U} & Unknown Data & \texttiming{U} & \texttiming[D]{U} \\
585 % \texttt{T} & Toggle & \texttiming{L} or \texttiming{H} & \texttiming{TTTT} \\
586 % \texttt{C} & Clock (no slope) & \texttiming{L} or \texttiming{H} & \texttiming{CCCC} \\
587 % \texttt{M} & Metastable Condition & \texttiming{M} & \texttiming[H]{Ml} \\
588 % \midrule
589 % \texttt{G} & Glitch (zero width) & \texttiming{G} & \texttiming{HGH} \\
590 % \texttt{S} & Space (nothing) & \texttiming{S} & \texttiming{HSL} \\
591 % \bottomrule
592 % \end{tabular}
593 % }%^^A
594 %
595 % \sbox{\sbb}{%^^A
596 % \tikzset{timing/draw grid}
597 % \sffamily\small
598 % \tikztimingfullexampletable
599 % }%^^A
600 %
601 % \ifprintversion
602 %
603 % \begin{table}
604 % \centering
605 % \caption{Timing Characters}\label{tab:chars}
606 % \usebox{\sba}
607 % \end{table}
608 %
609 % \begin{table}
610 % \caption{Overview over all transitions.}
611 % \label{tab:full}
612 % \usebox{\sbb}
613 % \end{table}
614 %
615 % \else
616 %
617 % \begin{table}
618 % \sffamily
619 % \centering
620 % \pgfmathparse{max(\wd\sba+\wd\sbb+1em,\textwidth)}%^^A
621 % \makebox[\textwidth][c]{%^^A
622 % \begin{minipage}{\wd\sba}
623 % \caption{Timing Characters}
624 % \label{tab:chars}
625 % \usebox{\sba}
626 % \end{minipage}%^^A
627 % \hspace{1em}\hfill
628 % \begin{minipage}{\wd\sbb}
629 % \caption{Overview over all transitions.}
630 % \label{tab:full}
631 % \usebox{\sbb}
632 % \end{minipage}%^^A
633 % }%^^A
634 % \end{table}
635 %
636 % \fi
637 %
638 % \clearpage
639 % \DeleteShortVerb{\|}
640 % \begingroup^^A{table}[b]
641 % \tikzset{timing/draw grid}
642 % \let\normalfont\sffamily
643 % \sffamily\centering
644 % \makeatletter
645 %
646 % \tablecaption{Modifiers for Timing Characters.}
647 % \label{tab:modifiers}
648 % \def\en{\,\textsf{--}\,}
649 % \let\origtabular\tabular
650 % \let\endorigtabular\endtabular
651 % \def\tabular{\begingroup
652 % \setbox\mysb\hbox\bgroup
653 % \origtabular}%
654 % \def\endtabular{\endorigtabular\egroup\makebox[\textwidth][c]{\usebox\mysb}
655 % \endgroup}%
656 % \tablefirsthead{%
657 % \toprule
658 % \normalfont
659 % Modifier Syntax & Description \\
660 % \midrule
661 % }%
662 % \tablehead{%
663 % \multicolumn{2}{c}%
664 % {\raisebox{\belowcaptionskip}{\tablename\ \thetable{} --
665 % continued from previous page}} \\
666 % \toprule
667 % \normalfont
668 % Modifier Syntax & Description \\
669 % \midrule
670 % }%
671 % \tabletail{%
672 % \bottomrule
673 % ^^A\multicolumn{2}{r}{Continued on next page}\\
674 % }
675 % \tablelasttail{%
676 % \bottomrule
677 % }
678 % \def\Example#1{\def\@tempa{#1}\@onelevel@sanitize\@tempa
679 % \hbox{\emph{E.g.:} `\hbox{\texttt{\@tempa}}' $\to$ \texttiming{#1}}}
680 % \begin{supertabular}{>{\ttfamily}l>{\raggedright\arraybackslash}p{.85\textwidth}}
681 % D\{\}D & Produces transition between two data values. \Example{D{}D} \\
682 % D\{\meta{Text}\} & Adds \meta{text} into a data signal using a node.
683 % \Example{D{A}D{B}} \\
684 % D\{[\meta{\scriptsize
685 % \raisebox{-1ex}{\shortstack{TikZ\\Settings}}}]\meta{Text}\} & Adds \meta{text}
686 % using the given node \meta{settings}. \Example{D{[blue]A}} \\
687 % \meta{\small number}\meta{\small character} & Sets width of next signal to
688 % given number. Half of it if character is in lower case.
689 % \Example{2.6H5.2l}\\
690 % \meta{\small integer}\{\meta{\small characters}\} & Repeats the given
691 % characters \texttt{\meta{int}} times. \Example{5{hl}}\\
692 % \{ \meta{\small characters} \} & Encloses characters in a local scope. Options inside are only
693 % local to the scope. This also applies to the effect of `\texttt{;}' and similar modifiers.
694 % \Example{H {[blue] LH} L}\\
695 % \midrule
696 % \meta{\small number}B & Su\underline{b}tracts the given number from the width
697 % of the next character. ``\textit{\texttt{B}ackwards}''
698 % \Example{H.5BL}\\
699 % \meta{\small number}F & Adds the given number to the width of the next
700 % character. ``\textit{\texttt{F}orwards}'' \Example{H.5FL}\\
701 % N\oarg{\tiny Settings}\parg{\tiny Name}\marg{\tiny Content} & Adds node at
702 % current position. All three arguments are optional. \Example{H N(a1) L}\\
703 % \midrule
704 % {}[\meta{TikZ Keys}] & Executes given TikZ settings during the drawing
705 % process. This settings will be re-executed when the internal drawing path is renewed which
706 % can cause side-effects. \Example{H[blue]LH} \\
707 % {}[|\meta{TikZ Keys}|] & Executes given TikZ settings during the drawing
708 % process like \texttt{[ ]} but does not re-executes them.
709 % {\Example{D{.} [|/utils/exec={\def\m{...}}|] D{.} D{.}}} \\
710 % {}[!\meta{TikZ Keys}!] & Executes given TikZ settings during the
711 % \emph{parsing} process. Because this makes only sense for internal settings
712 % the default path is `\texttt{/tikz/timing}', not `\texttt{/tikz}' like in all
713 % other settings macros. \Example{H[!wscale=2.5!]LH} \\
714 % {}[[\meta{TikZ Keys}]] & Executes given TikZ settings first during the
715 % parsing process and again during the drawing process. This is for settings
716 % which are needed for width calculations and again for the drawing code, \eg
717 % the slope values. \Example{H[[timing/slope=.5]]L $\slope$H} \\
718 % \midrule
719 % !\{\meta{code}\} & Places given code into the internal \envv{tikzpicture}.
720 % See Example~\ref{exa:adv}. \\
721 % @\{\meta{code}\} & Executes the given code immediately during the parsing
722 % process. This can be used to change parsing parameters. To execute code during
723 % the drawing process use \verb+[|/utils/exec=+\meta{code}\verb+|]+ instead.
724 % \Example{L @{\setwscale{2}} H} \\
725 % \texttt{\$}\meta{math expression}\texttt{\$} & Takes a valid \texttt{pgfmath}
726 % expression (See \pkg{pgf} manual), evaluates it and places the result back in
727 % the input string so it can be used as width for the next character. The macros
728 % \cs{slope}=\cs{lslope}, \cs{dslope}, \cs{zslope} and \cs{wscale} can be used
729 % to access the corresponding values. \Example{D{} $ \dslope $ D{} D} \\
730 % \midrule
731 % ; & Renews the internal drawing path which ends the scope of all options
732 % given by \texttt{[\,]}. \Example{H;[blue]L;H} \\
733 % , & Same as `\texttt{;}', but timing specific options (atm.: slopes and line
734 % width) are restored for the new path. \Example{[line width=1pt]L,H;L} \\
735 % \end{supertabular}
736 % \endgroup
737 % \MakeShortVerb{\|}
738 %
739 % \clearpage
740 % \section{Macro for use in Text Mode}
741 % \vspace{-\bigskipamount}%
742 % \DescribeMacro\texttiming[<initial~character/TikZ Settings>]{<characters>}
743 % This macro places a single timing diagram line into the current text. The
744 % signals have the same height as a uppercase letter (like `X') of the current
745 % font, \ie they scale with the font size.
746 % The macro argument must contain only valid logic characters and modifiers
747 % which define the logical levels of the diagram line.
748 %
749 % An initial character can be given as an optional argument. No logic level will
750 % be drawn for this character. Instead it will be used to define the initial
751 % position of the signal so that the diagram line will start with a transition
752 % from the initial to the first character. However, if the optional argument
753 % holds more than a single character it is taken as TikZ settings for the
754 % diagram. The initial character can then be given using the key
755 % `|timing/initchar=|\meta{char}'.
756 %
757 % \par\medskip\noindent
758 % \begin{minipage}{\textwidth}\noindent
759 % \textit{Examples:}\\*[\smallskipamount]\hspace*{\parindent}%
760 % \begin{minipage}{\textwidth-4\parindent}
761 % \small |\texttiming{HLZDZLH}|^^A
762 % \phantom{\texttt{[L]}} gives `\texttiming{HLZDZLH}', with grid:
763 % `{\let\texttimingbefore\texttiminggrid\texttiming{HLZDZLH}}'.\\
764 % |\texttiming[L]{HLZDZLH}| ^^A
765 % gives `\texttiming[L]{HLZDZLH}', with grid:
766 % `{\let\texttimingbefore\texttiminggrid\texttiming[L]{HLZDZLH}}'.\\
767 % |\texttiming[green]{HLZDZLH}| ^^A
768 % gives `\texttiming[green]{HLZDZLH}'\\
769 % |\texttiming[green,timing/initchar=L]{HLZDZLH}| ^^A
770 % gives `\texttiming[green,timing/initchar=L]{HLZDZLH}'
771 % \end{minipage}
772 % \end{minipage}
773 %
774 % \DescribeMacro\texttimingbefore!{\hspace{2em}\textbf{Deprecated!}\hspace{8em}(\emph{defaults to}: \meta{empty})}!
775 % \DescribeMacro\texttimingafter!{\hspace{2.5em}\textbf{Deprecated!}\hspace{8em}(\emph{defaults to}: \meta{empty})}!
776 % This two macros are executed before and after every timing diagram line
777 % created by \cs{texttiming} macro inside the same \envv{tikzpicture}
778 % environment and can be used to add drawing macros. The argument of the
779 % \cs{texttiming} macro is already processed before any of these macros are
780 % expanded, therefore this macros can access the width of the diagram.
781 %
782 % These macros should not be used directly in newer code but instead the new
783 % TikZ styles "timing/before text" and "timing/after text". For backward
784 % compatibility these styles default to the two macros.
785 %
786 % {\small
787 % (Deprecated) Example: |\let\texttimingbefore\texttiminggrid| adds a grid into the
788 % background of the \cs{texttiming} diagram.}
789 %
790 % \DescribeMacro\texttiminggrid!\hspace{2.5em}\textbf{Deprecated!}!
791 % This macro should only be used inside \cs{texttimingbefore} or
792 % \cs{texttimingafter} and draws a grid of the full size of the
793 % \cs{texttiming} diagram.
794 % For newer code the TikZ styles "timing/draw grid" and "timing/no grid"
795 % should be used instead, \eg
796 % |\tikzset{timing/intext/.append style={timing/draw grid}}| or simply enable the grid globally
797 % for all in-text and other timing diagrams with |\tikzset{timing/draw grid}|.
798 %
799 %
800 % \newpage
801 % \section{Macro for use inside TikZ-Pictures}
802 %
803 % \DescribeMacro\timing[<TikZ Keys>]~'at'~(<TikZ Coordinate>)~{[<initial character>]<characters>}';'
804 % This macro does the same as \cs{texttiming} but is designed to be used inside
805 % a \envv{tikzpicture} environment and only there. Like normal TikZ macros
806 % (\css{path}, \css{drawn}, \css{node}) it allows an optional argument with TikZ
807 % settings and an optional TikZ-coordinate. However, a own argument parser, not
808 % the one used by TikZ, is used to detect and read these optional arguments.
809 % Therefore the order of the arguments is mandatory and must not be reversed.
810 % This small limitation might be overcome in future versions of this package.
811 %
812 % Please note that the optional initial character may be given \emph{inside} and
813 % at the very start of the mandatory argument, not before it. This is necessary
814 % because of several technical reasons.
815 %
816 % Example: |\tikz \timing [green] at (1,2) {HLZDZLH};|\phantom{\texttt{[L]}}
817 % gives `\tikz \timing [green] at (1,2) {HLZDZLH};'.
818 %
819 % Example: |\tikz \timing [green] at (1,2) {[L]HLZDZLH};| gives `\tikz \timing
820 % [green] at (1,2) {[L]HLZDZLH};'.
821 %
822 % \ifprintversion\else
823 % \clearpage
824 % \fi
825 % \subsection*{Timing Shape Anchors}\label{sec:timingshape}
826 % Every timing diagram line produced by \cs{timing}, which includes the rows in
827 % \env{tikztimingtable}, is also a PGF shape (node) with several anchors. These
828 % are shown in Figure~\ref{fig:shape}.
829 % The shape is very similar to the standard |rectangle| shape but does not
830 % provide a |text| anchor. In addition to the standard points of the compass
831 % anchors of TikZ the three logic levels |low|, |mid| and |high| can be used in
832 % combination with |start|, |mid| and |end|. An extra |origin| anchor is
833 % located at the lower left, also called |south west| corner where the diagram
834 % originates. The two anchors called |start| and |end| are provided to mark the
835 % start and end of the timing signal. There are either located at the low,
836 % middle or high logic level dependent on the used first (or initial) and last
837 % timing character.
838 %
839 % In order to use the timing node it has to be named which can be done using the
840 % `\texttt{name=\meta{name}}' option inside the optional argument. The rows of a
841 % \env{tikztimingtable} are automatically named as `|row|\meta{row number}'
842 % where the first row has the number 1.
843 %
844 % ^^AFurther details how to use a shape inside a TikZ or PGF picture can be
845 % ^^Afound in the PGF manual Section~15 and~59, respectively.
846 %
847 % \begin{figure}
848 % \centering
849 % \resizebox{\textwidth}{!}{%^^A
850 % \begin{tikzpicture}[timing,y=1.5cm,x=1.5cm,timing/slope=0]
851 % \timing [y=1.5cm,x=1.5cm,gray,thick] at (0,0) {HLHLHL};
852 % \node[name=s,shape=tikztiming@shape,anchor=origin] at (0,0) {};
853 % \foreach \anchor/\placement in
854 % {north west/above left, north/above, north east/above right,
855 % west/left, center/right, east/right,
856 % mid west/right, mid/left, mid east/left,
857 % base west/left, base/left, base east/above right,
858 % south west/below left, south/below, south east/below right,
859 % low start/below right, mid start/below right, high start/above right,
860 % low mid/above right, high mid/right,
861 % low end/below left, mid end/below left, high end/above left,
862 % start/left, end/right, origin/right}
863 % \draw[shift=(s.\anchor)] plot[mark=x] coordinates{(0,0)}
864 % node[\placement] {\tiny\texttt{(s.\anchor)}};
865 % \end{tikzpicture}%^^A
866 % }
867 % \caption[Timing Shape Anchors]{Timing Shape Anchors. The \texttt{start} and
868 % \texttt{end} anchors mark the start and end of the timing
869 % signal.}\label{fig:shape}
870 % \end{figure}
871 %
872 %
873 % \clearpage
874 % \section{Table for Timing Diagrams}
875 % \begin{DescribeEnv}{tikztimingtable}[<TikZ settings for whole table>]\relax
876 % \MacroArgs {<Signal Name>}~~'&'~~[<{\small Init.~Char./TikZ Keys for Row}>] <Characters> ~~'\\' \\
877 % \dots\\
878 % \hspace*{-1em}\Macro\extracode~~'% Optional' \\
879 % <additional code>
880 % \end{DescribeEnv}
881 % This environment can be used to typeset multi-line timing diagrams. The
882 % syntax is like the one for a \envv{tabular} environment with two columns. The
883 % first column is for the signal name and the second one are the logic
884 % characters which would be placed inside the argument of a \cs{texttiming} or
885 % \cs{timing} macro.
886 % If the second column starts with an optional argument it is either taken as
887 % initial character if it holds only a single character or as row wide settings
888 % otherwise.
889 % The whole table will be drawn inside a \envv{tikzpicture} environment using
890 % multiple \cs{timing} and \cs{node} macros for the timing signals and their
891 % names, respectively. Additional \pkg{tikz} drawing code can be insert at the
892 % end of the table using \cs{extracode}.
893 %
894 % \DescribeMacro\extracode[TikZ Keys]
895 % This macro is only defined inside a \env{tikztimingtable} environment. In earlier
896 % versions of this package it could only be used after the last table line (\ie after a |\\|).
897 % If used there all code between it and the |\end{tikztimingtable}| will be placed inside the same
898 % \envv{tikzpicture}. This allows to add some drawing lines or a grid to the
899 % picture. The macro does \emph{not} start a TikZ |scope| or a \TeX\ group by itself.
900 % The optional \meta{settings} therefore affect all following code until the end of the picture.
901 %
902 % It is also possible to draw something behind the timing diagram by
903 % using using the \env{background} environment or the PGF background layer:\\[\smallskipamount]
904 % |\begin{pgfonlayer}{background}|\ldots|\end{pgfonlayer}|
905 %
906 % \DescribeMacro\endextracode
907 % From\NewIn{v0.7} version 0.7 on it is possible to add further timing rows after an |extracode| section by using
908 % \cs{endextracode}. Everything after this macro is taken as part of a new row. It is allowed to use
909 % this macro direct before \cs{end}\env{tikztimingtable}. This makes it possible to use \cs{extracode}
910 % anywhere inside the table, including at the very start before any rows are processed. Early
911 % insertion of extra code is necessary for \eg limiting the bounding box or setting up a clipping path.
912 %
913 % \DescribeEnv[<extra drawing code>]{extracode}[<TikZ settings>]
914 % Instead\NewIn{v0.7} of using \cs{extracode} \dots \cs{endextracode}, which is actual plain\TeX\ syntax, this
915 % \LaTeX\ style environment can be used. Like any environment it creates a \TeX\ group around its
916 % content, but no TikZ |scope| is created to allow drawing code (\eg clipping paths) to affect the
917 % rest of the table. The optional \meta{settings}, however, only affect the environment content.
918 %
919 % Please note that while \Macro\endextracode is optional if \Macro\extracode is used at the end of the table,
920 % a \Macro\begin{extracode} must always be closed by \Macro\end{extracode}.
921 %
922 % \subsection*{Macros for \cs{extracode} Section}
923 % The following macros are only defined inside a \env{tikztimingtable} after the
924 % macro \cs{extracode}. They are useful for drawing additional material.
925 %
926 % \DescribeMacro\tablegrid*[<TikZ Keys>]
927 % After \css{extracode} this macro draws a grid in the background of the table.
928 % A separate grid is drawn for each row. The normal version draws all grids with
929 % the width of the widest row while the star version draws them with the width
930 % of the corresponding row. Because this macro draws material into the |background|
931 % layer it must not be placed inside a |pgfonlayer| environment itself.
932 %
933 % \DescribeMacro\fulltablegrid[<TikZ Keys>]
934 % After \css{extracode} this macro draws a big grid over all rows in the
935 % background of the table.
936 %
937 % \DescribeMacro\nrows
938 % Returns the number of rows in the current table. Useful for use in
939 % \cs{horlines}.
940 %
941 % \DescribeMacro\rowdist
942 % \DescribeMacro\coldist
943 % This macros return the row and column distance. There are useful for drawing
944 % additional material relative to the rows and columns. This values can be set
945 % (\eg in the optional argument of the table) using the \texttt{timing/rowdist}
946 % and \texttt{timing/coldist} settings which are explained in
947 % Section~\ref{sec:styles}.
948 %
949 % \DescribeMacro\twidth
950 % Returns the width (as multiple of the `period width') of the longest timing
951 % diagram line in the table. Example: If the longest line would be
952 % "H 2.3L z" than \cs{twidth} would be $1+2.3+0.5=3.8$.
953 %
954 % \DescribeMacro\horlines[<TikZ Keys>]{<list>}
955 % Draws horizontal lines, optionally with the given \meta{Settings}, at the base
956 % line of the rows given by \meta{list}. The PGF macro
957 % \css{foreach}\footnote{See the \texttt{pgf} manual for more details.} is
958 % internally used so the list can include not only row numbers as integer but
959 % also fractional numbers and the "..." operator to auto-increment the
960 % numbers. Please note that all numbers in the list are multiplied by
961 % \cs{rowdist}.
962 % If the list is empty the default "1,2,...,\nrows" is used which draws lines
963 % for all rows.
964 %
965 % \DescribeMacro\vertlines[<TikZ Keys>]{<list>}
966 % Like \cs{horlines} but draws vertical lines and the listed numbers a relative
967 % to the basic width.
968 % If the list is empty the default "0,1,...,\twidth" is used which draws lines
969 % after every period width.
970 %
971 % \DescribeMacro\tableheader[<TikZ Keys>]{<Description Title>}{<Signal Title>}
972 % This macro adds a table head row on top of the table. The two mandatory
973 % arguments provide the header text for the description and signal columns.
974 %
975 % \DescribeMacro\tablerules[<TikZ Keys>]
976 % This macro adds top and bottom rules to the table in the same (or at least
977 % very similar) way as the \texttt{booktabs} package is doing it for normal
978 % \texttt{tabular}s. The current bounding box is used to calculate the needed
979 % rule length, which makes this macro position dependent if further code
980 % changes the bounding box. If the \cs{tableheader} macro was used beforehand it
981 % also draws a thinner horizontal line (like \texttt{booktabs} \cs{midrule})
982 % between the table head and body.
983 %
984 % \DescribeEnv[<drawing commands>]{background}[<TikZ Keys>]
985 % This environment can be used to draw material on the |background| layer and is
986 % an abbreviation for:\\[\medskipamount]
987 % | \begin{pgfonlayer}{background}|\\
988 % | \begin{scope}|\oarg{TikZ Keys}\\
989 % | |\meta{drawing commands}\\
990 % | \end{scope}|\\
991 % | \end{pgfonlayer}|
992 %
993 % \subsection*{Scaling the Table}
994 % The standard "scale" setting of TikZ will not scale all parts of the table correctly,
995 % \eg the line width and nodes will keep their original size. However there are scaled
996 % relative to the font size (which needs to be set using \texttt{timing/font}).
997 % If the timing diagrams should be scaled the keys \texttt{timing/unit}, \texttt{timing/xunit} and/or
998 % \texttt{timing/yunit} can be used.
999 %
1000 % Alternatively the table can be scaled using the
1001 % \cs{scalebox}\marg{factor}\marg{content} macro from the \pkg{graphicx} package or
1002 % be placed inside a scaled \cs{node} inside another \env{tikzpicture} environment.
1003 %
1004 % \subsection*{Positions \& Nodes inside the Table}
1005 %
1006 % \subsubsection*{Coordinates}
1007 % The first row starts at $y=0$ and the next rows are each
1008 % |-1*\rowdist| lower than the previous one.
1009 % The vertical unit is 1 \textsf{signal height} and the default row distance is
1010 % `2' (=$2\times$\textsf{signal height}). This means that a normal table with
1011 % three rows goes from $y=+1$ (base line at 0 + 1 \textsf{signal height}) to
1012 % $y=-4$ (first row:~+0, second row:~-2, third row:~-4). This are relative to
1013 % the middle of the drawn lines, \ie the bounding box is
1014 % $2\times\frac{\text{\textsf{line width}}}{2}=1\times $\textsf{line width}
1015 % higher.
1016 %
1017 % The timing column starts at $x=0$ and goes into the positive range while
1018 % scaled using the period width. Example: |HHHh| has a width of 3.5.
1019 % The label column starts at $x=-$|\coldist| and the text is right align with
1020 % the right border at this position.
1021 % See Figure~\ref{fig:distnodestable} for an illustration.
1022 %
1023 % \subsubsection*{Nodes}
1024 % Each timing line is a timing node (see section~\ref{sec:timingshape})
1025 % labeled (not fully correctly) as `|row|\meta{number}', where the first row has the number 1 and the last
1026 % one the number provided in \cs{nrows}, but can also accessed using the alias "last row".
1027 % The corresponding labels are normal rectangle nodes named "label0", "label1", \dots,
1028 % `|label|\cs{nrows}'/"last label".
1029 %
1030 % Both groups of `rows' and `labels' are enclosed in a rectangle node called "all rows" and
1031 % "all labels", respectively. These nodes can be used to draw material relative to the rows,
1032 % \eg the macros \cs{tableheader} and \cs{tablerules} are making use of them.
1033 % The headers added by \cs{tableheader} are rectangle nodes names "label header" and "row header"
1034 % and are placed between the x-coordinates of the inner and outer border of "all labels" and "all rows"
1035 % respectively. By default the TikZ settings "pos=0" and "anchor=base east"/"anchor=base west", respectively,
1036 % are applied to place them in the inner border, but this
1037 % can be changed using the styles "timing/table/header" and/or "timing/table/label header"/"timing/table/row header".
1038 % All nodes are shown in Figure~\ref{fig:distnodestable}.
1039 %
1040 %
1041 % \begin{figure}
1042 % \centering
1043 % \scalebox{1.15}{\Huge
1044 % \begin{tikztimingtable}[semitransparent]
1045 % First Row & H L H L H L \\
1046 % Second Row & H L H L H L \\
1047 % $\vdots$\hspace*{2em} & 3S N[rectangle,above,inner sep=0pt]{$\vdots$} 3S \\
1048 % Last Row & H L H L H L \\
1049 % \begin{extracode}
1050 % \tableheader[draw=black,densely dashed,thin]{Label}{Timing}
1051 % \tablerules
1052 % \useasboundingbox (current bounding box.south west) rectangle (current bounding box.north east);
1053 % \begin{background}[black,densely dashed,thin,opacity=1]
1054 % \normalsize
1055 % \draw (row1.north west) rectangle (row1.south east);
1056 % \draw (row2.north west) rectangle (row2.south east);
1057 % \draw (last row.north west) rectangle (last row.south east);
1058 % \node [right] at (row1.east) {row1};
1059 % \node [right] at (row2.east) {row2};
1060 % \node [right] at (last row.east) {row\cs{nrows}};
1061 % \node [below right] at (last row.east) {last row\large\strut};
1062 %
1063 % \path let \p1 = (label header.west), \p2 = (row header.east), \p3 = (all labels.west), \p4 = (all rows.east) in
1064 % node [left] at (\x3,\y1) {label header}
1065 % node [right] at (\x4,\y2) {row header}
1066 % ;
1067 % \begin{scope}[solid,semithick,black!80]\tiny
1068 % \draw [|->] let \p1 = (label header.south east), \p2 = (all labels.west) in
1069 % (\x1+.5\pgflinewidth,\y1-2pt) node [below left=-.4ex] {0}
1070 % -- node [below=-.4ex,midway] {pos} (\x2,\y1-2pt) node [below right=-.4ex] {~\rlap{1}}
1071 % ;
1072 % \draw [|->] let \p1 = (row header.south west), \p2 = (all rows.east) in
1073 % (\x1-.5\pgflinewidth,\y1-2pt) node [below right=-.4ex] {0}
1074 % -- node [below=-.4ex,midway] {pos} (\x2,\y1-2pt) node [below left=-.4ex] {\llap{1}\,~}
1075 % ;
1076 % \end{scope}
1077 %
1078 % \draw [dotted,color=green] (all rows.south west) rectangle (all rows.north east);
1079 % \node [below right,green] at (all rows.east) {all rows};
1080 %
1081 % \draw (label1.north west) rectangle (label1.south east);
1082 % \draw (label2.north west) rectangle (label2.south east);
1083 % \draw (last label.north west) rectangle (last label.south east);
1084 % \path let \p1 = (label1.west), \p2 = (label2.west), \p3 = (last label.west), \p4 = (all labels.west) in
1085 % node [left] at (\x4,\y1) {label1}
1086 % node [left] at (\x4,\y2) {label2}
1087 % node [left] at (\x4,\y3) {label\cs{nrows}}
1088 % node [below left] at (\x4,\y3) {last label\large\strut}
1089 % ;
1090 %
1091 % \draw [dotted,color=green] (all labels.south west) rectangle (all labels.north east);
1092 % \node [below left,green] at (all labels.west) {all labels};
1093 %
1094 % \begin{scope}[help lines]
1095 % \draw (all rows.north west) -- +(0,3.25);
1096 % \draw (all rows.north east) -- +(0,3.25);
1097 % \draw (all labels.north west) -- +(0,3);
1098 % \draw (all labels.north east) -- +(0,3);
1099 % \end{scope}
1100 %
1101 % \begin{scope}[solid,thick]
1102 % \draw [fill] (0,0) circle (1pt) node [below right=-2pt] {\tiny origin};
1103 % \draw [>=stealth,->] (-.25,0) -- (.4,0);
1104 % \draw [>=stealth,->] (0,-.25) -- (0,.4);
1105 % \end{scope}
1106 %
1107 % \begin{scope}[dotted,gray]
1108 % \draw (row1.south west) -- (label1.base west);
1109 % \end{scope}
1110 %
1111 % \begin{scope}[solid]
1112 % \draw (row1.north east) -- ++(5em,0) coordinate (O) -- +(5pt,0);
1113 % \draw (row1.south east) -- ++(5em,0) coordinate (A) -- +(5pt,0);
1114 % \draw (row2.south east) -- ++(5em,0) coordinate (B) -- +(5pt,0);
1115 % \draw [<->] (A) -- node[midway,right] {\cs{rowdist}} (B);
1116 % \draw [<->] (O) -- node[midway,right] {\cs{yunit}} (A);
1117 %
1118 % \draw (row1.south east) -- ++(0,1.5) coordinate (A) -- +(0,5pt);
1119 % \draw (row1.south east) ++(-1,1) -- ++(0,0.5) coordinate (B) -- +(0,5pt);
1120 % \draw [<->] (B) -- (A) node[right] {\cs{xunit}};
1121 %
1122 % \draw (row1.north west) -- ++(0,7em) coordinate (A) -- +(0,5pt);
1123 % \draw let \p1 = (row1.north west), \p2 = (label1.north east) in
1124 % (\x2,\y2) -- (\x2,\y1+7em) coordinate (B) -- +(0,5pt);
1125 % \draw [<->] (B) -- (A) node[right] {\cs{coldist}};
1126 % \end{scope}
1127 % \end{background}
1128 % \end{extracode}
1129 % \end{tikztimingtable}%^^A
1130 % }%^^A
1131 % \caption{Distances and Nodes inside a \env{tikztimingtable}}\label{fig:distnodestable}
1132 % \end{figure}
1133 %
1134 % \clearpage
1135 % \section{Macros for use inside the Character String}\label{sec:maccharstr}
1136 % The modifiers "@" and `\texttt{\$}' allow the user to include macros. These
1137 % macros are evaluated when the |tikz-timing| parser encounters them in the
1138 % input character string, \ie before any diagram element is drawn or any single
1139 % bracket "[ ]" options are processed. Therefore their values should be set
1140 % either outside the |tikz-timing| diagram or with the "[! .. !]" or
1141 % "[[ .. ]]" option blocks.
1142 %
1143 % The following macros are provided for the user.
1144 %
1145 % \DescribeMacro\tikztimingsetwscale{<math expression>}
1146 % \DescribeMacro\setwscale{<math expression>}
1147 % This macro\NewIn{v0.7}, which can be called |\setwscale| for short inside modifier code,
1148 % sets the |wscale| value. This value is used during the parsing process to
1149 % scale the width of the characters, \eg |wscale=3.2| makes |1H| as long as
1150 % |3.2H| normally would be. Slopes are not affected, but the `width' values of
1151 % meta-characters are. It can also be set with the |timing/wscale| TikZ setting.
1152 % The current value can be accessed using \cs{wscale}.
1153 %
1154 % \DescribeMacro\wscale
1155 % Returns the current width scaling "wscale" value.
1156 %
1157 % \DescribeMacro\xunit
1158 % \DescribeMacro\yunit
1159 % This dimension registers can be used to access the x- and y-unitlength of the timing diagram.
1160 % Assignments to these registers do not change the scaling!
1161 %
1162 % \DescribeMacro\slope
1163 % \DescribeMacro\lslope!\hspace{.6em}\small(alias)!
1164 % Returns the current logic slope, \ie the slope between |L| and |H|
1165 % levels.
1166 % Set by the |timing/lslope| or indirectly by the |timing/slope| TikZ setting.
1167 % See Table~\ref{tab:styles} for more information.
1168 %
1169 % \DescribeMacro\zslope
1170 % Returns the current Z slope. Set by the |timing/zslope| or indirectly by the
1171 % |timing/slope| TikZ setting.
1172 %
1173 % \DescribeMacro\dslope
1174 % Returns the current Z slope. Set by the |timing/dslope| or indirectly by the
1175 % |timing/slope| TikZ setting.
1176 %
1177 % \subsection*{Examples:}
1178 % Changing the slope and using its value to calculate the width of a
1179 % character:\\
1180 % |\texttiming{ HLHLHL [[timing/slope=.5]] H $\slope$L }|\\
1181 % gives:
1182 % {\texttiming{ HLHLHL [[timing/slope=.5]] H $\slope$L }}
1183 % \\*[\smallskipamount]
1184 % Changing the width scaling for a curtain group of characters:\\*
1185 % |\texttiming|\ignorespaces
1186 % |{ HL [!wscale=\wscale/3!] 3D{a} Z D Z [!wscale=3*\wscale!] HL }|\\*
1187 % gives:
1188 % {\texttiming{ HL [!wscale=\wscale/3!] 3D{a} Z D Z [!wscale=3*\wscale!] HL }}
1189 %
1190 % \clearpage
1191 % \section{Meta-Characters}
1192 % It is possible to define recurring groups of characters and modifiers as so
1193 % called \emph{meta-characters}. These characters are than expanded to the group
1194 % whenever they appear inside the character list. Please note that like for
1195 % groups a numeric factor before such a meta-character is taken as a repetition
1196 % factor not as a width. The meta-character is case sensitive and the other case
1197 % is not affected by the definition, \ie the lower- and uppercase versions of
1198 % one character can have complete different meanings. It is possible to redefine
1199 % normal characters (only one or both cases) as meta-characters, which
1200 % suppresses its normal meaning. Using the meta-character in its own definition
1201 % group causes a infinite loop which will lead to an \TeX\ error.
1202 %
1203 % \DescribeMacro\tikztimingmetachar{<Meta-Character>}[<Number of arguments>]{<Character Group>}
1204 % This macro defines the given \meta{meta-character} to be identical to the
1205 % given \meta{character group}. Alternatively this can also be done using the
1206 % TikZ style `|timing/metachar=|\marg{Meta-Character}\oarg{Number of
1207 % arguments}\marg{Character~Group}'.
1208 %
1209 % An empty group deletes the meta-character, which might be necessary in cases
1210 % when normal characters are temporary redefined as meta-characters. However, if
1211 % the group only contains spaces the meta-character is practically ignored.
1212 %
1213 % Because the meta-character is simply expanded to its character list, the first
1214 % character of this list might be combined with identical characters placed before the meta-character.
1215 % For example, after a meta-character "Y" got defined as "2D{A} 2D{B}" the characters "DY" will first be expanded to
1216 % "D2D{A} 2D{B}" and then combined to "3D{A} 2D{B}". This might not be the wanted behaviour and can be avoided by terminating the leading "D" with
1217 % its own braces: "D{}Y".
1218 %
1219 % \subsection*{Meta-Characters with Arguments}
1220 % The\NewIn{v0.7}
1221 % replacement text of meta-character can now include macro arguments.
1222 % This allows the creation of more complex and flexible meta-characters. The
1223 % optional argument \meta{Number of arguments} selects the number of macro
1224 % arguments in the same way it does for \cs{newcommand}. However, the first
1225 % argument |#1| is always set to the given `width' of the meta-character, \ie
1226 % the number value preceding it. All further arguments are read as normal for
1227 % macros from the text after the meta-character. It is recommended to enclose
1228 % them in braces.
1229 %
1230 % The default behaviour of meta-character without arguments is, as mentioned
1231 % above, to repeat the replacement group by the preceding number (`width'). This
1232 % is now archived by defining them internally as `|#1|\marg{Character Group}',
1233 % which creates a repetition group. Users which want to include an own argument
1234 % but still want to repeat the group need to define a meta-character with at
1235 % least two arguments and define it as "#1{ .. #2 .. }". If the repetition is
1236 % not wanted the |#1| argument can be used as a real width for one or more group
1237 % internal characters: "{Y}[1]{Z #1D Z}", so "4Y" will give "Z 4D Z"
1238 % instead of "4{Z D Z}".
1239 %
1240 % Also the modifier "@" (see Table~\ref{tab:modifiers}) together with the
1241 % \cs{setwscale} macro can be used to scale the whole group dependent on the
1242 % first argument:\\
1243 % "{Y}[1]{ @{\setwscale{#1*\wscale}} Z 2D Z @{\setwscale{\wscale/#1}} }", so
1244 % "4Y" is equivalent to "4Z 8D 4Z".
1245 %
1246 % The new `\texttt{\$}' modifier can be used to calculate the width of the group
1247 % characters: |{Y}[1]{$#1/3$D{A} $#1/3$D{B} $#1/3$D{C}}|, so "4Y" results in
1248 % "1.333D{A} 1.333D{B} 1.333D{C}".
1249 %
1250 %
1251 % \bigskip
1252 % \noindent
1253 % \textit{Examples:}\\*[\medskipamount]
1254 % |\tikztimingmetachar{Y}{2D 0.5U 2D{}} \texttiming{ZZ Y Z 3Y ZZ}|\\
1255 % gives:
1256 % {\tikztimingmetachar{Y}{2D 0.5U 2D{}} \texttiming{ZZ Y Z 3Y ZZ}}
1257 % \\[\bigskipamount]
1258 % |\tikztimingmetachar{Y}{2D{Text}} \tikztimingmetachar{y}{1D{\tiny Text}}|
1259 % |\texttiming{ZZ Y Z 3y ZZ}|\\
1260 % gives:
1261 % {\tikztimingmetachar{Y}{2D{Text}} \tikztimingmetachar{y}{1D{\tiny Text}}
1262 % \texttiming{ZZ Y Z 3y ZZ}}
1263 % \\[\bigskipamount]
1264 % \DeleteShortVerb{\|}
1265 % \MakeShortVerb{\`}
1266 % `\newcounter{mycount}`\\
1267 % `\tikztimingmetachar{Q}{2D{\stepcounter{mycount}\arabic{mycount}}}`\\
1268 % `\tikztimingmetachar{R}{[| /utils/exec=\setcounter{mycount}{0} |]}`\\
1269 % `\texttiming{ 5Q R 3Q R 10Q }`\\
1270 % gives:
1271 % {\newcounter{mycount}%
1272 % \tikztimingmetachar{Q}{2D{\stepcounter{mycount}\arabic{mycount}}}%
1273 % \tikztimingmetachar{R}{[| /utils/exec=\setcounter{mycount}{0} |]}%
1274 % \texttiming{ 5Q R 3Q R 10Q }}
1275 % \DeleteShortVerb{\`}
1276 % \MakeShortVerb{\|}
1277 % \\[\bigskipamount]
1278 % Redefining the glitch "G" character:\\
1279 % |\tikztimingmetachar{G}{.1T.1T .2B} \tikztimingmetachar{g}{.1T.1T}|\\
1280 % |\texttiming{ 10{H G L G} H } % With correction of width `.2B'|\\
1281 % |\texttiming{ 10{H g L g} H } % Without correction|\\
1282 % |\texttiming{ 10{H L } H } % For comparison|\\
1283 % gives:\\
1284 % {\let\texttimingbefore\texttiminggrid
1285 % \tikztimingmetachar{G}{.1T.1T .2B} \tikztimingmetachar{g}{.1T.1T}%
1286 % \texttiming{ 10{H G L G} H }\\
1287 % \texttiming{ 10{H g L g} H }\\
1288 % \texttiming{ 10{H L } H }}
1289 % \\[\bigskipamount]
1290 % |\tikztimingmetachar{J}[2]{ 1.8D{#2} .2D{} }|\\
1291 % |\texttiming{ D{} J{A} J{B} J{C} D }|\\
1292 % gives:
1293 % {\tikztimingmetachar{J}[2]{ 1.8D{\strut #2} .2D{} }%
1294 % \texttiming{ D{} J{A} J{B} J{C} D }}
1295 % \\[\bigskipamount]
1296 % |\tikztimingmetachar{Y}[3]{#1{ D{\strut #2} D{#3} }}|\\
1297 % |\texttiming{ Z 2Y{a}{b} Z 4Y{1}{2} Z}|\\
1298 % gives:
1299 % {\tikztimingmetachar{Y}[3]{#1{ D{#2} D{#3} }}%
1300 % \texttiming{ Z 2Y{a}{b} Z 4Y{1}{2} Z}}
1301 % \\[\bigskipamount]
1302 % |\tikztimingmetachar{Y}[3]{ .2D .2B #1d{\strut #2} .2D .2B #1d{\strut #3} }|\\
1303 % |\texttiming{ Z 2Y{a}{b} Z 4Y{1}{2} Z}|\\
1304 % gives:
1305 % {\tikztimingmetachar{Y}[3]{ .2D .2B #1d{\strut #2} .2D .2B #1d{\strut #3} }%
1306 % \texttiming{ Z 2Y{a}{b} Z 4Y{1}{2} Z}}
1307 % \\[\bigskipamount]
1308 % Mata-chars to set the width scaling. Because the scaling also affects the
1309 % meta-char width (|#1|) argument a compensation is needed to achieve absolute
1310 % values (|W|) instead of relative ones (|w|).\\
1311 % |\tikztimingmetachar{w}[1]{ [! wscale=#1 !] } % relative|\\
1312 % |\tikztimingmetachar{W}[1]{ [! wscale=#1/\wscale !] } % absolute|\\
1313 % |\texttiming{ HL .2w HLHLH 3w LH 1W LH }|\\
1314 % gives:
1315 % {\tikztimingmetachar{w}[1]{ [! wscale=#1 !] }%
1316 % \tikztimingmetachar{W}[1]{ [! wscale=#1/\wscale !] }\\
1317 % \texttiming{ HL .2w HLHLH 3w LH 1W LH }}
1318 %
1319 % \clearpage
1320 % \section{Floating timing diagrams with captions}
1321 % The timing diagrams can also be typeset as floats with (or without) a caption like a |figure|.
1322 % This can be easily achieved by using the \pkg{caption} package as shown in the following example document.
1323 %
1324 % \par\vspace{3\baselineskip}\par
1325 %
1326 % \begin{lstlisting}[gobble=4,language={[latex]tex},frame=single]
1327 % \documentclass{article}
1328 % \usepackage{tikz-timing}
1329 % \usepackage{caption}
1330 %
1331 % \DeclareCaptionType{timingdiag}[Timing diagram][List of Timing Diagrams]
1332 %
1333 % \begin{document}
1334 % \listoftimingdiags
1335 %
1336 % \begin{timingdiag}[!ht]
1337 % \centering
1338 % (timing code)
1339 % \caption{Some timing diagram caption}
1340 % \label{tim:foobar}
1341 % \end{timingdiag}
1342 %
1343 % \end{document}
1344 % \end{lstlisting}
1345 %
1346 %
1347 % \chapter{TikZ Keys for Styles, Settings and Actions}\label{sec:styles}
1348 % TikZ itself uses the |pgfkeys| package to define and apply drawing styles and settings.
1349 % The same method is also used for |tikz-timing| which
1350 % places all of the keys under the ``subdirectory'' "timing" in
1351 % the main ``directory'' `tikz', which is the default when \css{tikzset} is
1352 % used.
1353 % This keys are simply called \emph{TikZ Keys} throughout this manual and
1354 % can be used in all places where \meta{TikZ Keys} is mentioned, while some only make sense at specific
1355 % places.
1356 % Three types of keys
1357 % are used by this package: styles, settings and actions.
1358 %
1359 % Styles simply define the style in which a certain element is drawn, \eg in which color or line width.
1360 % This styles are defined and can be redefined using
1361 % \css{tikzset}|{|\meta{style name}|/.style=|\meta{value}|}|. However, while some styles
1362 % are initial empty, some hold internal settings and therefore user styles should only be added
1363 % using `|.append style=|\meta{value}'.
1364 %
1365 % Settings are TikZ keys which await an argument and set an internal macro or length. They are
1366 % like \cs{setlength} and \cs{renewcommand}. They should only by used as stated and not be redefined like styles as
1367 % shown above.
1368 %
1369 % Action are TikZ keys which perform a drawing or other action on the current element, either directly or
1370 % by en-/disable an internal setting which then in turn triggers the drawing process. Therefore some
1371 % actions can be globally and/or locally but others only make sense if used locally on a single |tikz-timing|
1372 % macro or environment or even a scope inside a \env{tikztimingtable}.
1373 % Action can be very similar to settings but they always execute code instead of only setting/redefining it.
1374 % The actions are defined and can be redefined using
1375 % \css{tikzset}|{|\meta{action name}|/.code=|\meta{code}|}|%
1376 %
1377 % \begingroup
1378 % \def\C{Action}
1379 % \def\S{Style}
1380 % \def\s{Setting}
1381 % \def\en{\,\textsf{--}\,}
1382 %
1383 % \section*{General}
1384 % \begin{tabularx}{\textwidth}{>{\ttfamily}ll>{\raggedright\arraybackslash}X}
1385 % \toprule
1386 % \normalfont TikZ Key & Type & Description \\
1387 % \midrule
1388 % timing & \S & Base settings like signal height and period width.\\
1389 % timing/font=\meta{font commands} & \s & Sets the normal \texttt{font} key and sets \texttt{x}/\texttt{y} keys to 1.6ex.\\
1390 % timing/intext & \S & Used for \cs{texttiming}. Depends on \texttt{timing}.\\
1391 % timing/picture & \S & Usable for own \texttt{tikzpictures} to set timing settings.\\
1392 % timing/inline node & \S & Used for nodes created by the \texttt{N} character. Defaults to \texttt{coordinate}.\\
1393 % timing/every char & \S & Used in the \cs{draw} TikZ command for every drawn timing character.\\
1394 % timing/every bg & \S & Used for every background path of characters like \texttt{D}.\\
1395 % timing/text format=\meta{code} & \s & Sets formatting code for the text of characters like \texttt{D}. The code is placed directly for the text wrapped in braces, so that the code can be a macro awaiting the text as an argument. By default the code is empty.\\
1396 % \midrule
1397 % timing/initchar=\meta{char} & \s & Sets initial character. Only valid as first optional argument in table rows or in \cs{texttiming}.\\
1398 % \midrule
1399 % timing/metachar=\marg{C}\oarg{\#arg}\marg{G}& \s& Sets meta-character \meta{C} to character group \meta{G}.\\
1400 % \midrule
1401 % timing/before & \C & Code executed direct before the timing TikZ code inside the internal
1402 % \cs{tikzpicture}. \\
1403 % timing/after & \C & Code executed direct after the timing TikZ code inside the internal
1404 % \cs{tikzpicture}.\\
1405 % \bottomrule
1406 % \end{tabularx}
1407 %
1408 % \section*{Scaling}
1409 % \begin{tabularx}{\textwidth}{>{\ttfamily}ll>{\raggedright\arraybackslash}X}
1410 % \toprule
1411 % \normalfont TikZ Key & Type & Description \\
1412 % \midrule
1413 % timing/unit=\meta{length expression} & \s & Sets both the x- and y-unitlength. \\
1414 % timing/xunit=\meta{length expression} & \s & Sets the x-unitlength (\texttt{\textbackslash xunit}) for the timing diagrams. \\
1415 % timing/yunit=\meta{length expression} & \s & Sets the y-unitlength (\texttt{\textbackslash yunit}) for the timing diagrams. \\
1416 % timing/font=\meta{code} & \s & Can be used to set font macros. Needs to be used instead of the normal TikZ \texttt{font} as it resets \texttt{unit}
1417 % etc.\ if it is font sized dependent.\\
1418 % timing/wscale=\meta{math expression} & \s & Sets the width-scale \texttt{\textbackslash wscale} by calling \texttt{\textbackslash tikztimingsetwscale}. See section~\ref{sec:maccharstr} for further details. \\
1419 % \bottomrule
1420 % \end{tabularx}
1421 %
1422 % \section*{Slopes}
1423 % \begin{tabularx}{\textwidth}{>{\ttfamily}ll>{\raggedright\arraybackslash}X}
1424 % \toprule
1425 % \normalfont TikZ Key & Type & Description \\
1426 % \midrule
1427 % timing/slope=\meta{0.0\en1.0} & \s & Sets slope for logic transitions. \newline This also sets \texttt{dslope=2*slope}, \texttt{zslope=slope/2}.\\
1428 % timing/lslope=\meta{0.0\en1.0} & \s & Sets slope for logic transitions only. Default: 0.1\\
1429 % timing/dslope=\meta{0.0\en1.0} & \s & Sets slope for data transitions. Default: 0.2\\
1430 % timing/zslope=\meta{0.0\en1.0} & \s & Sets slope for Z transitions. Default: 0.05\\
1431 % \bottomrule
1432 % \end{tabularx}
1433 %
1434 % \section*{Texttiming}
1435 % \begin{tabularx}{\textwidth}{>{\ttfamily}ll>{\raggedright\arraybackslash}X}
1436 % \toprule
1437 % \normalfont TikZ Key & Type & Description \\
1438 % \midrule
1439 % timing/outer sep=\meta{dim} & \s & Sets outer separation around \cs{texttiming} macros. \\
1440 % timing/outer xsep=\meta{dim} & \s & See above. Only X-Coordinate. (Default:~0pt) \\
1441 % timing/outer ysep=\meta{dim} & \s & See above. Only Y-Coordinate. (Default:~0pt) \\
1442 % \midrule
1443 % timing/before text & \C & Code executed direct before the timing TikZ code inside the internal
1444 % \cs{tikzpicture} for \cs{texttiming}. This code is executed just after the \texttt{timing/before} code. Defaults
1445 % to \cs{texttimingbefore}.\\
1446 % timing/after text & \C & Code executed direct after the timing TikZ code inside the internal
1447 % \cs{tikzpicture}. This code is executed just before the \texttt{timing/after} code. Defaults to
1448 % \cs{texttimingafter}.\\
1449 % \bottomrule
1450 % \end{tabularx}
1451 %
1452 % \section*{Grid}
1453 % \begin{tabularx}{\textwidth}{>{\ttfamily}ll>{\raggedright\arraybackslash}X}
1454 % \toprule
1455 % \normalfont TikZ Key & Type & Description \\
1456 % \midrule
1457 % timing/grid & \S & Style used for drawing grids. Depends on \texttt{help lines} and \texttt{timing}. \\
1458 % timing/draw grid & \C & Enables background grids for \cs{timing} macros. \\
1459 % timing/no grid & \C & Disabled background grids for \cs{timing} macros. \\
1460 % \bottomrule
1461 % \end{tabularx}
1462 %
1463 % \section*{Table}
1464 % \begin{tabularx}{\textwidth}{>{\ttfamily}ll>{\raggedright\arraybackslash}X}
1465 % \toprule
1466 % \normalfont TikZ Key & Type & Description \\
1467 % \midrule
1468 % timing/name & \S & Used for the signal name column in \env{tikztimingtable}.\\
1469 % timing/table & \S & Used for \env{tikztimingtable}. Depends on \texttt{timing}.\\
1470 % timing/table/grid & \S & Used for table grid. Depends on \texttt{timing/grid}.\\
1471 % timing/table/lines & \S & Used for \cs{horlines} and \cs{vertlines}. \\
1472 % timing/table/rules & \S & Used for \cs{tablerules} for top and bottom lines. \\
1473 % timing/table/midrules & \S & Used for \cs{tablerules} between table head and body. \\
1474 % timing/table/header & \S & Used for \cs{tableheader}. Defaults to \texttt{timing/name}.\\
1475 % timing/table/label header & \S & Used for label header in \cs{tableheader}. \\
1476 % timing/table/row header & \S & Used for timing row header in \cs{tableheader}. \\
1477 % \midrule
1478 % timing/rowdist=\meta{distance} & \s & Sets (baseline) distance between rows in a tikztimingtable. Default: 2 (=$2\times$signal height)\\
1479 % timing/coldist=\meta{distance} & \s & Sets distance between columns in a tikztimingtable. Default: 1 (=$1\times$period width)\\
1480 % \midrule
1481 % timing/before table & \C & Code placed before the tables TikZ code inside the internal
1482 % \texttt{tikzpicture}.\\
1483 % timing/after table & \C & Code placed after the tables TikZ code at the end of the
1484 % internal \texttt{tikzpicture}.\\
1485 % \bottomrule
1486 % \end{tabularx}
1487 %
1488 % \section*{Character Styles}
1489 % \begin{tabularx}{\textwidth}{>{\ttfamily}ll>{\raggedright\arraybackslash}X}
1490 % \toprule
1491 % \normalfont TikZ Key & Type & Description \\
1492 % \midrule
1493 % timing/\meta{lowercase char} & \s & Style for character \meta{char}. Not used for `\texttt{H}' and `\texttt{L}'. \\
1494 % timing/\meta{lc char}/background & \s & Background style for characters `\texttt{D}' and `\texttt{U}'. \\
1495 % timing/\meta{lc char}/text & \s & Text style for character \meta{char}. Only defined for `\texttt{D}'. \\
1496 % \midrule
1497 % timing/text format=\meta{macros} & \s & Define macros which are placed before the text of `\texttt{D\{text\}}'. The text is enclosed in braces to
1498 % allow the last macro to take it as an argument. A \cs{strut} is a good choice to ensure a common baseline.\\
1499 % \bottomrule
1500 % \end{tabularx}
1501 %
1502 % \section*{Debug}
1503 % Some debug settings for users (first group) and the package developer (last group).
1504 %
1505 % \medskip\noindent
1506 % \begin{tabularx}{\textwidth}{>{\ttfamily}ll>{\raggedright\arraybackslash}X}
1507 % \toprule
1508 % \normalfont TikZ Key & Type & Description \\
1509 % \midrule
1510 % timing/debug/nodes & \C & Enables marking of named inline nodes. \\
1511 % timing/debug/node & \S & Format style for inline node marker label, which itself is a TikZ node. \\
1512 % timing/debug/markcmd=\meta{code} & \s & TikZ drawing code to draw marker (except label). The code can access the node name as \cs{N}. \\
1513 % timing/debug/scope & \S & Format for scope of node markers. \\
1514 % \midrule
1515 % timing/debug/level=\meta{integer} & \s & Sets debug output level. This is only important for developers. \\
1516 % \bottomrule
1517 % \end{tabularx}
1518 %
1519 % \section*{Other}
1520 % \begin{tabularx}{\textwidth}{>{\ttfamily}ll>{\raggedright\arraybackslash}X}
1521 % \toprule
1522 % \normalfont TikZ Key & Type & Description \\
1523 % \midrule
1524 % timing/expand count=\meta{integer} & \s & Sets the maximum expand count for the underlying
1525 % \texttt{tikzpicture}. TikZ only expands the content this number of times. The TikZ default value
1526 % of 100 is to small for timing diagrams and is changed to 1000 by default. This should be raised
1527 % (only) if TikZ throws an to-many-expands error.\\
1528 % \bottomrule
1529 % \end{tabularx}
1530 %
1531 % \endgroup
1532 %
1533 % \clearpage
1534 % \chapter{Libraries for Further Characters}
1535 % All default timing characters described in Table~\ref{tab:chars} are always
1536 % made available by this package. Further, less-common characters are provided
1537 % by libraries which are loaded with the macro
1538 % \cs{usetikztiminglibrary}\marg{library}. This is done to hold the memory
1539 % usage of this package small and reduce the risk of collisions with
1540 % user-defined (meta-)characters.
1541 % The full syntax for the above macro is
1542 % \cs{usetikztiminglibrary}\oarg{options}\marg{library,\dots}\oarg{date}, like
1543 % the one for \cs{usepackage}.
1544 % The date is used as a version number like for packages and is identical to the date
1545 % of the |tikztiming| package.
1546 %
1547 % \clearpage
1548 % \library{arrows}{Arrows}
1549 % The library "arrows" enables two characters "A" and "W" which draw
1550 % vertical up and down \textit{A}rro\!\textit{W}s. Such arrows are used in
1551 % timing diagrams to mark special polarized events, like clock edges of another
1552 % signal.
1553 %
1554 % The width provided with these character is added as whitespace after the
1555 % ``zero-width'' arrow: "A2AA" results in `\texttiming{A2AA}'. This space
1556 % can be avoided by specifying the width to zero: "0A". Like the "C" and
1557 % "T" characters the subsequent arrow characters are not combined into one.
1558 %
1559 % The arrow tips can be changed using the TikZ styles for this characters. See
1560 % section~\ref{sec:styles} for more information. The "A" and "W" character should
1561 % only be used which each each other, but not together with any other characters
1562 % except with "S" (space).
1563 %
1564 % \begin{table}[H]
1565 % \centering
1566 % \caption{Examples for Arrow Characters.}\label{tab:arrows}
1567 % \begin{tikztimingexampletable}
1568 % 0A \\
1569 % AAA \\
1570 % 3A \\
1571 % 3{A} \\
1572 % 3A 3A \\
1573 % 3a 3a \\
1574 % AW AW \\
1575 % 3{AW} \\
1576 % 3{aw} \\
1577 % 2S 2A 3W A W \\
1578 % \extracode
1579 % \tablegrid*
1580 % \end{tikztimingexampletable}
1581 % \end{table}
1582 %
1583 % \clearpage
1584 % \library{either}{Either High or Low}
1585 % The library "either" enables the "E" character which stands for
1586 % `\textit{either high or low}'. This character is designed to be used with the
1587 % "H" and "L" characters to display a uncertainty of a transition.
1588 % Sometimes a, e.g.\ low signal can go either to high or stay at low for a
1589 % certain time before it definitely goes to high. In this case both (or more)
1590 % possible transitions can be drawn using this character.
1591 % Like the "C" and "T" characters subsequent "E" characters are not
1592 % combined into one.
1593 %
1594 % The drawing style can be changed using the |timing/e| and
1595 % |timing/e/background| TikZ style.
1596 %
1597 % \begin{table}[H]
1598 % \centering
1599 % \caption{Examples for the `\texttt{E}' Character.}\label{tab:either}
1600 % \begin{tikztimingexampletable}[timing/e/background/.style={fill=black!20}]
1601 % L E H \\
1602 % L D H \\
1603 % H E L \\
1604 % H D L \\
1605 % L E E H \\
1606 % L 3{.25E} H \\
1607 % H E E L \\
1608 % L EEE HH EEE L \\
1609 % l e e h \\
1610 % h e e l \\
1611 % H 2E L \\
1612 % H 2{E} L \\
1613 % H 5{e} L \\
1614 % H E E H \\
1615 % L E E L \\
1616 % \end{tikztimingexampletable}
1617 % \par\medskip
1618 % \makebox[\textwidth][c]{%
1619 % \begin{tabular}{lc}
1620 % \toprule
1621 % Settings (\texttt{timing/e/.cd}) & Resulting Diagram (\texttt{LL EE HH}) \\
1622 % \midrule
1623 % \texttt{.style=\{dotted,gray\}} & \texttiming[timing/e/.style={dotted,gray}]{LL EE HH} \\
1624 % \texttt{background/.style=\{fill=gray\}} & \texttiming[timing/e/background/.style={fill=gray}]{LL EE HH} \\
1625 % \bottomrule
1626 % \end{tabular}
1627 % }%
1628 % \end{table}
1629 %
1630 % \clearpage
1631 % \library{overlays}{Overlays}
1632 % The library "overlays" enables the "O" character which allows the
1633 % overlaying of timing characters, i.e.~different groups of timing characters
1634 % are drawn on top of each other. This is not to be confused with `dynamic' overlay
1635 % provided by the presentation class |beamer|. The |tikz-timing| library \lib{beamer} provides
1636 % some support for such overlays.
1637 %
1638 % The "O" character awaits a set of character
1639 % enclosed by braces which are drawn as normal. The position before the "O"
1640 % character is then restored and the following characters are drawn over them.
1641 % Older versions of this character awaited a second set of characters in braces
1642 % but this braces are now optional. The exact syntax is:\\[\smallskipamount]
1643 % \hspace*{2em} \meta{chars before} |O|\marg{background chars} \marg{foreground
1644 % chars} \meta{chars after}\\[\smallskipamount]
1645 % or, without second set of braces, but equal:\\[\smallskipamount]
1646 % \hspace*{2em} \meta{chars before} |O|\marg{background chars} \meta{foreground
1647 % chars, \dots}\\[\smallskipamount]
1648 %
1649 % It is the responsibility of the user to make sure that the lines drawn by the
1650 % first set reconnect to the main lines or do something else useful. The
1651 % modifier ";" can be used to restart the drawn line, e.g.\ to change to a
1652 % different color. This is not done automatically to give the user the freedom
1653 % if and where this should happen. It is recommended to start and end the set
1654 % with characters identical with the main line to avoid ugly connection points.
1655 %
1656 % Please note that the width of the first argument is ignored and does not count to the
1657 % total width of the diagram line. The characters following the overlay should therefore
1658 % be as wide or wider as the one of the overlay, otherwise the bounding box and background grid
1659 % will be incorrect.
1660 %
1661 % Overlays can be cascaded\NewIn{v0.7}, \ie an overlay can be included in the first argument
1662 % of another overlay.
1663 %
1664 % \begin{table}[H]
1665 % \centering
1666 % \caption{Examples for the `\texttt{O}' Overlay Character.}\label{tab:overlays}
1667 % \ifprintversion
1668 % \begin{tikztimingexampletable}[timing/draw grid]
1669 % LLL O{HH}{LL} HHH \\
1670 % LLL O{HHH}{LL} HHH \\
1671 % LLL O{;[gray]HH.1H;}{LLH} HH \\
1672 % LL O{L;[gray]HH.1H;}{LLLH} HH \\
1673 % DD{} O{zd}{D}d 2D \\
1674 % ZZ O{Z D Z}{Z 1.1M .9Z} ZZ \\
1675 % ZZ O{d Z}O{DZ}{dD} ZZ \\
1676 % ZZ O{dDZ}O{DZ}{dZ} ZZ \\
1677 % ZZ 3D O{dDZ}{DZ} ZZ \\
1678 % ZZ 3D O{dDZ}O{DZ}{dZ} ZZ \\
1679 % ZZ 3D O{3D} DZZ \\
1680 % Z O{DD} ZDDD O{DDZZ} DZ 2S \\
1681 % Z O{6D Z}{Z 4D Z} Z \\
1682 % Z O{8D Z}O{Z 6D Z}{2Z 4D 2Z} Z \\
1683 % \end{tikztimingexampletable}
1684 % \else
1685 % \begin{tikztimingexampletable}[timing/draw grid]
1686 % LLL O{HH}{LL} HHH \\
1687 % LLL O{HHH}{LL} HHH \\
1688 % LLL O{;[gray]HH.1H;}{LLH} HH \\
1689 % LL O{L;[gray]HH.1H;}{LLLH} HH \\
1690 % DD{} O{zd}{D}d 2D \\
1691 % ZZ O{Z D Z}{Z 1.1M .9Z} ZZ \\
1692 % ZZ O{d Z}O{DZ}{dD} ZZ \\
1693 % \end{tikztimingexampletable}
1694 % \begin{tikztimingexampletable}[timing/draw grid]
1695 % ZZ O{dDZ}O{DZ}{dZ} ZZ \\
1696 % ZZ 3D O{dDZ}{DZ} ZZ \\
1697 % ZZ 3D O{dDZ}O{DZ}{dZ} ZZ \\
1698 % ZZ 3D O{3D} DZZ \\
1699 % Z O{DD} ZDDD O{DDZZ} DZ 2S \\
1700 % Z O{6D Z}{Z 4D Z} Z \\
1701 % Z O{8D Z}O{Z 6D Z}{2Z 4D 2Z} Z \\
1702 % \end{tikztimingexampletable}
1703 % \fi
1704 % \end{table}
1705 %
1706 % \clearpage
1707 % \library{clockarrows}{Clock Arrows}
1708 % The library "clockarrows"\NewIn{v0.7} is changing the "C" clock character to contain
1709 % arrows which mark the rising and/or falling clock edge. By default the rising
1710 % edges are marked. To simplify the implementation only the transition from a
1711 % "C" to another "C" character contains the arrows but not transitions from
1712 % or to different characters, like "HCH" or "LCL".
1713 %
1714 % The arrows can be controlled using the TikZ styles shown in
1715 % Table~\ref{tab:clockarrowstyles} below. This styles can also be used as
1716 % library options. The key ``directory'' "timing/c" must be dropped for
1717 % options, e.g.\\\hspace*{2em}
1718 % \cs{usetikztiminglibrary}|[rising arrows]{clockarrows}|.
1719
1720 % \begin{table}[H]
1721 % \centering
1722 % \caption{TikZ Styles for Clock Arrows.}
1723 % \label{tab:clockarrowstyles}
1724 % \makebox[\textwidth][c]{%
1725 % \begin{tabularx}{1\textwidth}{>{\ttfamily}l>{\raggedright\arraybackslash}X}
1726 % \toprule
1727 % \normalfont TikZ Style & Description \\
1728 % \midrule
1729 % timing/c/rising arrows & Mark (only) rising edges with arrows.\\
1730 % timing/c/falling arrows & Mark (only) falling edges with arrows.\\
1731 % timing/c/dual arrows & Mark both rising and falling edges with arrows.\\
1732 % timing/c/no arrows & Do not mark any edges with arrows. (Default)\\
1733 % \midrule
1734 % timing/c/arrow & Style for arrows. Can be modified to change arrow tip etc. (Default: \{\})\\
1735 % timing/c/arrow pos=\meta{0.\!-\!\!-1.} & Position of arrows, i.e.\ its tip, on the edge.
1736 % May needs adjustment if different arrow tip shapes are selected. (Default: 0.95)\\
1737 % timing/c/arrow tip=\meta{name} & Tip shape of arrows. See the PGF manual for the list of arrow tips. (Default: `\texttt{to}')\\
1738 % \bottomrule
1739 % \end{tabularx}}
1740 % \end{table}
1741 %
1742 % \begin{table}[H]
1743 % \caption{Examples for the Clock Arrows.}\label{tab:clockarrows}
1744 % \tikzset{timing/c/dual arrows}%
1745 % \centering
1746 % \ifprintversion
1747 % \begin{tabular}{lc}
1748 % \toprule
1749 % Settings (\texttt{timing/c/.cd}) & Resulting Diagram (\texttt{11\{C\}}) \\
1750 % \midrule
1751 % \texttt{rising arrows} & \texttiming[timing/c/rising arrows]{10{C}} \\
1752 % \texttt{falling arrows} & \texttiming[timing/c/falling arrows]{10{C}} \\
1753 % \texttt{no arrows} & \texttiming[timing/c/no arrows]{10{C}} \\
1754 % \texttt{dual arrows} & \texttiming[timing/c/dual arrows]{10{C}} \\
1755 % \midrule
1756 % \texttt{arrow pos=.5} & \texttiming[timing/c/arrow pos=.5]{10{C}} \\
1757 % \texttt{arrow tip=latex} & \texttiming[timing/c/arrow tip=latex]{10{C}} \\
1758 % \texttt{arrow tip=stealth} & \texttiming[timing/c/arrow tip=stealth]{10{C}} \\
1759 % \bottomrule
1760 % \end{tabular}
1761 % \else
1762 % \begin{minipage}[t]{.49\textwidth}
1763 % \vspace{0pt}\centering
1764 % \begin{tabular}{lc}
1765 % \toprule
1766 % Settings (\texttt{timing/c/.cd}) & Resulting Diagram (\texttt{11\{C\}}) \\
1767 % \midrule
1768 % \texttt{rising arrows} & \texttiming[timing/c/rising arrows]{10{C}} \\
1769 % \texttt{falling arrows} & \texttiming[timing/c/falling arrows]{10{C}} \\
1770 % \texttt{no arrows} & \texttiming[timing/c/no arrows]{10{C}} \\
1771 % \texttt{dual arrows} & \texttiming[timing/c/dual arrows]{10{C}} \\
1772 % \bottomrule
1773 % \end{tabular}
1774 % \end{minipage}
1775 % \hfill
1776 % \begin{minipage}[t]{.49\textwidth}
1777 % \vspace{0pt}\centering
1778 % \begin{tabular}{lc}
1779 % \toprule
1780 % Settings (\texttt{timing/c/.cd}) & Resulting Diagram (\texttt{11\{C\}}) \\
1781 % \midrule
1782 % \texttt{arrow pos=.7} & \texttiming[timing/c/arrow pos=.7]{10{C}} \\
1783 % \texttt{arrow pos=.4} & \texttiming[timing/c/arrow pos=.4]{10{C}} \\
1784 % \texttt{arrow tip=latex} & \texttiming[timing/c/arrow tip=latex]{10{C}} \\
1785 % \texttt{arrow tip=stealth} & \texttiming[timing/c/arrow tip=stealth]{10{C}} \\
1786 % \bottomrule
1787 % \end{tabular}
1788 % \fi
1789 % \end{minipage}
1790 % \end{table}
1791 %
1792 % \clearpage
1793 % \library{columntype}{Column Type}
1794 % The library "columntype"\NewIn{v0.7} uses the \pkg{array} package to define a new
1795 % |tabular| column type for timing characters. The tabular column can then hold
1796 % timing characters like the \env{tikztimingtable}. An initial option block
1797 % "[...]" is taken as initial character or diagram line wide settings. The
1798 % main difference between these two table types is that \env{tikztimingtable}
1799 % creates a big common |tikzpicture| with one coordinate system with potential
1800 % extra drawing code and the column type creates single pictures for each
1801 % diagram line without common coordinate system.
1802 %
1803 % By default the letter "T" and left alignment are used for the timing column
1804 % type. The TikZ style |timing/columntype=|\marg{letter}\marg{alignment} can be
1805 % used to select different column letters and alignments. The \meta{alignment}
1806 % represents here the \emph{real} column letter like "l", "c" or "r".
1807 % Additional column code can be added using the `|>|\marg{code}' and
1808 % `|<|\marg{code}' argument of the \pkg{array} package.
1809 % \iffalse
1810 % \noindent\textbf{Examples:}\\
1811 % \hspace*{1em}|\tikzset{timing/columntype={T}{r}}| \hspace{2em} Change to right
1812 % alignment.\\
1813 % \hspace*{1em}|\tikzset{timing/columntype={I}{>{code}c<{code}}| \hspace{2em}
1814 % Defines letter "I" to create centered timing diagrams with some code before
1815 % and after it.
1816 % \fi
1817 %
1818 % More complex column types (\eg one holding |@{..}| or |!{..}| arguments,
1819 % multiple columns, etc.) must be defined manually using \pkg{array}'s
1820 % \cs{newcolumntype} macro. The default definition is equal
1821 % to\\[\smallskipamount]
1822 % \hspace*{2em}|\newcolumntype{T}{>{\celltiming}l<{\endcelltiming}}|.
1823 %
1824 % \smallskip
1825 % The default "T" definition can be suppressed by using either the library
1826 % option |notype| or a different |type| (equal to |timing/columntype|):
1827 % \\[\smallskipamount]
1828 % \hspace*{2em}|\usetikzlibrary[type={U}{l}]{columntype}|\\[\smallskipamount]
1829 %
1830 % \bigskip
1831 % \begin{figure}
1832 % \makeatletter
1833 % \let\tikztiming@embedexample\empty
1834 % \makeatother
1835 % \centering
1836 % \begin{examplecode}
1837 % \begin{tabular}{lcT}
1838 % \toprule
1839 % Description & Num & \multicolumn{1}{l}{Signal} \\
1840 % \midrule
1841 % Example & A & HLHZLHL \\
1842 % Example & B & [][green] HLHZLHL \\
1843 % Example & C & [green] HLHZLHL \\
1844 % \bottomrule
1845 % \end{tabular}
1846 % \end{examplecode}
1847 % \caption{Example for use of Timing Column Type.}\label{exa:columntype}
1848 % \end{figure}
1849 %
1850 % \clearpage
1851 % \library{nicetabs}{Nice Timing Tables}
1852 % The library "nicetabs"\NewIn{v0.7} uses the settings of the \pkg{array} and
1853 % \pkg{booktabs} packages to improve the layout of \env{tikztimingtables}. The
1854 % resulting table matches a \env{tabular}|{rT}| table which uses the above
1855 % packages and the |columntype| library. The table macros \cs{tabcolsep},
1856 % \cs{arraystretch} and \cs{extrarowheight} are obeyed.
1857 %
1858 % The original table layout is designed to produce integer coordinates between
1859 % the rows to simplify the drawing of extra drawings (see \cs{extracode}). The
1860 % improved layout will cause non-integer coordinates, but in-line nodes and the
1861 % \cs{rowdist} and \cs{coldist} macros can be used to draw extra material
1862 % relatively to the rows.
1863 %
1864 % The TikZ styles "timing/nice tabs" (default) and "timing/no nice tabs" can
1865 % be used to activate and deactivate the layout, \eg for each table. Both
1866 % settings can be given as a library option, but without the "timing/" path.
1867 %
1868 % \bigskip
1869 % \begin{table}[H]
1870 % \caption{Timing tables using `nice' (left) and normal (right) Layout. For
1871 % comparison a \texttt{\{tabular\}\{rT\}} table is placed in grey below the
1872 % left table.}^^A
1873 % \hbox{}\hfill
1874 % \begin{tikzpicture}
1875 % \node [gray] {\sffamily\ignorespaces
1876 % \begin{tabular}{rT}
1877 % \toprule
1878 % Name & \multicolumn{1}{l}{Timing} \\
1879 % \midrule
1880 % Example & HLHLLHHH \\
1881 % Example & HLHLLHHH \\
1882 % Example & HLHLLHHH \\
1883 % \bottomrule
1884 % \end{tabular}^^A
1885 % };
1886 % \node {\ignorespaces
1887 % \begin{tikztimingtable}[timing/nice tabs]
1888 % Example & HLHLLHHH \\
1889 % Example & HLHLLHHH \\
1890 % Example & HLHLLHHH \\
1891 % \extracode
1892 % \tableheader{Name}{Timing}
1893 % \tablerules
1894 % \end{tikztimingtable}^^A
1895 % };
1896 % \end{tikzpicture}
1897 % \hfill
1898 % \begin{tikztimingtable}[timing/no nice tabs]
1899 % Example & HLHLLHHH \\
1900 % Example & HLHLLHHH \\
1901 % Example & HLHLLHHH \\
1902 % \extracode
1903 % \tableheader{Name}{Timing}
1904 % \tablerules
1905 % \end{tikztimingtable}
1906 % \hfill\hbox{}^^A
1907 % \end{table}
1908 %
1909 % \clearpage
1910 % \library{counters}{Counter Character}
1911 % The library "counters"\NewIn{v0.7}\ExtIn{v0.7a} allows the easy definition
1912 % of meta-characters which
1913 % implement up-counters. These characters show the counter value using the
1914 % "D{}" character and increment it by one every time they are used. A second
1915 % character can be defined to (re-)set the counter to a specific value. The
1916 % counter values can be decimal (base-10, default), hexadecimal (base-16) or any
1917 % other base from 2 to 36. By default the lower case version of the counter
1918 % character is defined to produce the same output only with half the width.
1919 %
1920 % Counter characters are defined using the TikZ key
1921 % `\texttt{timing/counter/new=}\linebreak[3]\ignorespaces
1922 % \texttt{\{char=\meta{char},\meta{settings}\}}' which can also be written as
1923 % "timing/new counter". The \meta{settings} are TikZ keys themselves and are
1924 % shown by Table~\ref{tab:countersettings}. One or more "new" keys (path
1925 % "timing/counter" removed) can be given as library options.
1926 % The counter values are global like normal \LaTeX\ counters. They should be reset
1927 % in every timing diagram line before they are used.
1928 %
1929 % \subsubsection*{Counter Style}
1930 % The styles `\texttt{timing/counter/\meta{char}}' and `\texttt{timing/counter/\meta{char}/text}'
1931 % (both initially empty) are used to format the graphic and text style of this counter, respectively.
1932 % Because the "D{}" character is used internally the above styles need to change the corresponding
1933 % "D" styles. This changes are only local and do not affect further `real' "D" characters.
1934 %
1935 % The settings "fg style", "bg style" and "text style" can be used to quickly define the
1936 % foreground (\ie line), background and text style of the counter. While the "text style" setting
1937 % simple sets the `\texttt{timing/counter/\meta{char}/text}' style, the other two are a shortcut for
1938 % \\*[\smallskipamount]
1939 % | \tikzset{timing/counter/|\meta{char}|/.style={%|\\
1940 % | timing/d/.style=|\marg{fg style}|,|\\
1941 % | timing/d/background/.style=|\marg{bg style}|,|\\
1942 % | }}|\\
1943 % \par\medskip
1944 %
1945 % \subsubsection*{Additional Macros}
1946 % \DescribeMacro\tikztimingcounter{<char>}
1947 % \DescribeMacro\tikztimingsetcounter{<char>}{<pgfmath expression>}
1948 % The value of counter \meta{char} can be read or set using this macros.
1949 %
1950 % \begin{table}
1951 % \caption{Settings for Counter Meta-Characters}
1952 % \label{tab:countersettings}
1953 % \makebox[\textwidth][c]{%
1954 % \begin{tabularx}{1\textwidth}{>{\ttfamily}lX}
1955 % \toprule
1956 % \multicolumn{1}{l}{Key name} & Description \\
1957 % \midrule
1958 % char=\meta{char} & Defines the given \meta{char} to be a counter
1959 % meta-character. If it is a upper case character the lower case character
1960 % will produce the same output but with the half width, as long this is not
1961 % overwritten with the \texttt{half with char} key. \\
1962 % half width char=\meta{char} & Defines the given \meta{char} to be the half
1963 % width version of the counter value. By default this is the lower case
1964 % version of the counter character given with \texttt{char}. An empty value
1965 % for \meta{char} deactivates the definition of a half width character.\\
1966 % reset char=\meta{char}
1967 % & Defines the given \meta{char} to (re-)set the counter value to the `width'
1968 % of the character, \ie the number preceding it. The lower case version of
1969 % the reset \meta{char} is not defined.\\
1970 % reset type=\small\meta{width\Pipe arg\Pipe both\Pipe Both}
1971 % & Defines the type of the reset character, \ie how the reset value is obtained.
1972 % {\begin{tabular}{>{\ttfamily}ll}
1973 % width & Width is reset value: `\meta{value}\meta{char}', \eg `\texttt{0R}'.
1974 % Value can not be negative.\\
1975 % arg & Reset value is provided as argument: `\meta{char}\marg{value}', \eg
1976 % `\texttt{R\{-1\}}'.\\
1977 % both & Uppercase \meta{char} is \texttt{width}-type, lowercase \meta{char}
1978 % is \texttt{arg}-type reset char.\\
1979 % Both & Lowercase \meta{char} is \texttt{width}-type, uppercase \meta{char}
1980 % is \texttt{arg}-type reset char.\\
1981 % \end{tabular}} \\
1982 % base=\meta{Num 2-36} & Defines the numeric base of the counter. If not used the
1983 % base 10 is used.\\
1984 % \midrule
1985 % increment=\small\meta{pgfmath expression} &
1986 % Sets the increment which is added every time the counter
1987 % character is used. This can be a formula which result is truncated
1988 % to a integer. The current counter value can be referenced as \cs{N}.
1989 % The increment can be negative which causes
1990 % the counter to count down. Default: 1\\
1991 % max value=\small\meta{pgfmath expression} & Sets the maximum counter value. Default: \emph{not set}\\
1992 % min value=\small\meta{pgfmath expression} & Sets the minimum counter value. Default: \emph{not set}\\
1993 % wraps=\meta{true\Pipe false} &
1994 % If set to \texttt{true} the counter wraps around, \ie it counts to the
1995 % minimum value when counting over the maximum value or the other
1996 % way around if \texttt{increment} is negative.
1997 % Initial value: \texttt{false}. Default value: \texttt{true}\\
1998 % \midrule
1999 % bg style=\meta{TikZ style(s)} & Sets the background style of the counter.\\
2000 % fg style=\meta{TikZ style(s)} & Sets the foreground (line etc.) style of the counter.\\
2001 % text style=\meta{TikZ style(s)} & Sets the text style of the counter.\\
2002 % text format=\meta{\TeX code} & Sets the format code of the counter value. This should be a macro which receives
2003 % the counter value as first argument.\\
2004 % \bottomrule
2005 % \end{tabularx}
2006 % }%
2007 % \end{table}
2008 %
2009 % \subsubsection*{Examples:}
2010 % \noindent
2011 % Counter character "Q" with base 16 (hexadecimal). "R" resets the
2012 % counter. The counter value should be in blue text typer font.\\*\noindent
2013 % |\tikzset{timing/new counter={char=Q,base=16,reset char=R}}|\\*\noindent
2014 % |\tikzset{timing/counter/Q/text/.style={font=\ttfamily,blue}}|\\*\noindent
2015 % |\texttiming{ 3Q 3{Q} R 12{Q} 2R Q qq 0R 3{Q} }|\\*\noindent
2016 % gives: {%
2017 % \tikzset{timing/counter/new={char=Q,base=16,reset char=R}}%
2018 % \tikzset{timing/counter/Q/text/.style={font=\ttfamily,blue}}%
2019 % \texttiming{ 3Q 3{Q} R 12{Q} 2R Q qq 0R 3{Q} }%
2020 % }%
2021 %
2022 % \par\bigskip
2023 % \noindent
2024 % \begingroup
2025 % \lstset{basicstyle=\ttfamily\scriptsize}
2026 % \begin{examplecode}
2027 % \scalebox{2}{%
2028 % \begin{tikztimingtable}
2029 % Dec & [timing/counter/new={char=Q,max value=15, wraps,text style={font=\scriptsize}}] 33{Q}d\\
2030 % Bin & [timing/counter/new={char=Q,max value=15,base=2, digits=4,wraps,text style={font=\tiny,scale=.8}}] 33{Q}d\\
2031 % Oct & [timing/counter/new={char=Q,max value=15,base=8, digits=3,wraps,text style={font=\tiny}}] 33{Q}d\\
2032 % Hex & [timing/counter/new={char=Q,max value=15,base=16, wraps,text style={font=\scriptsize}}] 33{Q}d\\
2033 % \extracode
2034 % \begin{background}[shift={(0.1,0)},help lines]
2035 % \vertlines{}
2036 % \end{background}
2037 % \end{tikztimingtable}
2038 % }%
2039 % \end{examplecode}
2040 % \endgroup
2041 %
2042 % \clearpage
2043 % \library{advnodes}{Advanced Nodes}
2044 % The library "advnodes"\NewIn{v0.7} changes the in-line nodes, \ie the "N" character, to provide multiple
2045 % transition dependent and independent node anchors shown in Table~\ref{tab:advanchor}.
2046 %
2047 % Most transitions provide the three logic level anchors "low", "mid" and "high" which lie
2048 % on the drawn timing line. Transitions of `double line' characters like "D" can have
2049 % two low and/or high level anchors which are called "low2" and "high2".
2050 %
2051 % To align marker lines over multiple rows inside a \env{tikztimingtable} a set of transition
2052 % independent node anchors are provided: "LOW", "MID", "HIGH". This anchors lie all at the begin of the
2053 % transition at the appropriate logic levels.
2054 % With the normal coordinate-like in-line nodes the vertical node (center) position has to be taken into
2055 % account, while this advanced anchors do this automatically.
2056 %
2057 % Often marker lines should start and end with a little vertical offset from the timing diagram to be more distinguishable.
2058 % For this the two anchors "TOP" and "BOTTOM" exist. They lie above and below of "HIGH" and "LOW", respectively.
2059 % The vertical distance can be set using `|timing/nodes/offset=|\meta{dim.~or number}'.
2060 %
2061 % \textbf{Please note} that the node \emph{center} of advanced nodes will be different for some transitions.
2062 % The "center" anchor (used by default if no node anchor is provided) will be placed at the logical center of the
2063 % transition, \ie mostly in the middle of it. In order not to break existing diagrams which use nodes as references
2064 % to draw additional material an TikZ styles is provided to select between the old and new node centers. This styles
2065 % can be used globally or locally as required. The two explicit anchors "new center" and "old center" are also
2066 % provided. For existing documents with diagrams using normal nodes it is recommended
2067 % to switch to simple nodes or to the old node centers globally or select such a style for each old diagram.
2068 %
2069 % The following TikZ settings can be used with the library. The node style settings affect all new nodes after them.
2070 % The center settings affect all following \emph{references} (\eg "(NodeName)" or "(NodeName.center)") of advanced nodes.
2071 % The settings can be used as library options with the "timing/nodes/" part removed.
2072 %
2073 % \vfill\noindent
2074 % \begin{tabularx}{\textwidth}{>{\ttfamily}lX}
2075 % \toprule
2076 % \normalfont
2077 % TikZ Setting & Description \\
2078 % \midrule
2079 % timing/nodes/advanced & Selects advanced in-line nodes. (library default) \\
2080 % timing/nodes/simple & Selects simple coordinate-style in-line nodes. (package default) \\
2081 % \midrule
2082 % timing/nodes/new center & Center of in-line nodes is in the new position. (default for \texttt{advanced}) \\
2083 % timing/nodes/old center & Center of in-line nodes is in the old position. (always on for \texttt{simple}) \\
2084 % \midrule
2085 % timing/nodes/offset & Sets offset for \texttt{TOP} and \texttt{BOTTOM} anchors.
2086 % Can be a dimension with unit or a factor to the current \texttt{y} unit. (default: 0.25) \\
2087 % \bottomrule
2088 % \end{tabularx}
2089 %
2090 % \subsection*{Examples:}
2091 % "\usetikztiminglibrary[simple]{advnodes}"\ \ loads the library with nodes default to the old "simple" style.\\\noindent
2092 % "\usetikztiminglibrary[old center]{advnodes}"\ \ \ loads the library with advanced nodes with have the center at the same
2093 % place as the normal simple nodes. This is a good ``compatibility mode'' for existing pre-v0.7 diagrams.\\\noindent
2094 % "\begin{tikztimingtable}[timing/nodes/simple]"\ \ starts a timing table which uses simple nodes. \\\noindent
2095 % "\begin{tikztimingtable}[timing/nodes/.cd,advanced,old center]"\\\noindent starts a timing table which uses advanced nodes with old node centers.
2096 %
2097 %
2098 % \begin{table}
2099 % \caption{Transition Dependent Anchor Points of Advanced Nodes}^^A
2100 % \label{tab:advanchor}^^A
2101 % \makeatletter
2102 % \let\mid\relax
2103 %^^A
2104 % \tikzset{timing/draw grid}^^A
2105 % \tikzset{timing/.cd,
2106 % lslope=.5,
2107 % dslope=.5,
2108 % zslope=.5,
2109 % }^^A
2110 %^^A
2111 % \tikzset{^^A
2112 % marker/.style={opacity=.8,fill opacity=.8},
2113 % low/.style={marker,draw=red},
2114 % mid/.style={marker,draw=yellow},
2115 % high/.style={marker,draw=green},
2116 % low2/.style={marker,draw=red!50!black},
2117 % high2/.style={marker,draw=green!50!black},
2118 % LOW/.style={marker,CAPITAL,draw=red},
2119 % MID/.style={marker,CAPITAL,draw=yellow},
2120 % HIGH/.style={marker,CAPITAL,draw=green},
2121 % CAPITAL/.style={marker,mark=x,mark size=2\pgflinewidth},
2122 % origin/.style={marker,mark=x,draw=gray},
2123 % center/.style={marker,mark=+,draw=black},
2124 % old center/.style={marker,mark=+,mark size=2\pgflinewidth,draw=blue},
2125 % new center/.style={marker,mark size=\pgflinewidth,mark=*,fill=blue,draw=blue},
2126 % }^^A
2127 %^^A
2128 % \newcommand\namark[2][]{^^A
2129 % \draw[mark=o,mark size=3\pgflinewidth,#1] plot coordinates {(#2)}
2130 % }^^A
2131 %^^A
2132 % \def\NodeAnchors#1#2{^^A
2133 % \Huge
2134 % {\raisebox{-.5ex}{\scalebox{1}{^^A
2135 % \begin{tikzpicture}[timing/picture,line width=.5\pgflinewidth]
2136 % \let\pgf@sh@ma@A\@undefined
2137 % \timing [name=T] at (0,0) {#1 N(A) #2};
2138 % \useasboundingbox (T.south west) rectangle (T.north east);
2139 % ^^A
2140 % \pgf@sh@ma@A
2141 % \anchorpoints
2142 % \foreach \a in {LOW,MID,HIGH,old center,new center} {^^A
2143 % \namark[gray,\a]{A.\a};^^A
2144 % }^^A
2145 % \foreach \a in {low,mid,high,low2,high2} {^^A
2146 % \@ifundefined{\a}{}^^A
2147 % {\namark[semithick,\a]{A.\a};}^^A
2148 % }^^A
2149 % \namark[old center,blue]{A.old center};^^A
2150 % \end{tikzpicture}^^A
2151 % }}}^^A
2152 % \Huge\strut
2153 % }^^A
2154 %^^A
2155 % \def\bchars{,L,H,X,D,E}^^A
2156 % \def\achars{,L,H,X,D,D{A},E,0LE,0HE}^^A
2157 %^^A
2158 % \def\DA{D{A}}^^A
2159 % \def\tablecontent{^^A
2160 % \begin{tabular}{lrrrrrrrrrrrrrrrrrr}^^A
2161 % \toprule
2162 % \tikzpicture
2163 % \useasboundingbox (-1ex,-.5ex) rectangle (1ex,.5ex);
2164 % \node {^^A
2165 % \scalebox{0.4}^^A
2166 % {\rotatebox{-45}{$\frac{\mbox{\rotatebox{45}{to}}}^^A
2167 % {\mbox{\rotatebox{45}{from}}}$}}^^A
2168 % };^^A
2169 % \endtikzpicture
2170 % }
2171 %^^A
2172 % \def\atc#1{^^A
2173 % \begingroup
2174 % \edef\@tempa{#1}^^A
2175 % \expandafter\g@addto@macro\expandafter\tablecontent
2176 % \expandafter{\@tempa}^^A
2177 % \endgroup
2178 % }^^A
2179 %^^A
2180 % \foreach \b in \bchars {^^A
2181 % \atc{& \noexpand\multicolumn{1}{c}{\b}}^^A
2182 % }^^A
2183 %^^A
2184 % \atc{\noexpand\\ \noexpand\midrule}^^A
2185 %^^A
2186 % \foreach \a in \achars {^^A
2187 % \ifx\a\DA
2188 % \atc{D\noexpand\{A\noexpand\}}^^A
2189 % \else
2190 % \atc{\a}^^A
2191 % \fi
2192 % \foreach \b in \bchars {^^A
2193 % \atc{& \noexpand\NodeAnchors{\a}{\b}}^^A
2194 % ^^A \hbox to 5em{\llap{\a\b:} \NodeAnchors{\a}{\b}}^^A
2195 % }^^A
2196 % \atc{\noexpand\\}^^A
2197 % }^^A
2198 %^^A
2199 % \atc{^^A
2200 % \noexpand\bottomrule
2201 % \noexpand\end{tabular}^^A
2202 % }^^A
2203 %^^A
2204 % \sffamily\centering
2205 % \tablecontent
2206 %^^A
2207 % \def\legend#1#2{^^A
2208 % \namark[#1]{[shift={(0,.125ex)}]#2}; \node [right] at (#2) {\normalsize #1\strut}
2209 % }^^A
2210 % \par
2211 % \Huge
2212 % \begin{tikzpicture}[timing/picture,line width=.5\pgflinewidth]
2213 % \node [left] at (-1,0) {\large Legend:};
2214 % \legend{low}{0,0};
2215 % \legend{mid}{3,0};
2216 % \legend{high}{6,0};
2217 % \legend{low2}{0,-.8};
2218 % \legend{high2}{6,-.8};
2219 % \legend{LOW}{0,-1.6};
2220 % \legend{MID}{3,-1.6};
2221 % \legend{HIGH}{6,-1.6};
2222 % \legend{new center}{0,-2.4};
2223 % \legend{old center}{6,-2.4};
2224 % \end{tikzpicture}^^A
2225 % \end{table}
2226 %
2227 % \clearpage
2228 % \library{ifsym}{Compatibility Macros for \texttt{ifsym} package}
2229 % The library "ifsym"\NewIn{v0.7} provides macros and timing styles to emulate the behaviour of the \pkg{ifsym} package
2230 % when loaded with the |electronic| option. The \pkg{ifsym} package was an early inspiration to this package
2231 % and this library allows the usage of |ifsym| style timing symbol macros and characters
2232 % (`|\textifsym|\marg{characters}' which uses `|\texttiming[timing/ifsym]|\marg{characters}')
2233 % which are described in Table~\ref{tab:ifsymmacros} and Table~\ref{tab:ifsym}, respectively.
2234 % This is useful if old |ifsym| timing diagrams should be reused. The |tikz-timing| replacements are a very close match
2235 % and do not need a special font to be installed. The graphic quality should be equal or better than the original.
2236 % The intermixing of |ifsym| and |tikz-timing| style characters in a \cs{textifsym} macro
2237 % (the one provided by this library, not the one from the \pkg{ifsym} package) is supported but it is not guaranteed to work
2238 % 100\% properly. Please note that the "M" character is defined to use "X" in black.
2239 %
2240 % The library can be loaded with one of the options "provide" (default), "new", "renew" or "off", respectively.
2241 % These select if the macros should be defined using \cs{providecommand}, \cs{newcommand}, \cs{renewcommand}
2242 % or not at all. This can be useful if the \pkg{ifsym} package is loaded beforehand.
2243 %
2244 %
2245 % \sbox{\sba}{%^^A
2246 % \begin{tabular}{lll}
2247 % \toprule
2248 % Macro & Symbol & Description (trivial) \\
2249 % \midrule
2250 % \cs{RaisingEdge} & \RaisingEdge & Raising Edge \\
2251 % \cs{FallingEdge} & \FallingEdge & Falling Edge \\
2252 % \cs{ShortPulseHigh} & \ShortPulseHigh & Short Pulse High \\
2253 % \cs{ShortPulseLow} & \ShortPulseLow & Short Pulse Low \\
2254 % \cs{PulseHigh} & \PulseHigh & Normal Pulse High \\
2255 % \cs{PulseLow} & \PulseLow & Normal Pulse Low \\
2256 % \cs{LongPulseHigh} & \LongPulseHigh & Long Pulse High \\
2257 % \cs{LongPulseLow} & \LongPulseLow & Long Pulse Low \\
2258 % \bottomrule
2259 % \end{tabular}%^^A
2260 % }%^^A
2261 % ^^A
2262 % \sbox{\sbb}{%^^A
2263 % \begin{tabular}{>{\ttfamily}lll}
2264 % \toprule
2265 % \normalfont
2266 % Character & Symbol & Description \\
2267 % \midrule
2268 % l, h & \textifsym{l}, \textifsym{h} & Short low or high level signal. \\
2269 % L, H & \textifsym{L}, \textifsym{H} & Long low or high level signal. \\
2270 % \pipe & \textifsym{|} & Transition/glitch between L/H or H/L levels. \\
2271 % m, d & \textifsym{m}, \textifsym{d} & Short middle or double level signal. \\
2272 % M, D & \textifsym{M}, \textifsym{D} & Long middle or double level signal. \\
2273 % <, << & \textifsym{<}, \textifsym{<<} & Short or long slope between middle and double level. \\
2274 % >, >> & \textifsym{>}, \textifsym{>>} & Short or long slope between double and middle level. \\
2275 % \bottomrule
2276 % \end{tabular}
2277 % }%^^A
2278 %
2279 % \ifprintversion
2280 %
2281 % \begin{table}
2282 % \centering
2283 % \caption[ifsym style Timing Symbol Macros]{\texttt{ifsym} style Timing Symbol Macros}
2284 % \label{tab:ifsymmacros}
2285 % \usebox{\sba}%^^A
2286 % \end{table}
2287 %
2288 % \begin{table}
2289 % \centering
2290 % \caption[ifsym style Timing Characters]{\texttt{ifsym} style Timing Characters (from \pkg{ifsym} manual)}
2291 % \label{tab:ifsym}
2292 % \usebox{\sba}%^^A
2293 % \end{table}
2294 %
2295 % \else
2296 %
2297 % \begingroup
2298 % \expandafter\def\csname @captype\endcsname{table}%
2299 % \makebox[\textwidth][c]{%^^A
2300 % \let\tablecaption\caption
2301 % \begin{minipage}{\wd\sba}
2302 % \tablecaption[ifsym style Timing Symbol Macros]{\texttt{ifsym} style Timing Symbol Macros}%^^A
2303 % \label{tab:ifsymmacros}%^^A
2304 % \usebox{\sba}%^^A
2305 % \end{minipage}
2306 % \hspace{1em}\hfill
2307 % \begin{minipage}{\wd\sbb}
2308 % \tablecaption[ifsym style Timing Characters]{\texttt{ifsym} style Timing Characters (from \texttt{ifsym} manual)}%^^A
2309 % \label{tab:ifsym}%^^A
2310 % \usebox{\sbb}%^^A
2311 % \end{minipage}
2312 % }%^^A
2313 % \endgroup
2314 %
2315 % \fi
2316 %
2317 % \clearpage
2318 % \library{interval}{Intervals (experimental)}
2319 % \textbf{This library is under development and might change in the future.}
2320 %
2321 % The library "interval"\NewIn{v0.7} allows the drawing of intervals using the "H", "L", "Z" and "X" logic levels.
2322 % It provides modified definitions of X and Z transitions (e.g.~"LX", "XH") where the transition edges can
2323 % be coloured either way to indicate interval borders.
2324 %
2325 % The interval borders can be set using the `|timing/interval=|\marg{settings}' TikZ style. The
2326 % \meta{settings} are "lo" (left-open), "lc" (left-closed) and "ro" (right-open), "rc" (right-closed), which build the
2327 % following combinations: "{lo,ro}", "{lc,ro}", "{lo,rc}" and "{lc,rc}". However, every of them can also be set on its own,
2328 % e.g.\ "timing/interval={lc}" simply sets the interval to `left-closed' without changing the right border.
2329 %
2330 % The key "timing/interval/normal" (alternative: "timing/interval={normal}") sets the transitions back to their default.
2331 %
2332 % \par\medskip
2333 % \noindent
2334 % Examples:
2335 % \begingroup
2336 % \tikzset{timing/draw grid,timing/slope=0}\sffamily
2337 % \newcommand*\ttt[2][]{\texttiming[timing/interval={#1}]{#2}}
2338 % \newcommand*\extab[1]{%
2339 % \begin{tabular}{rcc}
2340 % & ro & rc \\
2341 % lo & \ttt[lo,ro]{#1} & \ttt[lo,rc]{#1} \\
2342 % lc & \ttt[lc,ro]{#1} & \ttt[lc,rc]{#1} \\
2343 % \end{tabular}
2344 % }
2345 % \extab{zlzlz}
2346 % \endgroup
2347 % \par\bigskip
2348 %
2349 % \noindent
2350 % A meta-character can be defined for quick changes if necessary:\\[\smallskipamount]
2351 % \begingroup
2352 % |\tikztimingmetachar{Y}{[timing/interval={lo,ro}]}|\\
2353 % |\tikztimingmetachar{y}{[timing/interval/normal]}|\\
2354 % |\texttiming[timing/draw grid]{ LZH Y HZH y LZH Y LZL } |\\
2355 % |\texttiming[timing/draw grid]{ LXH Y HXH y LXH Y LXL } |\\
2356 % gives:
2357 % \tikztimingmetachar{Y}{[timing/interval={lo,ro}]}
2358 % \tikztimingmetachar{y}{[timing/interval/normal]}
2359 % \texttiming[timing/draw grid]{ LZH Y HZH y LZH Y LZL }
2360 % \texttiming[timing/draw grid]{ LXH Y HXH y LXH Y LXL } \\
2361 % \endgroup
2362 %
2363 % \par\bigskip
2364 % \noindent
2365 % A further alternative is to use a meta-character with an argument.
2366 % Note that "#2" must be used, because "#1" holds the width, which is irrelevant here.
2367 % This definition is also provided by the `|timing/interval/metachar|=\meta{Character}' key.
2368 % \\[\smallskipamount]
2369 % \begingroup
2370 % |\tikztimingmetachar{I}[2]{[timing/interval={#2}]}|\\
2371 % or
2372 % |\tikzset{timing/interval/metachar=I}|\\
2373 % |\texttiming[timing/draw grid]{ LZH I{lo,rc} HZH I{ro} LZH I{normal} LZL } |\\
2374 % gives:
2375 % \tikztimingmetachar{I}[2]{[timing/interval={#2}]}
2376 % \texttiming[timing/draw grid]{ LZH I{lo,rc} HZH I{ro} LZH I{normal} LZL }\\
2377 % \endgroup
2378 %
2379 % \clearpage
2380 % \library{beamer}{Beamer Overlay Support (experimental)}
2381 % \textbf{This library is under development and might change in the future.}
2382 %
2383 % The library "beamer"\NewIn{v0.7} provides (at the moment) marginal support for overlays of the \pkg{beamer} class.
2384 % It allows the usage of beamer \emph{overlay specifications} (|<|\meta{spec}|>|) inside the timing string.
2385 % However, the current simple implementation might not work properly and cause strange results.
2386 % The support is designed for use inside \env{tikztimingtable}.
2387 % See the \pkg{beamer} manual for more informations about overlays specifications.
2388 %
2389 % \subsection*{Usage}
2390 % Insert an overlay specification, e.g.~|<|\meta{number}|>|, inside the timing string. It will affect the
2391 % rest of the timing characters of the current diagram line.
2392 % Unfortunate due to the global nature of overlays it also affects the rest of the table. Therefore all
2393 % diagram lines should end with a specification which turns overlays off, i.e. |<*>| or |<0->|. Otherwise
2394 % strange results can occur (e.g.~wrong/missing background graphics).
2395 %
2396 % \paragraph*{Example}
2397 % | Timing Table Row & H L <2> Z L H <3> D{last} Z <*> \\ |
2398 %
2399 % \subsection*{Display Rows Stepwise}
2400 % The rows of a \env{tikztimingtable} can be uncovered row-by-row using the way shown below. The signal names
2401 % must be enclosed into a \cs{mbox} because \cs{uncover} needs to be inside horizontal mode. Instead
2402 % of \cs{uncover} another beamer overlay command like \cs{only} or \cs{invisible} can be used. To highlight
2403 % the signal name use \cs{alert}|<|\meta{\dots}|>|\marg{signal name} inside \cs{uncover}.
2404 % At the moment there is no simple way to highlight the timing lines.
2405 %
2406 % \begin{lstlisting}[gobble=4]
2407 % \begin{tikztimingtable}
2408 % \mbox{\uncover<+->{Signal Name 1}} & <.-> HL <*> \\
2409 % \mbox{\uncover<+->{Signal Name 2}} & <.-> HL <*> \\
2410 % % ...
2411 % \mbox{\uncover<+->{Signal Name n}} & <.-> HL <*> \\
2412 % \end{tikztimingtable}
2413 % \end{lstlisting}
2414 %
2415 % \subsection*{Display Columns Stepwise}
2416 % Different sections (`columns') of timing diagrams in a \env{tikztimingtable} can be uncovered stepwise using the way shown below.
2417 % In this example the second section/column will be uncovered in the second slide. The first is always visible. Further sections/columns
2418 % can be uncovered in further slides.
2419 %
2420 % Please note that the total width of the table is constant and e.g.~\cs{tablerules} will always cover the full width independent of overlays.
2421 %
2422 % \begin{lstlisting}[gobble=4]
2423 % \begin{tikztimingtable}
2424 % Signal Name 1 & 10D{Sec. 1} <2> 10D{Sec. 2} <*> \\
2425 % Signal Name 2 & 10D{Sec. 1} <2> 10D{Sec. 2} <*> \\
2426 % % ...
2427 % Signal Name n & 10D{Sec. 1} <2> 10D{Sec. 2} <*> \\
2428 % \end{tikztimingtable}
2429 % \end{lstlisting}
2430 %
2431 % \subsection*{Overlay Extra Code}
2432 % The |beamer| overlay specifications can be used inside the \cs{extracode} section like in a normal \env{tikzpicture} environment.
2433 % However, in both cases strange results will occur if the end of the environment is hidden by an overlay specification. Due to this
2434 % reason it is recommended to only use overlay commands which affect only an argument, like \cs{only}|<|\meta{\dots}|>|\marg{code},
2435 % or to place a plain \cs{onlayer} before the end of the environment.
2436 %
2437 % \begin{lstlisting}[gobble=4]
2438 % \begin{tikztimingtable}
2439 % Signal Name 1 & 10D{Sec. 1} <2> 10D{Sec. 2} <*> \\
2440 % % ...
2441 % \extracode
2442 % % either
2443 % \draw<2> (0,0) -- (2,0); \only<3> { ... }
2444 % % or
2445 % \onlayer<2>
2446 % % and then at the very end:
2447 % \onlayer % or \onlayer<*>
2448 % \end{tikztimingtable}
2449 % \end{lstlisting}
2450 %
2451 % \clearpage
2452 % \chapter{Examples}
2453 % This section shows some examples by putting either the full source code or
2454 % only the needed characters beside the graphical result. Please note that the
2455 % displayed syntax is the one of \cs{timing} where the initial character is
2456 % declared as optional argument (\oarg{char}) \emph{inside}/\emph{together} with
2457 % the logic characters. The syntax of \cs{textttiming} is identical except the
2458 % initial character is given as a normal optional argument before the characters
2459 % argument.
2460 % All examples except Example~\ref{exa:adv} are attached in compilable form
2461 % to this PDF.
2462 % ^^A\\[\smallskipamount]
2463 % ^^A\emph{Example notation example:} "[c]cccc" means either
2464 % ^^A|\timing{[c]cccc};| or |\texttiming[c]{cccc}|.
2465 %
2466 % \DeleteShortVerb{\|}
2467 % \begin{exampletable}
2468 % \centering
2469 % \makeatletter
2470 % \let\tikztiming@embedexample\empty
2471 % \makeatother
2472 % \pgfmathsetbasenumberlength{2}
2473 % \newcounter{hexcount}
2474 % \addtocounter{hexcount}{+8}%
2475 % \newcommand{\hexcountmacro}{%
2476 % \pgfmathdectoBase\thehexcount{\value{hexcount}}{16}%
2477 % \hbox{\thehexcount}%
2478 % \addtocounter{hexcount}{+1}%
2479 % }
2480 % \caption{Initial Characters, Modifiers, TikZ Keys}\label{exa:adv}
2481 % \def\somemacro{}%
2482 % \def\code{}%
2483 % \makebox[\textwidth][c]{%
2484 % \begin{tikztimingexampletable}
2485 % HLZXDUTC \\
2486 % cccc \\
2487 % tttt \\
2488 % [c]cccc \\
2489 % 4{c} \\
2490 % 4c4c \\
2491 % 4{1.8c} \\
2492 % [d] 4{5D{Text}} 0.2D \\
2493 % 3.4H 0.6L \\
2494 % DDDUUUDDD \\
2495 % DDD{}DUUDD \\
2496 % 8{2D{\hexcountmacro}} \\
2497 % 3{2{0.25X 2.5D .25Z}} \\
2498 % DDD{} 3{0.2D{}} DDD \\
2499 % DDD{} 3{0.2D{}} 0.4D{} 0.6D{} DDD \\
2500 % HHHLLH SSSS HLLHHL \\
2501 % HHGHHGGHHLLGLLGH \\
2502 % ZZ G ZZ G XX G X \\
2503 % LLL 2{0.1H 0.1L} 0.6H HH \\
2504 % LLL [timing/slope=0.05] 4{.05H .05L} 0.6H HH\\
2505 % LLL 0.4U 0.6H HH \\
2506 % [L][timing/slope=1.0] HL HL HL HL HL \\
2507 % LLLLL !{-- +(.5,.5) -- ++(1,0)} HHHHHH \\
2508 % LLLLL [| /utils/exec={\somemacro\code} |] HHHHHH \\
2509 % LL [green] HH [brown] XX LL ZZ [orange] HH \\
2510 % [][line width=1pt] HLXZDU [line width=0.1pt] HLXZDU \\
2511 % [][line width=1pt] HLXZDU ,[line width=0.1pt] HLXZDU \\
2512 % [][line width=1pt] HLXZDU ;[line width=0.1pt] HLXZDU \\
2513 % \end{tikztimingexampletable}%
2514 % }
2515 % \\\scriptsize
2516 % \emph{Note:} Optional argument must be placed before macro argument if
2517 % \cs{texttiming} is used.
2518 %
2519 % \end{exampletable}
2520 % \MakeShortVerb{\|}
2521 %
2522 % \begin{example}
2523 % \centering
2524 % \begin{examplecode}
2525 % \begin{tikztimingtable}
2526 % Name & hLLLLh \\
2527 % Clock & 10{c} \\
2528 % Signal & z4D{Text}z \\
2529 % \end{tikztimingtable}
2530 % \end{examplecode}
2531 % \caption[tikztimingtable without extracode]{\env{tikztimingtable} without \cs{extracode}.}
2532 % \end{example}
2533 %
2534 % \begin{example}
2535 % \centering
2536 % \begin{examplecode}
2537 % \begin{tikztimingtable}
2538 % Name & hLLLLh \\
2539 % Clock & 10{c} \\
2540 % Signal & z4D{Text}z \\
2541 % \extracode
2542 % \draw (0,0) circle (0.2pt); % Origin
2543 % \begin{pgfonlayer}{background}
2544 % \vertlines[help lines]{0.5,4.5}
2545 % \end{pgfonlayer}
2546 % \end{tikztimingtable}
2547 % \end{examplecode}
2548 % \caption[tikztimingtable with extracode]{\env{tikztimingtable} with \cs{extracode}.}
2549 % \end{example}
2550 %
2551 % \begin{example}
2552 % \centering
2553 % \begin{examplecode}
2554 % \begin{tikzpicture}[x=4cm,y=4cm]
2555 % \draw (0,0) rectangle (1,1);
2556 % \draw (0.2,0.7) circle (10pt);
2557 % \begin{scope}[green]
2558 % \draw (0.1,0.1) -- +(0.8,0.2);
2559 % \timing at (0.3,0.4) {hlzhhlhhl};
2560 % \end{scope}
2561 % \timing [rotate=-30]
2562 % at (0.4,0.7) {HLZHHLHHL};
2563 % \end{tikzpicture}
2564 % \end{examplecode}
2565 % \caption[timing inside general tikzpicture]{\cs{timing} inside general \envv{tikzpicture}.}
2566 % \end{example}
2567 %
2568 % \begin{example}
2569 % \centering
2570 % \def\exampleextraheader{\noexpand\usetikztiminglibrary{advnodes}}
2571 % \begin{examplecode}
2572 % \Huge
2573 % \begin{tikzpicture}[timing/picture,thick,
2574 % timing/nodes/advanced]
2575 % \timing at (0,2) {hH N(A) LHLHL};
2576 % \timing[timing/slope=.25] at (0,0)
2577 % {HLL N(B) HHLl};
2578 % \draw [orange,semithick]
2579 % (A.mid) ellipse (.2 and .6)
2580 % (B.mid) ellipse (.2 and .6);
2581 % \draw [orange,semithick,->]
2582 % ($ (A.mid) - (0,.6) $)
2583 % parabola [bend pos=0.5]
2584 % ($ (B.mid) + (0,.6) $);
2585 % \end{tikzpicture}
2586 % \end{examplecode}
2587 % \caption{Using In-Line Nodes to draw Relationships.}\label{exa:inlinenodes}
2588 % \end{example}
2589 %
2590 % \begin{example}
2591 % \centering
2592 % \lstset{basicstyle=\scriptsize\ttfamily}
2593 % \begin{examplecode}
2594 % \def\degr{${}^\circ$}
2595 % \begin{tikztimingtable}
2596 % Clock 128\,MHz 0\degr & H 2C N(A1) 8{2C} N(A5) 3{2C} G \\
2597 % Clock 128\,MHz 90\degr & [C] 2{2C} N(A2) 8{2C} N(A6) 2{2C} C \\
2598 % Clock 128\,MHz 180\degr & C 2{2C} N(A3) 8{2C} N(A7) 2{2C} G \\
2599 % Clock 128\,MHz 270\degr & 3{2C} N(A4) 8{2C} N(A8) 2C C \\
2600 % Coarse Pulse & 3L 16H 6L \\
2601 % Coarse Pulse - Delayed 1 & 4L N(B2) 16H N(B6) 5L \\
2602 % Coarse Pulse - Delayed 2 & 5L N(B3) 16H N(B7) 4L \\
2603 % Coarse Pulse - Delayed 3 & 6L 16H 3L \\
2604 % \\
2605 % Final Pulse Set & 3L 16H N(B5) 6L \\
2606 % Final Pulse $\overline{\mbox{Reset}}$ & 6L N(B4) 16H 3L \\
2607 % Final Pulse & 3L N(B1) 19H N(B8) 3L \\
2608 % \extracode
2609 % \tablerules
2610 % \begin{pgfonlayer}{background}
2611 % \foreach \n in {1,...,8}
2612 % \draw [help lines] (A\n) -- (B\n);
2613 % \end{pgfonlayer}
2614 % \end{tikztimingtable}
2615 % \end{examplecode}
2616 % \caption{Using In-Line Nodes to draw Marker Lines.}
2617 % \end{example}
2618 %
2619 % \begin{example}
2620 % \centering
2621 % \lstset{basicstyle=\scriptsize\ttfamily}
2622 % \def\exampleextraheader{\noexpand\usetikztiminglibrary{advnodes,either}^^J
2623 % \noexpand\usepackage{amsmath}}
2624 % \begin{examplecode}
2625 % \def\degr#1{\makebox[2em][r]{#1}\ensuremath{{}^{\circ}}}%
2626 %
2627 % \begin{tikztimingtable}[%
2628 % timing/dslope=0.1, timing/.style={x=2ex,y=2ex}, x=2ex,
2629 % timing/rowdist=3ex,
2630 % timing/name/.style={font=\sffamily\scriptsize},
2631 % timing/nodes/advanced,
2632 % ]
2633 % Clock \degr{90} & l 2{C} N(A1) 5{C} \\
2634 % Clock \degr{180}& C 2{C} N(A2) 4{C} c\\
2635 % Clock \degr{270}& h 3{C} N(A3) 4{C} \\
2636 % Clock \degr{0} & [C] 2{C} N(A0) 2{C} N(A4) 3{C}c ;[dotted]
2637 % 2L; 2{C} N(A5) 3{C} \\
2638 % Start of T$_{\text{sw}}$ & 4S G N(start) \\
2639 % Input Pulse & 2.0L 2H 3.5L ;[dotted] 2L; 5L \\
2640 % Set 3 & 2.5L 2H 3.0L ;[dotted] 2L; 5L \\
2641 % Set 2 & 3.0L 2H 2.5L ;[dotted] 2L; 5L \\
2642 % Set 1 & 3.5L 2H 2.0L ;[dotted] 2L; 5L \\
2643 % Set 0 & 4.0L 2H 1.5L ;[dotted] 2L; 5L \\
2644 % Reset & 7.5L ;[dotted] 2L; 2L N(reset) 2H 1L \\
2645 % Final Pulse & 2.5L N(B1) e N(B2) e N(B3) e 3.5H; [dotted]
2646 % 2H; 2H 3L \\
2647 % Counter & N(x) 2D{Full} N(B0) 2D{0} N(B4) 2D{1} 1.5D;[dotted]
2648 % .25D{2} 1.75D{};
2649 % 2D{~D$_\text{M}$} N(B5) 2D{D$_\text{M}$+1} D N(y)\\
2650 % \extracode
2651 % %\tablegrid
2652 % \node[anchor=north] at ($ (x) ! .5 ! (y) - (0,.75) $)
2653 % {\scriptsize D$_\text{M}$ = MSBs of Duty Cycle};
2654 % \begin{background}[timing/picture,line width=.06ex,color=black!60]
2655 % \foreach \n in {0,...,5}
2656 % \draw (A\n.TOP) -- (B\n.BOTTOM);
2657 % \end{background}
2658 % \end{tikztimingtable}%
2659 % \end{examplecode}
2660 % \caption{Adjusting Diagram Parameters and using Advanced In-Line Nodes to draw Marker Lines.}
2661 % \end{example}
2662 %
2663 % \begin{example}
2664 % \centering
2665 % \lstset{basicstyle=\ttfamily\footnotesize}
2666 % \def\texta{}\def\textb{}^^A
2667 % \makeatletter
2668 % \ifpdf
2669 % \IfFileExists{SR_FF_timing_diagram.png}{^^A
2670 % \def\texta{ (left top)}\def\textb{ (left bottom)}^^A
2671 % \def\PrintExample{%
2672 % \begingroup
2673 % \BoxExample
2674 % \par\noindent
2675 % \centerline{%^^A
2676 % \minipage[c]{\wd\exampleresultbox}%^^A
2677 % \hbox to \textwidth{\hss\fbox{\usebox{\exampleresultbox}}}%^^A
2678 % \vspace*{1cm}%^^A
2679 % \hbox to \textwidth{\hss\fbox{\includegraphics[width=27ex]{SR_FF_timing_diagram.png}}}%^^A
2680 % \endminipage%
2681 % \hfill
2682 % \minipage[c]{\wd\examplecodebox}
2683 % \hbox{\usebox{\examplecodebox}}
2684 % \endminipage%
2685 % }
2686 % \endgroup
2687 % \par
2688 % }%^^A
2689 % }{}%^^A
2690 % \fi
2691 % \begin{examplecode}
2692 % \definecolor{bgblue}{rgb}{0.41961,0.80784,0.80784}%
2693 % \definecolor{bgred}{rgb}{1,0.61569,0.61569}%
2694 % \definecolor{fgblue}{rgb}{0,0,0.6}%
2695 % \definecolor{fgred}{rgb}{0.6,0,0}%
2696 % \begin{tikztimingtable}[timing/slope=0,
2697 % timing/coldist=2pt,xscale=2.05,yscale=1.1,semithick]
2698 % \scriptsize clock & 7{C}\\
2699 % S & .75L h 2.25L H LLl [fgblue]\\
2700 % R & 1.8L .8H 2.2L 1.4H 0.8L [fgblue]\\
2701 % Q & L .8H 1.7L 1.5H LL\\
2702 % $\overline{\mbox{Q}}$ & H .8L 1.7H 1.5L HH\\
2703 % Q & LHHHHLL[fgred]\\
2704 % $\overline{\mbox{Q}}$ & HLLLLHH[fgred]\\
2705 % \extracode
2706 % \makeatletter
2707 % \begin{pgfonlayer}{background}
2708 % \shade [right color=bgblue,left color=white]
2709 % (7,-8.45) rectangle (-1,-4.6);
2710 % \shade [right color=bgred,left color=white]
2711 % (7,-12.8) rectangle (-1,-8.6);
2712 % \begin{scope}[gray,semitransparent,semithick]
2713 % \horlines{}
2714 % \foreach \x in {1,...,6}
2715 % \draw (\x,1) -- (\x,-12.8);
2716 % % similar: \vertlines{1,...,6}
2717 % \end{scope}
2718 % \node [anchor=south east,inner sep=0pt]
2719 % at (7,-8.45) {\tiny clocked};
2720 % \node [anchor=south east,inner sep=0pt,fgred]
2721 % at (7,-12.8) {\tiny positive edge triggered};
2722 % \end{pgfonlayer}
2723 % \end{tikztimingtable}%
2724 % \end{examplecode}
2725 % \caption[SR flip-flop timing diagram]{SR flip-flop timing diagram\texta.
2726 % Redrawn from image\textb\\ {\small
2727 % \url{http://commons.wikimedia.org/wiki/File:SR_FF_timing_diagram.png}
2728 % }}
2729 % \end{example}
2730 %
2731 % \begin{example}
2732 % \centering
2733 % \lstset{basicstyle=\ttfamily\scriptsize}
2734 % \begin{examplecode}
2735 % \begin{tikztimingtable}[
2736 % timing/d/background/.style={fill=white},
2737 % timing/lslope=0.2,
2738 % timing/counter/new={char=Q,reset char=R},
2739 % ]
2740 % CPOL=0 & LL 15{T} LL \\
2741 % CPOL=1 & HH 15{T} HH \\
2742 % & H 17L H \\
2743 % \\
2744 % Cycle \# & U R 8{2Q} 2U \\
2745 % MISO & D{z} R 8{2Q} 2D{z} \\
2746 % MOSI & D{z} R 8{2Q} 2D{z} \\
2747 % \\
2748 % Cycle \# & UU R 8{2Q} U \\
2749 % MISO & D{z}U R 8{2Q} D{z} \\
2750 % MOSI & D{z}U R 8{2Q} D{z} \\
2751 % \extracode
2752 % % Add vertical lines in two colors
2753 % \begin{pgfonlayer}{background}
2754 % \begin{scope}[semitransparent,semithick]
2755 % \vertlines[red]{2.1,4.1,...,17.1}
2756 % \vertlines[blue]{3.1,5.1,...,17.1}
2757 % \end{scope}
2758 % \end{pgfonlayer}
2759 % % Add big group labels
2760 % \begin{scope}
2761 % [font=\sffamily\Large,shift={(-6em,-0.5)},anchor=east]
2762 % \node at ( 0, 0) {SCK}; \node at ( 0,-3 ) {SS};
2763 % \node at (1ex,-9) {CPHA=0}; \node at (1ex,-17) {CPHA=1};
2764 % \end{scope}
2765 % \end{tikztimingtable}%
2766 % \end{examplecode}
2767 % \caption[SPI Interface Timing]{SPI Interface Timing. Redrawn from
2768 % image {\small
2769 % \url{http://en.wikipedia.org/wiki/File:SPI_timing_diagram.svg}}}
2770 % \end{example}
2771 %
2772 % \clearpage
2773 % \StopEventually{}
2774 % \clearpage
2775 % \iffalse
2776 %</doc>
2777 % \fi
2778 %
2779 %
2780 % \chapter{Implementation}
2781 %
2782 % \subsection{Package Header}
2783 % \iffalse
2784 %<*tikz-timing.sty>
2785 % \fi
2786 % \begin{macrocode}
2787 %<!COPYRIGHT>
2788 \NeedsTeXFormat{LaTeX2e}[1999/12/01]
2789 \ProvidesPackage{tikz-timing}[%
2790 %<!DATE>
2791 %<!VERSION>
2792 %<*DRIVER>
2793 2099/01/01 develop
2794 %</DRIVER>
2795 Digital Timing Diagrams using TikZ]
2796 % \end{macrocode}
2797 %
2798 % \begin{macrocode}
2799 \RequirePackage{tikz}
2800
2801 \usetikzlibrary{calc}
2802 \usetikzlibrary{backgrounds}
2803 \usetikzlibrary{decorations.pathmorphing}
2804 \ifx\collect@body\@undefined
2805 \IfFileExists{environ.sty}
2806 {\RequirePackage{environ}}
2807 {\RequirePackage{amsmath}}
2808 \fi
2809 % \end{macrocode}
2810 %
2811 % \section{General Definitions}
2812 %
2813 % \begin{macrocode}
2814 \def\tikztimingwidth{0.0}
2815 \newcount\tikztiming@numint
2816 \newcount\tikztiming@numfrac
2817 \def\tikztiming@wscale{1.0}%
2818 \def\tikztimingsetwscale#1{%
2819 \pgfmathparse{#1}%
2820 \let\tikztiming@wscale\pgfmathresult
2821 }
2822 \def\tikztiming@num{0.0}%
2823 \let\tikztiming@back\empty
2824 \newlength\tikztiming@xunit
2825 \newlength\tikztiming@yunit
2826 \def\tikztiming@@xunit{1.6ex}%
2827 \def\tikztiming@@yunit{1.6ex}%
2828 \setlength{\tikztiming@xunit}{\tikztiming@@xunit}%
2829 \setlength{\tikztiming@yunit}{\tikztiming@@yunit}%
2830
2831 \def\tikztiming@setnum#1{%
2832 \pgfmathparse{#1}%
2833 \global\let\tikztiming@num\pgfmathresult
2834 }
2835
2836 \newcount\tikztiming@debug
2837
2838 \def\tikztiming@xsep{0pt}
2839 \def\tikztiming@ysep{0pt}
2840
2841 \newcounter{tikztiming@nrows}%
2842 \def\tikztiming@rowdist{2}%
2843 \def\tikztiming@coldist{1}%
2844
2845 \def\tikztiming@prefix{tikztiming@trans@}%
2846 \def\tikztiming@ttt#1#2#3{#1#2#3}%
2847 \def\tikztiming@pfxtr{%
2848 \tikztiming@prefix\expandafter\tikztiming@ttt
2849 }
2850
2851 \def\timingwidth{1}%
2852 \def\timingheight{1}%
2853 % \end{macrocode}
2854
2855 % \section{TikZ Style Settings}
2856 % \begin{macrocode}
2857 \tikzset{%
2858 timing/.style={/tikz,
2859 line cap=round, line join=round,
2860 timing/adjust@xy,
2861 every path/.append code={\tikz@expandcount=\tikztiming@expandcount\relax},
2862 },%
2863 }
2864 \tikzset{%
2865 timing/.cd,
2866 adjust@xy/.style={%
2867 /utils/exec={%
2868 \tikz@textfont
2869 \let\@tempa\fsize
2870 \let\fsize\@tempdima
2871 \fsize=\f@size pt\relax
2872 \pgfmathsetlength{\tikztiming@xunit}{\tikztiming@@xunit}%
2873 \pgfmathsetlength{\tikztiming@yunit}{\tikztiming@@yunit}%
2874 \let\fsize\@tempa
2875 },%
2876 /tikz/x=\tikztiming@xunit, /tikz/y=\tikztiming@yunit,
2877 },
2878 expand count/.store in={\tikztiming@expandcount},
2879 expand count=1000,
2880 unit/.style={%
2881 /utils/exec={%
2882 \def\tikztiming@@xunit{#1}%
2883 \let\tikztiming@@yunit\tikztiming@@xunit
2884 },%
2885 /tikz/timing/adjust@xy,%
2886 },
2887 xunit/.style={%
2888 /utils/exec={%
2889 \def\tikztiming@@xunit{#1}%
2890 },%
2891 /tikz/timing/adjust@xy,%
2892 },
2893 yunit/.style={%
2894 /utils/exec={%
2895 \def\tikztiming@@yunit{#1}%
2896 },%
2897 /tikz/timing/adjust@xy,%
2898 },
2899 font/.style={%
2900 /tikz/font={#1},
2901 /tikz/timing/adjust@xy
2902 },%
2903 initchar/.value required,
2904 initchar/.code={\uppercase{\gdef\tikztiming@lastchar{#1}}},
2905 metachar/.code={\tikztimingmetachar#1},
2906 grid/.style={timing,help lines},
2907 @grid/.code={\texttiminggrid},
2908 draw grid/.style={%
2909 timing/before text/.append style={timing/@grid},%
2910 timing/before/.append style={timing/@grid}%
2911 },
2912 no grid/.style={timing/@grid/.code={}},
2913 before/.code={},
2914 after/.code={},
2915 before text/.code={\texttimingbefore},
2916 after text/.code={\texttimingafter},
2917 picture/.style={timing,line width=0.15ex},
2918 intext/.style={timing,line width=0.15ex},
2919 inline node/.style={shape=coordinate},
2920 inline node/from char/.store in=\tikztiming@node@fromchar,
2921 inline node/to char/.store in=\tikztiming@node@tochar,
2922 table/.style={font=\sffamily,timing,line width=0.15ex},
2923 before table/.code={},
2924 after table/.code={},
2925 coord/.style={coordinate},
2926 save/.style={coordinate},
2927 restore/.style={/utils/exec={\expandafter\tikzset\expandafter{\tikztiming@saved@options}}},
2928 option/.style={/utils/exec={\g@addto@macro\tikztiming@saved@options{#1,}},#1},
2929 nooptions/.style={/utils/exec={\gdef\tikztiming@saved@options{}}},
2930 popoptions/.style={/utils/exec={\tikztiming@popoptions}},
2931 pushoptions/.style={/utils/exec={\tikztiming@pushoptions}},
2932 name/.style={inner sep=0pt,outer sep=0pt,minimum size=0pt},
2933 text format/.store in=\tikztiming@textformat,
2934 @/.style={},
2935 every char/.style={},
2936 every bg/.style={},
2937 D/.style={timing/d},
2938 D/text/.style={timing/d/text},
2939 D/background/.style={timing/d/background},
2940 D@edge@/.style={timing/d@edge@},
2941 D@edge@/text/.style={timing/d@edge@/text},
2942 D@edge@/background/.style={timing/d@edge@/background},
2943 U/.style={timing/u},
2944 U/text/.style={timing/u/text},
2945 U/background/.style={timing/u/background},
2946 U@edge@/.style={timing/u@edge@},
2947 U@edge@/text/.style={timing/u@edge@/text},
2948 U@edge@/background/.style={timing/u@edge@/background},
2949 H/.style={timing/h},
2950 L/.style={timing/l},
2951 E/.style={timing/e},
2952 E/background/.style={timing/e/background},
2953 M/decoration/.style={timing/m/decoration},
2954 M/base/.style={timing/m/base},
2955 M/.style={timing/m},
2956 G/.style={timing/g},
2957 Z/.style={timing/z},
2958 T/.style={timing/t},
2959 C/.style={timing/c},
2960 X/.style={timing/x},
2961 d/.style={},
2962 d/text/.style={timing,scale=0.6,font=\sffamily},
2963 d/background/.style={draw=none},
2964 d@edge@/.style={timing/d},
2965 d@edge@/text/.style={timing/d/text},
2966 d@edge@/background/.style={timing/d/background},
2967 u/.style={},
2968 u/background/.style={draw=none,fill=gray},
2969 u@edge@/.style={timing/u},
2970 u@edge@/text/.style={timing/u/text},
2971 u@edge@/background/.style={timing/u/background},
2972 h/.style={},
2973 l/.style={},
2974 e/.style={},
2975 e/background/.style={draw=none},
2976 m/decoration/.style={decorate,%
2977 decoration={zigzag,segment length=.25\tikztiming@xunit,
2978 amplitude=.225\tikztiming@yunit}},
2979 m/base/.style={black!40!brown},
2980 m/.style={timing/m/base,timing/m/decoration},
2981 g/.style={decorate=false},
2982 z/.style={blue},
2983 t/.style={},
2984 c/.style={timing/lslope=0.0},
2985 x/.style={red},
2986 table/grid/.style={timing/grid},
2987 table/lines/.style={},
2988 table/rules/.style={line width=0.08em,line cap=butt},
2989 table/midrules/.style={line width=0.05em,line cap=butt},
2990 table/header/.style={timing/name},
2991 table/label header/.style={},
2992 table/row header/.style={},
2993 slope/.code={%
2994 \tikztimingsetslope{#1}%
2995 \tikztimingsetdslope{2*#1}%
2996 \tikztimingsetzslope{#1/2}%
2997 },
2998 lslope/.code={\tikztimingsetslope{#1}},
2999 dslope/.code={\tikztimingsetdslope{#1}},
3000 zslope/.code={\tikztimingsetzslope{#1}},
3001 wscale/.code={\tikztimingsetwscale{#1}},
3002 coldist/.store in=\tikztiming@coldist,
3003 rowdist/.store in=\tikztiming@rowdist,
3004 outer xsep/.store in=\tikztiming@xsep,
3005 outer ysep/.store in=\tikztiming@ysep,
3006 outer sep/.style={/tikz/timing/outer xsep=#1,/tikz/timing/outer ysep=#1},
3007 %
3008 debug/level/.code={\tikztiming@debug=#1\relax},
3009 debug/level/.value required,
3010 debug/scope/.style={font=\sffamily\tiny,gray},
3011 debug/node/.style={above,inner sep=2pt},
3012 debug/nodes/.style={%
3013 /tikz/timing/after table/.append code={\tikztiming@marknodes{\tikztiming@namednodes}},
3014 /tikz/timing/after text/.append code={\tikztiming@marknodes{\tikztiming@namednodes}}
3015 },
3016 debug/markcmd/.store in={\tikztiming@markcmd},
3017 }
3018 \tikzset{timing/inline node/.cd,
3019 from char={}, to char={}
3020 }
3021 % \end{macrocode}
3022 %
3023 % \section{Text-Mode Macros}
3024 % \begin{macro}{\texttimingbefore}
3025 % This macro is executed inside the |tikzpicture| environment of \cs{texttiming}
3026 % before the timing diagram is drawn.
3027 % \begin{macrocode}
3028 \def\texttimingbefore{}
3029 % \end{macrocode}
3030 % \end{macro}
3031 %
3032 % \begin{macro}{\texttimingafter}
3033 % This macro is executed inside the |tikzpicture| environment of \cs{texttiming}
3034 % after the timing diagram is drawn.
3035 % \begin{macrocode}
3036 \def\texttimingafter{}
3037 % \end{macrocode}
3038 % \end{macro}
3039 %
3040 % \begin{macro}{\texttiminggrid}
3041 % Draws a background grid with the "timing/grid" setting. Should be used inside
3042 % \cs{texttimingbefore}.
3043 % \begin{macrocode}
3044 \def\texttiminggrid{%
3045 \draw[xstep={\timingwidth/2.},ystep={\timingheight/2.},timing/grid] (0,0) grid
3046 (\timingwidth*\tikztimingwidth,\timingheight);
3047 }
3048 % \end{macrocode}
3049 % \end{macro}
3050 %
3051 % \section{User Level Macros}
3052 %
3053 % \begin{macro}{\texttiming}[2]{Optional initial character}{Timing characters}
3054 % This macro now only parses it optional argument to check if it is a initial
3055 % character or some style settings and then calls \cs{timing} appropriately.
3056 % \begin{macrocode}
3057 \DeclareRobustCommand*\texttiming[2][]{%
3058 \begingroup
3059 \let\tikztiming@lastchar\empty
3060 \let\tikztiming@settings\empty
3061 \tikzset{timing/before/.append style={timing/before text}}%
3062 \tikzset{timing/after/.prefix style={timing/after text}}%
3063 \ifx\relax#1\relax\else
3064 \tikztiming@testoptarg#1\relax\relax%
3065 \fi
3066 \begin{tikzpicture}[timing/intext,baseline={(0,0)}]
3067 \tikztiming@picinit
3068 \def\@tempa{\expandafter\timing\expandafter[\tikztiming@settings] at (0,0)}%
3069 \expandafter\@tempa\expandafter{\expandafter[\tikztiming@lastchar]#2};%
3070 \end{tikzpicture}%
3071 \endgroup
3072 }
3073 % \end{macrocode}
3074 % \end{macro}
3075 %
3076 % \begin{macro}{\tikztiming@testoptarg}
3077 % \begin{macrocode}
3078 \def\tikztiming@testoptarg#1#2\relax{%
3079 \ifx\relax#2\relax
3080 \uppercase{\def\tikztiming@lastchar{#1}}%
3081 \else
3082 \def\tikztiming@settings{#1#2}%
3083 \fi
3084 }
3085 % \end{macrocode}
3086 % \end{macro}
3087 %
3088 % \begin{macro}{\tikztiming@picinit}
3089 % For things which should only by initialised once per |tikzpicture|.
3090 % \begin{macrocode}
3091 \def\tikztiming@picinit{%
3092 \global\let\tikztiming@namednodes\empty
3093 }
3094 \let\tikztiming@namednodes\empty
3095 % \end{macrocode}
3096 % \end{macro}
3097 %
3098 % \begin{macro}{\tikztiming@init}
3099 % \begin{macrocode}
3100 \def\tikztiming@init{%
3101 \def\tikztiming@lastchar{@}%
3102 \def\tikztiming@num{0}%
3103 \let\tikztiming@currentchar\empty
3104 \let\tikztiming@settings\empty
3105 \let\tikztiming@fromchar\empty
3106 \let\tikztiming@tochar\empty
3107 \let\setwscale\tikztimingsetwscale
3108 \def\wscale{\tikztiming@wscale}%
3109 \let\xunit\tikztiming@xunit
3110 \let\yunit\tikztiming@yunit
3111 \def\slope{\timingslope}%
3112 \def\lslope{\timingslope}%
3113 \def\zslope{\timingzslope}%
3114 \def\dslope{\timingdslope}%
3115 \gdef\tikztiming@saved@settings{}%
3116 \gdef\tikztiming@saved@options{}%
3117 \gdef\tikztiming@oldnodecenter@{}%
3118 \def\tikztimingwidth{0.0}%
3119 \setcounter{tikztimingtrans}{-1}%
3120 \setcounter{tikztimingtranspos}{0}%
3121 \tikztiming@initstr{%
3122 \useasboundingbox (0,0) rectangle (\tikztimingwidth,\timingheight);
3123 \draw [timing/every char] (0,0)
3124 coordinate (timing@refa)
3125 coordinate (timing@ref) at (0,\timingheight/2)
3126 coordinate (timing@refb) at (0,\timingheight)
3127 coordinate (timing/start)
3128 coordinate (timing/start base)
3129 }%
3130 }
3131 % \end{macrocode}
3132 % \end{macro}
3133 %
3134 % \begin{macro}{\tikz@timing}
3135 % \begin{macrocode}
3136 \def\tikz@timing{%
3137 \@ifnextchar{[}%
3138 {\tikz@timing@}%
3139 {\tikz@timing@[]}%
3140 }
3141 % \end{macrocode}
3142 % \end{macro}
3143 %
3144 % \begin{macro}{\tikz@installcommands}
3145 % Add \cs{timing} to the TikZ internal |\tikz@installcommands| macro.
3146 % The |\timing| macro will be installed at the begin of the |tikzpicture|.
3147 % \begin{macrocode}
3148 \g@addto@macro\tikz@installcommands{%
3149 \let\tikz@origtiming=\timing%
3150 \let\timing=\tikz@timing%
3151 }
3152 % \end{macrocode}
3153 % \end{macro}
3154 %
3155 % \begin{macro}{\tikz@uninstallcommands}
3156 % Add \cs{timing} to the TikZ internal |\tikz@uninstallcommands| macro.
3157 % The |\timing| macro will be uninstalled at the begin of nodes.
3158 % \begin{macrocode}
3159 \g@addto@macro\tikz@uninstallcommands{%
3160 \let\timing=\tikz@origtiming%
3161 }
3162 % \end{macrocode}
3163 % \end{macro}
3164 %
3165 % \begin{macro}{\tikz@timing@}[1]{Optional TikZ Keys}
3166 % \begin{macrocode}
3167 \def\tikz@timing@[#1]{%
3168 \@ifnextchar{a}%
3169 {\tikz@timing@at{#1}}%
3170 {\PackageWarning{tikz-timing}{The \string\timing\space command awaits now an
3171 `at' before the coordinate, like the \string\node\space command is doing.
3172 Please update your source code to ensure compatibility with newer
3173 versions}{}{}{}%
3174 \@ifnextchar{+}%
3175 {\tikz@timing@@{#1}}%
3176 {\@ifnextchar(%)
3177 {\tikz@timing@@{#1}}%
3178 {\tikz@timing@@{#1}++(0,0)}%
3179 }%
3180 }%
3181 }
3182 % \end{macrocode}
3183 % \end{macro}
3184 %
3185 % \begin{macro}{\tikz@timing@at}[1]{Optional TikZ Keys}
3186 % \begin{macrocode}
3187 \def\tikz@timing@at#1at#2(#3){%
3188 \tikz@timing@@@{#1}{#2(#3)}%
3189 }
3190 % \end{macrocode}
3191 % \end{macro}
3192 %
3193 % \begin{macro}{\tikz@timing@@}[3]{Optional TikZ Keys}{Potential `+' or
3194 % empty}{Coordinate}
3195 % \begin{macrocode}
3196 \def\tikz@timing@@#1#2(#3){%
3197 \tikz@timing@@@{#1}{#2(#3)}%
3198 }
3199 % \end{macrocode}
3200 % \end{macro}
3201 %
3202 % \begin{macro}{\tikz@timing@@@}[3]{Optional TikZ Keys}{Coordinate}{Timing
3203 % Characters}
3204 % \begin{macrocode}
3205 \def\tikz@timing@@@#1#2#3{%
3206 \begingroup
3207 \tikztiming@init
3208 \let\tikz@alias=\pgfutil@empty%
3209 \begin{scope}[shift={#2},timing,#1]%
3210 \@ifnextchar{[}%
3211 {\tikz@timing@@@init}%
3212 {\tikz@timing@@@init[]}%
3213 #3\relax
3214 \tikzset{timing/before}%
3215 \tikztiming@str;%
3216 \path let \p1 = (timing/end top), \p2 = (timing/end base),
3217 \p3 = (timing/end), \p4 = (timing/start) in
3218 [/utils/exec={%
3219 \xdef\tikztiming@northeast{\noexpand\pgfpoint{.5*\pgf@pt@aa*\x1}{.5*\pgf@pt@bb*\y1}}%
3220 \xdef\tikztiming@startpoint{\noexpand\pgfpoint{\pgf@pt@aa*(\x4-.5*\x1)}{\pgf@pt@bb*(\y4-.5*\y1)}}%
3221 \xdef\tikztiming@endpoint{\noexpand\pgfpoint{\pgf@pt@aa*(\x3-.5*\x1)}{\pgf@pt@bb*(\y3-.5*\y1)}}%
3222 }];
3223 \node [shape=tikztiming@shape,anchor=origin,#1] at (0,0) {};
3224 \tikzset{timing/after}%
3225 \end{scope}%
3226 \endgroup
3227 \tikz@timing@@@end
3228 }
3229 % \end{macrocode}
3230 % \end{macro}
3231 %
3232 % \begin{macro}{\tikz@timing@@@end}
3233 % \begin{macrocode}
3234 \def\tikz@timing@@@end{%
3235 \@ifnextchar{;}%
3236 {\@gobble}%
3237 {\PackageError{tikz-package}{Can not parse timing path}{}}%
3238 }
3239 % \end{macrocode}
3240 % \end{macro}
3241 %
3242 % \begin{macro}{\tikz@timing@@@init}[1]{Initial character.}
3243 % Opens a group which will end in \cs{tikztiming@parser@end}.
3244 % \begin{macrocode}
3245 \def\tikz@timing@@@init[#1]{%
3246 \begingroup
3247 \ifx\relax#1\relax\else
3248 \uppercase{\def\tikztiming@lastchar{#1}}%
3249 \fi
3250 \@ifundefined{tikztiming@initcode@\tikztiming@lastchar}%
3251 {}%
3252 {\@nameuse{tikztiming@initcode@\tikztiming@lastchar}}%
3253 \if @\tikztiming@lastchar\relax\else
3254 \tikztiming@iftrans{@\tikztiming@lastchar}%
3255 {\tikztiming@nameaddtostr{@}{\tikztiming@lastchar}{}}%
3256 {\PackageWarning{tikz-timing}{Start value for timing character
3257 '\tikztiming@lastchar' is not defined and will be ignored!}{}{}{}}%
3258 \fi
3259 \tikztiming@parser
3260 }
3261 % \end{macrocode}
3262 % \end{macro}
3263 %
3264 % \section{Internal Macros}
3265 %
3266 % \begin{macro}{\tikztiming@trans@}
3267 % \begin{macrocode}
3268 \def\tikztiming@trans@#1#2#3#4{%
3269 \unexpanded\expandafter\expandafter\expandafter{%
3270 \csname\tikztiming@prefix #2#3#4\endcsname{#1}{#2}{#3}{#4}
3271 }%
3272 }
3273 % \end{macrocode}
3274 % \end{macro}
3275 %
3276 % \begin{macro}{\tikztiming@beforenextcode@D@edge@}
3277 % \begin{macrocode}
3278 \def\tikztiming@beforenextcode@D@edge@{%
3279 \if D\tikztiming@currentchar\else
3280 \gdef\tikztiming@lastchar{D}%
3281 \fi
3282 }
3283 % \end{macrocode}
3284 % \end{macro}
3285 %
3286 % \begin{macro}{\tikztiming@beforenextcode@U@edge@}
3287 % \begin{macrocode}
3288 \def\tikztiming@beforenextcode@U@edge@{%
3289 \if U\tikztiming@currentchar\else
3290 \gdef\tikztiming@lastchar{U}%
3291 \fi
3292 }
3293 % \end{macrocode}
3294 % \end{macro}
3295 %
3296 % \begin{macro}{\tikztiming@initcode@}
3297 % If empty init char was given, exchange it with "@".
3298 % \begin{macrocode}
3299 \def\tikztiming@initcode@{%
3300 \gdef\tikztiming@lastchar{@}%
3301 }
3302 % \end{macrocode}
3303 % \end{macro}
3304 %
3305 % \begin{macro}{\tikztiming@initcode@D}
3306 % \begin{macrocode}
3307 \def\tikztiming@initcode@D{%
3308 \gdef\tikztiming@lastchar{D@edge@}%
3309 }
3310 % \end{macrocode}
3311 % \end{macro}
3312 %
3313 % \begin{macro}{\tikztiming@initcode@U}
3314 % \begin{macrocode}
3315 \def\tikztiming@initcode@U{%
3316 \gdef\tikztiming@lastchar{U@edge@}%
3317 }
3318 % \end{macrocode}
3319 % \end{macro}
3320 %
3321 % \begin{macro}{\tikztiming@parser}
3322 % \begin{macrocode}
3323 \def\tikztiming@parser{%
3324 \@ifnextchar\relax
3325 {\tikztiming@parser@end}%
3326 {\tikztiming@testfornum}%
3327 }
3328 % \end{macrocode}
3329 % \end{macro}
3330 %
3331 % \section{Add-to-Macro Macros}
3332 % \begin{macro}{\tikztiming@eaddto}[2]{Macro name}{Tokens to add to macro}
3333 % \begin{macrocode}
3334 \def\tikztiming@eaddto#1#2{%
3335 \begingroup
3336 \tikztiming@internaldefs
3337 \@temptokena\expandafter{#1}%
3338 \xdef#1{%
3339 \the\@temptokena
3340 #2%
3341 }%
3342 \endgroup
3343 }
3344 % \end{macrocode}
3345 % \end{macro}
3346 %
3347 % \begin{macrocode}
3348 \iftrue
3349 % \end{macrocode}
3350 %
3351 % \begin{macro}{\tikztiming@initstr}
3352 % \begin{macrocode}
3353 \long\def\tikztiming@initstr{%
3354 \def\tikztiming@str
3355 }
3356 % \end{macrocode}
3357 % \end{macro}
3358 %
3359 % \begin{macro}{\tikztiming@eaddtostr}
3360 % \begin{macrocode}
3361 \def\tikztiming@eaddtostr{%
3362 \tikztiming@eaddto\tikztiming@str
3363 }
3364 % \end{macrocode}
3365 % \end{macro}
3366 %
3367 % \begin{macro}{\tikztiming@addtostr}
3368 % \begin{macrocode}
3369 \def\tikztiming@addtostr{%
3370 \g@addto@macro\tikztiming@str
3371 }
3372 % \end{macrocode}
3373 % \end{macro}
3374 %
3375 % \begin{macrocode}
3376 \else
3377 % \end{macrocode}
3378 %
3379 % \begin{macro}{\tikztiming@str}
3380 % \begin{macrocode}
3381 \def\tikztiming@file{\jobname.ttg}
3382 \newwrite\tikztiming@fh
3383 \def\tikztiming@str{%
3384 \tikztiming@addtostr{;}%
3385 \immediate\closeout\tikztiming@fh
3386 \begingroup
3387 \makeatletter
3388 \@@input\tikztiming@file\relax
3389 \endgroup
3390 \@ifnextchar;{\@gobble}{}%
3391 }
3392 % \end{macrocode}
3393 % \end{macro}
3394 %
3395 % \begin{macro}{\tikztiming@initstr}
3396 % \begin{macrocode}
3397 \long\def\tikztiming@initstr{%
3398 \immediate\openout\tikztiming@fh= \tikztiming@file\relax
3399 \tikztiming@addtostr
3400 }
3401 % \end{macrocode}
3402 % \end{macro}
3403 %
3404 % \begin{macro}{\tikztiming@eaddtostr}
3405 % \begin{macrocode}
3406 \long\def\tikztiming@eaddtostr#1{%
3407 \begingroup
3408 \tikztiming@internaldefs
3409 \let\par\empty
3410 \immediate\write\tikztiming@fh{#1}%
3411 \endgroup
3412 }
3413 % \end{macrocode}
3414 % \end{macro}
3415 %
3416 % \begin{macro}{\tikztiming@addtostr}
3417 % \begin{macrocode}
3418 \long\def\tikztiming@addtostr#1{%
3419 \begingroup
3420 \tikztiming@internaldefs
3421 \let\par\empty
3422 \immediate\write\tikztiming@fh{\unexpanded{#1}}%
3423 \endgroup
3424 }
3425 % \end{macrocode}
3426 % \end{macro}
3427 %
3428 % \begin{macrocode}
3429 \fi
3430 % \end{macrocode}
3431 %
3432 %
3433 % \begin{macro}{\tikztiming@makeglobal}
3434 % \begin{macrocode}
3435 \def\tikztiming@makeglobal#1{%
3436 \global\let#1#1\relax\relax
3437 }
3438 % \end{macrocode}
3439 % \end{macro}
3440 %
3441 % \begin{macro}{\tikztiming@iftrans}[1]{Characters}
3442 % \begin{macrocode}
3443 \def\tikztiming@trans{}%
3444 \def\tikztiming@iftrans#1{%
3445 \tikztiming@iftrans@#1\empty\empty\empty\relax
3446 }
3447 % \end{macrocode}
3448 % \end{macro}
3449 %
3450 % \begin{macro}{\tikztiming@iftrans}[4]
3451 % {First character}{Second character}
3452 % {Next character or empty}{Eats token till end marker}
3453 % \begin{macrocode}
3454 \def\tikztiming@iftrans@#1#2#3#4\relax{%
3455 \begingroup
3456 \xdef\tikztiming@trans{#1#2}%
3457 \ifx\tikztiming@trans\empty
3458 \gdef\tikztiming@trans{{@}{}{@}}%
3459 \else
3460 \global\let\tikztiming@trans\relax
3461 % Use triple macros before double macros
3462 \@ifundefined{tikztiming@triple@#2}%
3463 {\@ifundefined{\tikztiming@prefix#1#2}%
3464 {}%
3465 {\xdef\tikztiming@trans{{#1}{#2}{}}}%
3466 }%
3467 {%
3468 \@ifundefined{\tikztiming@prefix#1#2#3}%
3469 {}%
3470 {\xdef\tikztiming@trans{{#1}{#2}{#3}}}%
3471 }%
3472 % If both do not exist, search for aliases:
3473 \ifx\tikztiming@trans\relax
3474 \@ifundefined{tikztiming@alias@#1}%
3475 {\edef\chara{{#1}}}%
3476 {\edef\chara{{#1},{\csname tikztiming@alias@#1\endcsname}}}%
3477 \@ifundefined{tikztiming@alias@#2}%
3478 {\edef\charb{{#2}}}%
3479 {\edef\charb{{#2},{\csname tikztiming@alias@#2\endcsname}}}%
3480 \@ifundefined{tikztiming@triple@#2}%
3481 {\def\charc{\empty}}%
3482 {%
3483 \@ifundefined{tikztiming@alias@#3}%
3484 {\edef\charc{{#3},}}%
3485 {\edef\charc{{#3},{\csname tikztiming@alias@#3\endcsname},}}%
3486 }%
3487 \ifx\charb\empty
3488 \def\charb{\empty}%
3489 \fi
3490 \let\tikztiming@next\relax
3491 \foreach \b in \charb {%
3492 \foreach \a in \chara {%
3493 \foreach \c in \charc {%
3494 %\message{ ^^J Testing: \a\b\c ^^J}%
3495 \@ifundefined{\tikztiming@prefix\a\b\c}%
3496 {}{%
3497 \xdef\tikztiming@trans{{#1}{#2}{#3}}%
3498 \expandafter\tikztimingcpy\expandafter
3499 {\tikztiming@trans}{\a\b\c}%
3500 \ifnum\tikztiming@debug>0
3501 \message{^^J DEBUG: '#1#2#3' = '\a\b\c' ^^J}%
3502 \fi
3503 \expandafter\tikztiming@makeglobal
3504 \csname\tikztiming@pfxtr\tikztiming@trans\endcsname
3505 \ifnum\tikztiming@debug>1
3506 \ifnum\tikztiming@debug>2
3507 \expandafter\show\csname\tikztiming@pfxtr\tikztiming@trans\endcsname
3508 \else
3509 \message{^^J\tikztiming@trans:
3510 \expandafter\meaning\csname\tikztiming@pfxtr\tikztiming@trans\endcsname^^J}%
3511 \message{^^J\a\b\c:
3512 \expandafter\meaning\csname\tikztiming@prefix\a\b\c\endcsname^^J}%
3513 \fi
3514 \fi
3515 \global\let\tikztiming@next\breakforeach
3516 }%
3517 \tikztiming@next
3518 }%
3519 \tikztiming@next
3520 }%
3521 \tikztiming@next
3522 }%
3523 \fi
3524 \fi
3525 \endgroup
3526 \ifx\tikztiming@trans\relax
3527 \expandafter\@secondoftwo
3528 \else
3529 \expandafter\@firstoftwo
3530 \fi
3531 }
3532 % \end{macrocode}
3533 % \end{macro}
3534 %
3535 % \begin{macro}{\tikztiming@nameaddtostr}
3536 % {First character}{Second character}
3537 % {Optional next character}
3538 % \begin{macrocode}
3539 \def\tikztiming@nameaddtostr#1#2#3{%
3540 \tikztiming@iftrans{{#1}{#2}{#3}}%
3541 {%
3542 %\edef\@tempa{\noexpand\tikztiming@trans@{\tikztiming@num}\tikztiming@trans}%
3543 %\expandafter\tikztiming@addtostr
3544 %\expandafter{\@tempa}%
3545 \edef\@tempa{\noexpand\tikztiming@trans@{\tikztiming@num}\tikztiming@trans}%
3546 %\tikztiming@eaddtostr{\@percentchar\space {#1}{#2}{#3}}%
3547 \tikztiming@eaddtostr{\@tempa}%
3548 %\tikztiming@eaddtostr{\tikztiming@trans@{\tikztiming@num}\tikztiming@trans}%
3549 }%
3550 {\PackageWarning{tikz-timing}{No transitions '#1#2' (or '#1#2#3') defined!}}%
3551 }
3552 % \end{macrocode}
3553 % \end{macro}
3554 %
3555 % \begin{macro}{\tikztiming@output@addcode}
3556 % Adds code to the output code buffer. The code will not be expanded, i.e.\ will
3557 % be protected from the expansion when the buffer is flushed.
3558 % \begin{macrocode}
3559 \def\tikztiming@output@addcode#1{%
3560 \g@addto@macro\tikztiming@output@bufcode{\unexpanded{ #1 }}%
3561 }
3562 % \end{macrocode}
3563 % \end{macro}
3564 %
3565 % \begin{macro}{\tikztiming@output@eaddcode}
3566 % Adds code to the output code buffer. The code will be expanded when the buffer
3567 % is flushed.
3568 % \begin{macrocode}
3569 \def\tikztiming@output@eaddcode#1{%
3570 \g@addto@macro\tikztiming@output@bufcode{ #1 }%
3571 }
3572 % \end{macrocode}
3573 % \end{macro}
3574 %
3575 % \begin{macro}{\tikztiming@output@Eaddcode}
3576 % Adds code to the output code buffer. The code will be expanded immediately and
3577 % again when the buffer is flushed.
3578 % \begin{macrocode}
3579 \def\tikztiming@output@Eaddcode{%
3580 \tikztiming@eaddto\tikztiming@output@bufcode%
3581 }
3582 % \end{macrocode}
3583 % \end{macro}
3584 %
3585 %
3586 % \section{Output Routine}
3587 %
3588 % Init buffer macros:
3589 % \begin{macrocode}
3590 \def\tikztiming@output@bufchara{}%
3591 \def\tikztiming@output@bufcharb{}%
3592 \def\tikztiming@output@bufnum{0}%
3593 \def\tikztiming@output@bufcode{}%
3594 \def\tikztiming@output@nextchar{}%
3595 % \end{macrocode}
3596 %
3597 % \begin{macro}{\tikztiming@output}[2]{Character 1}{Character 2}
3598 % \begin{macrocode}
3599 \def\tikztiming@output#1#2{%
3600 \edef\tikztiming@fromchar{#1}%
3601 \edef\tikztiming@tochar{#2}%
3602 \ifx\relax#2\relax
3603 %\tikztiming@output@codeflush
3604 \tikztiming@nameaddtostr{}{#1}{}%
3605 \else
3606 \ifcase0%
3607 \ifx\tikztiming@output@bufchara\empty
3608 \ifx\tikztiming@output@bufcharb\empty
3609 1%
3610 \fi
3611 \fi\relax
3612 % not empty
3613 \edef\tikztiming@output@currentchar{#2}%
3614 \ifcase0%
3615 \ifx\tikztiming@output@bufcode\empty% Stop combining if code was inserted
3616 \expandafter\ifx\csname tikztiming@nocombine@#2\endcsname\relax
3617 \ifx\tikztiming@output@currentchar\tikztiming@output@bufcharb
3618 2%
3619 \fi
3620 \fi
3621 \else
3622 1%
3623 \fi
3624 \relax
3625 \edef\tikztiming@output@nextchar{#2}%
3626 \tikztiming@output@flush
3627 \xdef\tikztiming@output@bufchara{#1}%
3628 \xdef\tikztiming@output@bufcharb{#2}%
3629 \or
3630 \edef\tikztiming@output@nextchar{#2}%
3631 \tikztiming@output@flush
3632 \xdef\tikztiming@output@bufchara{#1}%
3633 \xdef\tikztiming@output@bufcharb{#2}%
3634 \or
3635 \pgfmathparse{\tikztiming@output@bufnum + \tikztiming@num}%
3636 \global\let\tikztiming@output@bufnum\pgfmathresult
3637 \fi
3638 \else % empty
3639 \tikztiming@output@codeflush
3640 \xdef\tikztiming@output@bufchara{#1}%
3641 \xdef\tikztiming@output@bufcharb{#2}%
3642 \global\let\tikztiming@output@bufnum\tikztiming@num
3643 \fi
3644 \fi
3645 }
3646 % \end{macrocode}
3647 % \end{macro}
3648 %
3649 % \begin{macro}{\tikztiming@output@flush}
3650 % \begin{macrocode}
3651 \def\tikztiming@output@flush{%
3652 \tikztiming@output@charflush
3653 \tikztiming@output@codeflush
3654 }
3655 % \end{macrocode}
3656 % \end{macro}
3657 %
3658 % \begin{macro}{\tikztiming@output@codeflush}
3659 % \begin{macrocode}
3660 \def\tikztiming@output@codeflush{%
3661 \ifx\tikztiming@output@bufcode\empty\else
3662 \tikztiming@eaddtostr{\tikztiming@output@bufcode}%
3663 \global\let\tikztiming@output@bufcode\empty%
3664 \fi
3665 }
3666 % \end{macrocode}
3667 % \end{macro}
3668 %
3669 % \begin{macro}{\tikztiming@output@charflush}
3670 % A group is used to protect the current value of |num| which is the length of
3671 % the new character after the flushed old character. This value will be assigned
3672 % to the new buffer length |bufnum|.
3673 % \begin{macrocode}
3674 \def\tikztiming@output@charflush{%
3675 \begingroup
3676 \let\tikztiming@num\tikztiming@output@bufnum
3677 \tikztiming@nameaddtostr
3678 {\tikztiming@output@bufchara}%
3679 {\tikztiming@output@bufcharb}%
3680 {\tikztiming@output@nextchar}%
3681 \endgroup%
3682 \gdef\tikztiming@output@nextchar{}%
3683 \gdef\tikztiming@output@bufchara{}%
3684 \gdef\tikztiming@output@bufcharb{}%
3685 \global\let\tikztiming@output@bufnum\tikztiming@num
3686 }
3687 % \end{macrocode}
3688 % \end{macro}
3689 %
3690 %
3691 % \section{Macros for Character Definitions}
3692 %
3693 % \begin{macro}{\tikztiming@nameedef}[4]{Macro name to be defined (without
3694 % prefix)}{Content of macro}
3695 % Defines internal tikztiming macro with name |\|\meta{prefix}\meta{name (\#2)}.
3696 % The macro definition (\#3) is expanded while the internal drawing definitions
3697 % are active.
3698 % \begin{macrocode}
3699 \newcommand\tikztiming@nameedef[4]{%
3700 \def\@gtempa##1{#4}%
3701 \begingroup
3702 \tikztiming@internaldefs
3703 \xdef\@gtempa##1##2##3##4{\@gtempa{\width}}%
3704 \endgroup
3705 \expandafter\let\csname\tikztiming@prefix#1#2#3\endcsname\@gtempa
3706 \let\@gtempa\empty
3707 }
3708 % \end{macrocode}
3709 % \end{macro}
3710 %
3711 % \begin{macro}{\tikztiming@namelet}[2]{Original Characters}{New Characters}
3712 % Only execute |\let| if the original macro is defined or the destination macro
3713 % is defined and would now set to undefined.
3714 % \begin{macrocode}
3715 \newcommand\tikztiming@namelet[2]{%
3716 \ifcase0%
3717 \@ifundefined{\tikztiming@prefix#2}%
3718 {\@ifundefined{\tikztiming@prefix#1}%
3719 {0}{1}%
3720 }%
3721 {1}%
3722 \relax
3723 \else
3724 \expandafter\let
3725 \csname\tikztiming@prefix#1\expandafter\endcsname
3726 \csname\tikztiming@prefix#2\endcsname
3727 \fi
3728 }
3729 % \end{macrocode}
3730 % \end{macro}
3731 %
3732 %
3733 % \section{Parser}
3734 %
3735 % \begin{macro}{\tikztiming@parser@end}
3736 % \begin{macrocode}
3737 \def\tikztiming@parser@end{%
3738 \def\tikztiming@output@nextchar{@}%
3739 \let\tikztiming@fromchar\tikztiming@tochar
3740 \edef\tikztiming@tochar{@}%
3741 \tikztiming@output@flush
3742 \global\let\tikztimingwidth\tikztimingwidth
3743 \tikztiming@addtostr{ coordinate (timing/end)
3744 let \p1 = (timing/start base), \p2 = (timing/end), \p3 = (0,1) in
3745 coordinate (timing/end base) at (\x2,\y1)
3746 coordinate (timing/end top) at (\x2,\y1+\y3)
3747 }%
3748 \endgroup
3749 \tikztiming@endhook%
3750 }
3751 \let\tikztiming@endhook\relax
3752 % \end{macrocode}
3753 % \end{macro}
3754 %
3755 % \begin{macro}{\tikztiming@parser@}[1]{Next Character}
3756 % \begin{macrocode}
3757 \def\tikztiming@parser@#1{%
3758 \ifx\relax#1\empty
3759 \expandafter\tikztiming@parser@end
3760 \else
3761 \tikztiming@iflower{#1}%
3762 {\tikztiming@setnum{\tikztiming@num/2}}%
3763 {}%
3764 \ifx\tikztiming@back\empty\else
3765 \tikztiming@setnum{\tikztiming@num - \tikztiming@back}%
3766 \global\let\tikztiming@back\empty
3767 \fi
3768 \pgfmathparse{\tikztimingwidth + \tikztiming@num}%
3769 \global\let\tikztimingwidth\pgfmathresult
3770 \uppercase{\gdef\tikztiming@currentchar{#1}}%
3771 \@nameuse{tikztiming@beforenextcode@\tikztiming@lastchar}%
3772 \@nameuse{tikztiming@beforecode@\tikztiming@currentchar}%
3773 \tikztiming@output{\tikztiming@lastchar}{\tikztiming@currentchar}%
3774 \global\let\tikztiming@lastchar\tikztiming@currentchar
3775 \@nameuse{tikztiming@aftercode@\tikztiming@currentchar}%
3776 \expandafter\lowercase\expandafter{%
3777 \expandafter\def\expandafter\@tempa
3778 \expandafter{\tikztiming@currentchar}%
3779 }%
3780 \pgfkeysifdefined{/tikz/timing/\@tempa/text/.@cmd}%
3781 {\expandafter\expandafter\expandafter\tikztiming@testfortext}%
3782 {\expandafter\expandafter\expandafter\tikztiming@parser}%
3783 \fi
3784 }
3785 % \end{macrocode}
3786 % \end{macro}
3787 %
3788 % \begin{macro}{\tikztiming@testfortext}
3789 % \begin{macrocode}
3790 \def\tikztiming@testfortext{%
3791 \@ifnextchar\bgroup
3792 {\tikztiming@handletext}%
3793 {\tikztiming@parser}%
3794 }
3795 % \end{macrocode}
3796 % \end{macro}
3797 %
3798 % \begin{macro}{\tikztiming@handletext}[1]{Text}
3799 % Looks ahead if the current character is the last one and sets the end-of-line
3800 % marker if so.
3801 %
3802 % This seems outdated because |handletext@| does not flush the output any more.
3803 % \begin{macrocode}
3804 \def\tikztiming@handletext#1{%
3805 \@ifnextchar\relax
3806 {\def\tikztiming@output@nextchar{@}\tikztiming@handletext@{#1}}%
3807 {\def\tikztiming@output@nextchar{Z}\tikztiming@handletext@{#1}}%
3808 }
3809 % \end{macrocode}
3810 % \end{macro}
3811 %
3812 % \begin{macro}{\tikztiming@handletext@}[1]{Text}
3813 % \begin{macrocode}
3814 \def\tikztiming@handletext@#1{%
3815 \@ifnextchar{[}%
3816 {\tikztiming@handletext@@}%
3817 {\tikztiming@handletext@@[]}%
3818 #1\tikztiming@endoftext
3819 }
3820 % \end{macrocode}
3821 % \end{macro}
3822 %
3823 % \begin{macro}{\tikztiming@handletext@@}[2]{Optional Settings}{Text}
3824 % \begin{macrocode}
3825 \def\tikztiming@handletext@@[#1]#2\tikztiming@endoftext{%
3826 \@ifnextchar{\relax}%
3827 {\def\tikztiming@output@nextchar{@}%
3828 \tikztiming@handletext@@@{#1}{#2}}%
3829 {\tikztiming@handletext@@@{#1}{#2}}%
3830 }
3831 % \end{macrocode}
3832 % \end{macro}
3833 %
3834 % \begin{macro}{\tikztiming@handletext@@@}[2]{Optional Settings}
3835 % {Text}
3836 % \begin{macrocode}
3837 \def\tikztiming@handletext@@@#1#2{%
3838 \expandafter\lowercase\expandafter{%
3839 \expandafter\def\expandafter\@tempa
3840 \expandafter{\tikztiming@currentchar}%
3841 }%
3842 \edef\@tempa{node [timing/\@tempa/text,}%
3843 \expandafter\tikztiming@output@addcode\expandafter{%
3844 \@tempa
3845 #1] at ($ (timing@dstart) !.5! (timing@dend) $)
3846 {\tikztiming@textformat{#2}}
3847 }%
3848 \ifcase0%
3849 \if @\tikztiming@output@bufchara
3850 1%
3851 \else
3852 \ifx\tikztiming@output@bufchara\tikztiming@currentchar
3853 1%
3854 \fi
3855 \fi
3856 \relax
3857 \else
3858 \fi
3859 \xdef\tikztiming@output@bufcharb{\tikztiming@currentchar @edge@}%
3860 \xdef\tikztiming@lastchar{\tikztiming@currentchar @edge@}%
3861 \tikztiming@parser
3862 }
3863 \let\tikztiming@textformat\empty
3864 % \end{macrocode}
3865 % \end{macro}
3866 %
3867 % \section{Definition of Modifiers}
3868 %
3869 % \begin{macro}{\tikztiming@defcode}[1]{Code Character}
3870 % \begin{macrocode}
3871 \def\tikztiming@defcode#1{%
3872 \@namedef{tikztiming@code@\meaning#1}%
3873 }
3874 % \end{macrocode}
3875 % \end{macro}
3876 %
3877 % \begin{macro}{\tikztiming@defcode{@}}
3878 % Simply executes given code. The |\relax| is added to have some protection
3879 % against user code manipulating the parser macro. The "@" character can be both
3880 % a letter (in style files) and a character (in user documents), so it is
3881 % defined twice.
3882 % \begin{macrocode}
3883 \tikztiming@defcode{@}#1{%
3884 #1\relax
3885 \tikztiming@parser
3886 }
3887 \begingroup
3888 \expandafter\let\expandafter\temp
3889 \csname tikztiming@code@\meaning @\endcsname
3890 \makeatother
3891 \expandafter\global\expandafter\let
3892 \csname tikztiming@code@\meaning @\endcsname\temp
3893 \endgroup
3894 % \end{macrocode}
3895 % \end{macro}
3896 %
3897 % \begin{macro}{\tikztiming@defcode{DOLLAR}}
3898 % Takes the code between two dollar signs and parses it as math expression. The
3899 % result is put back on the input stream. This allows the calculation of
3900 % character width.
3901 % \begin{macrocode}
3902 \tikztiming@defcode$#1${%
3903 \pgfmathparse{#1}%
3904 \expandafter
3905 \tikztiming@parser\pgfmathresult
3906 }
3907 % \end{macrocode}
3908 % \end{macro}
3909 %
3910 % \begin{macro}{\tikztiming@defcode{,}}
3911 % \begin{macrocode}
3912 \tikztiming@defcode{,}{%
3913 \tikztiming@output@eaddcode{%
3914 \newdraw [timing/every char]
3915 }%
3916 \tikztiming@parser
3917 }
3918 % \end{macrocode}
3919 % \end{macro}
3920 %
3921 % \begin{macro}{\tikztiming@defcode{;}}
3922 % \begin{macrocode}
3923 \tikztiming@defcode{;}{%
3924 \endgroup\begingroup
3925 \tikztiming@output@eaddcode{%
3926 \newdrawns [timing/every char]
3927 }%
3928 \tikztiming@parser
3929 }
3930 % \end{macrocode}
3931 % \end{macro}
3932 %
3933 % \begin{macro}{\tikztiming@defcode{N}}
3934 % \begin{macrocode}
3935 \tikztiming@defcode{N}{%
3936 \@ifnextchar[%]
3937 {\tikztiming@addnode@getoptions}%
3938 {\tikztiming@addnode@getoptions[]}%
3939 }
3940 % \end{macrocode}
3941 % \end{macro}
3942 %
3943 % \begin{macro}{\tikztiming@defcode{n}}
3944 % \begin{macrocode}
3945 \tikztiming@defcode{n}{%
3946 \@ifnextchar[%]
3947 {\tikztiming@addnode@getoptions}%
3948 {\tikztiming@addnode@getoptions[]}%
3949 }
3950 % \end{macrocode}
3951 % \end{macro}
3952 %
3953 % \begin{macro}{\tikztiming@defcode{B}}
3954 % \begin{macrocode}
3955 \tikztiming@defcode{B}{%
3956 \pgfmathparse{\tikztiming@back+\tikztiming@num}%
3957 \global\let\tikztiming@back\pgfmathresult
3958 \tikztiming@parser
3959 }
3960 % \end{macrocode}
3961 % \end{macro}
3962 %
3963 % \begin{macro}{\tikztiming@defcode{b}}
3964 % \begin{macrocode}
3965 \tikztiming@defcode{b}{%
3966 \pgfmathparse{\tikztiming@back+\tikztiming@num/2}%
3967 \global\let\tikztiming@back\pgfmathresult
3968 \tikztiming@parser
3969 }
3970 % \end{macrocode}
3971 % \end{macro}
3972 %
3973 % \begin{macro}{\tikztiming@defcode{F}}
3974 % \begin{macrocode}
3975 \tikztiming@defcode{F}{%
3976 \pgfmathparse{\tikztiming@back-\tikztiming@num}%
3977 \global\let\tikztiming@back\pgfmathresult
3978 \tikztiming@parser
3979 }
3980 % \end{macrocode}
3981 % \end{macro}
3982 %
3983 % \begin{macro}{\tikztiming@defcode{f}}
3984 % \begin{macrocode}
3985 \tikztiming@defcode{f}{%
3986 \pgfmathparse{\tikztiming@back-\tikztiming@num/2}%
3987 \global\let\tikztiming@back\pgfmathresult
3988 \tikztiming@parser
3989 }
3990 % \end{macrocode}
3991 % \end{macro}
3992 %
3993 %
3994 % \begin{macro}{\tikztiming@defcode []}[1]{Options}
3995 % Single brackets are in-picture options.
3996 % Brackets and a "!" sign "[! !]" are parser options.
3997 % Double brackets are both.
3998 %
3999 % Brackets and "| |" signs "[| |]" are only-once in-picture options.
4000 % \begin{macrocode}
4001 \tikztiming@defcode[{%}]{
4002 \@ifnextchar[%]
4003 {\tikztiming@bothoption}%
4004 {\@ifnextchar{!}%
4005 {\tikztiming@parseroption}%
4006 {\@ifnextchar{|}%
4007 {\tikztiming@onceoption}%
4008 {\tikztiming@addoption}%
4009 }%
4010 }%
4011 }
4012 % \end{macrocode}
4013 % \end{macro}
4014 %
4015 % \begin{macro}{\tikztiming@parseroption}[1]{Options}
4016 % Sets the given options immediately, so that they are in affect for the rest of
4017 % the parser run.
4018 % \begin{macrocode}
4019 \def\tikztiming@parseroption!#1!]{%
4020 \pgfqkeys{/tikz/timing}{#1}%
4021 \tikztiming@parser
4022 }
4023 % \end{macrocode}
4024 % \end{macro}
4025 %
4026 % \begin{macro}{\tikztiming@addoption}[1]{Options}
4027 % Adds the options to the internal list of timing options.
4028 % \begin{macrocode}
4029 \def\tikztiming@addoption#1]{%
4030 \tikztiming@output@addcode{ [timing/option={#1}] }%
4031 \tikztiming@parser
4032 }
4033 % \end{macrocode}
4034 % \end{macro}
4035 %
4036 % \begin{macro}{\tikztiming@bothoption}[1]{Options}
4037 % Does executes and adds the options to the output code buffer. This is
4038 % necessary for slopes if they are used in width calculations.
4039 % \begin{macrocode}
4040 \def\tikztiming@bothoption[#1]]{%
4041 \tikzset{#1}%[
4042 \tikztiming@addoption{#1}]%
4043 }
4044 % \end{macrocode}
4045 % \end{macro}
4046 %
4047 % \begin{macro}{\tikztiming@onceoption}[1]{Options}
4048 % Simply adds the options to the output code buffer.
4049 % \begin{macrocode}
4050 \def\tikztiming@onceoption|#1|]{%
4051 \tikztiming@output@addcode{ [#1] }%
4052 \tikztiming@parser
4053 }
4054 % \end{macrocode}
4055 % \end{macro}
4056 %
4057 %
4058 % \subsection{Local Scopes, Push/Pop Options}
4059 %
4060 % \begin{macro}{\tikztiming@defcode bgroup}
4061 % \begin{macrocode}
4062 \tikztiming@defcode{\bgroup}{%
4063 \tikztiming@output@eaddcode{%
4064 [timing/pushoptions]
4065 \newdraw [timing/every char]
4066 }%
4067 \tikztiming@parser
4068 }
4069 % \end{macrocode}
4070 % \end{macro}
4071 %
4072 % \begin{macro}{\tikztiming@defcode egroup}
4073 % \begin{macrocode}
4074 \tikztiming@defcode{\egroup}{%
4075 \tikztiming@output@eaddcode{%
4076 [timing/popoptions]
4077 \newdraw [timing/every char]
4078 }%
4079 \tikztiming@parser
4080 }
4081 % \end{macrocode}
4082 % \end{macro}
4083 %
4084 % \begin{macro}{\tikztiming@popoptions}
4085 % \begin{macrocode}
4086 \def\tikztiming@popoptions{%
4087 \expandafter\tikztiming@popoptions@\tikztiming@optionstack\relax
4088 }
4089 \def\tikztiming@optionstack{{}}
4090 % \end{macrocode}
4091 % \end{macro}
4092 %
4093 % \begin{macro}{\tikztiming@popoptions@}
4094 % \begin{macrocode}
4095 \def\tikztiming@popoptions@#1#2\relax{%
4096 \gdef\tikztiming@saved@options{#1}%
4097 \gdef\tikztiming@optionstack{#2}%
4098 \ifx\tikztiming@optionstack\empty
4099 \gdef\tikztiming@optionstack{{}}%
4100 \fi
4101 }
4102 % \end{macrocode}
4103 % \end{macro}
4104 %
4105 %
4106 % \begin{macro}{\tikztiming@pushoptions}
4107 % \begin{macrocode}
4108 \def\tikztiming@pushoptions{%
4109 \expandafter\expandafter\expandafter\gdef
4110 \expandafter\expandafter\expandafter\tikztiming@optionstack
4111 \expandafter\expandafter\expandafter{%
4112 \expandafter\expandafter\expandafter{\expandafter\tikztiming@saved@options\expandafter}\tikztiming@optionstack}%
4113 }
4114 % \end{macrocode}
4115 % \end{macro}
4116 %
4117 %
4118 % \subsection{Add-Node Macros}
4119 %
4120 % \begin{macro}{\tikztiming@addnode}[1]{Options}
4121 % \begin{macrocode}
4122 \def\tikztiming@addnode@getoptions[#1]{%
4123 \@ifnextchar(%)
4124 {\tikztiming@addnode@getname{#1}}%
4125 {\tikztiming@addnode@getname{#1}()}%
4126 }
4127 % \end{macrocode}
4128 % \end{macro}
4129 %
4130 % \begin{macro}{\tikztiming@addnode@getname}[2]{Previous read options}{Node name}
4131 % \begin{macrocode}
4132 \def\tikztiming@addnode@getname#1(#2){%
4133 \@ifnextchar\bgroup
4134 {\tikztiming@addnode@{#1}{#2}}%
4135 {\tikztiming@addnode@{#1}{#2}{}}%
4136 }
4137 % \end{macrocode}
4138 % \end{macro}
4139 %
4140 % \begin{macro}{\tikztiming@addnode@}[3]{Options}{Node name}{Node text}
4141 % The |fromchar| and |tochar| macros are to be expanded in the output routine,
4142 % not inside this macro. They do not hold the correct values yet.
4143 % \begin{macrocode}
4144 \def\tikztiming@addnode@#1#2#3{%
4145 \def\@tempa{#2}%
4146 \ifx\@tempa\empty
4147 \def\@tempa{ node [timing/inline node,%
4148 timing/inline node/from char={\tikztiming@fromchar},%
4149 timing/inline node/to char={\tikztiming@tochar},%
4150 \unexpanded{#1}] }%
4151 \def\@tempb{}%
4152 \else
4153 \def\@tempa{ node [timing/inline node,%
4154 timing/inline node/from char={\tikztiming@fromchar},%
4155 timing/inline node/to char={\tikztiming@tochar},%
4156 \unexpanded{#1}] (\unexpanded{#2}) }%
4157 \xdef\tikztiming@namednodes{\tikztiming@namednodes,#2}%
4158 \fi
4159 \expandafter\tikztiming@output@eaddcode\expandafter{\@tempa \unexpanded{{#3}}}%
4160 \tikztiming@parser
4161 }
4162 % \end{macrocode}
4163 % \end{macro}
4164 %
4165 % \begin{macro}{\tikztiming@marknodes}[1]{Comma-separated list of node names}
4166 % \begin{macrocode}
4167 \newcommand*\tikztiming@marknodes[2][]{%
4168 \scope[timing/debug/scope,#1]
4169 \edef\@tempa{floor((\noexpand\y1-\tikztiming@xunit) / \tikztiming@rowdist\tikztiming@xunit) * \tikztiming@rowdist\tikztiming@xunit}%
4170 \foreach \N in #2 {%
4171 \ifx\N\empty\else
4172 \tikztiming@markcmd
4173 \path let \p1=(\N) in
4174 node [timing/debug/node] at ($ (\x1,\noexpand\@tempa) + (0,1) $) {\N};
4175 \fi
4176 }%
4177 \endscope
4178 }
4179 % \end{macrocode}
4180 % \end{macro}
4181 %
4182 % \begin{macro}{\tikztiming@markcmd}
4183 % \begin{macrocode}
4184 \def\tikztiming@markcmd{ \draw (\N) circle (1pt); }%
4185 % \end{macrocode}
4186 % \end{macro}
4187 %
4188 % \begin{macro}{\tikztiming@mark@nodes}[1]{Comma-separated list of node names}
4189 % \begin{macrocode}
4190 \newcommand*\tikztiming@mark@nodes[2][]{%
4191 \begingroup
4192 \def\@tempa{#2}%
4193 \ifx\@tempa\empty \let\@tempa\tikztiming@namednodes \fi
4194 \ifx\@tempa\space \let\@tempa\tikztiming@namednodes \fi
4195 \def\@tempb{\tikztiming@marknodes[#1]}%
4196 \expandafter\@tempb\expandafter{\expandafter{\@tempa}}%
4197 \endgroup
4198 }
4199 % \end{macrocode}
4200 % \end{macro}
4201 %
4202 % \subsection{Test for Code (`!' modifier)}
4203 %
4204 % \begin{macro}{\tikztiming@testforcode}
4205 % \begin{macrocode}
4206 \def\tikztiming@testforcode{%
4207 \@ifnextchar{!}%
4208 {\tikztiming@testforcode@}%
4209 {\@ifundefined{tikztiming@code@\meaning\@let@token}%
4210 {\tikztiming@parser@}%
4211 {\expandafter\afterassignment
4212 \csname tikztiming@code@\meaning\@let@token\endcsname
4213 \let\@let@token=%
4214 }%
4215 }%
4216 }
4217 % \end{macrocode}
4218 % \end{macro}
4219 %
4220 % \begin{macro}{\tikztiming@testforcode@}[1]{Character to gobble}
4221 % \begin{macrocode}
4222 \def\tikztiming@testforcode@#1{%
4223 \@ifnextchar\bgroup
4224 {\tikztiming@handlecode}%
4225 {%
4226 \PackageWarning{tikz-timing}{Missing braces after '!' character. Ignoring
4227 this character}{}{}{}%
4228 \tikztiming@parser
4229 }%
4230 }
4231 % \end{macrocode}
4232 % \end{macro}
4233 %
4234 % \begin{macro}{\tikztiming@handlecode}[1]{Code to add to string}
4235 % \begin{macrocode}
4236 \def\tikztiming@handlecode#1{%
4237 \tikztiming@output@addcode{ #1 }%
4238 \tikztiming@parser
4239 }
4240 % \end{macrocode}
4241 % \end{macro}
4242 %
4243 %
4244 % \section{Parser Macros: Numbers}
4245 %
4246 % \begin{macro}{\tikztiming@testfornum}
4247 % \begin{macrocode}
4248 \def\tikztiming@testfornum{%
4249 \global\let\tikztiming@num\tikztiming@wscale
4250 \let\tikztiming@numchars\empty
4251 \tikztiming@numfrac0\relax
4252 \afterassignment
4253 \tikztiming@testfornum@
4254 \tikztiming@numint0%
4255 }
4256 % \end{macrocode}
4257 % \end{macro}
4258 %
4259 % \begin{macro}{\tikztiming@testfornumfrac}
4260 % \begin{macrocode}
4261 \def\tikztiming@testfornumfrac{%
4262 \afterassignment
4263 \tikztiming@testfornum@@@
4264 \tikztiming@numfrac1%
4265 }
4266 % \end{macrocode}
4267 % \end{macro}
4268 %
4269 % \begin{macro}{\tikztiming@numloop}
4270 % \begin{macrocode}
4271 \def\tikztiming@numloop{%
4272 \ifnum\tikztiming@numint>0%
4273 \toks@\expandafter{\tikztiming@numchars}%
4274 \xdef\tikztiming@numchars{%
4275 \the\toks@
4276 \the\@temptokena
4277 }%
4278 \advance\tikztiming@numint by -1\relax
4279 \expandafter\tikztiming@numloop
4280 \fi
4281 }
4282 % \end{macrocode}
4283 % \end{macro}
4284 %
4285 % \begin{macro}{\tikztiming@testfornum@}
4286 % The \cs{@let@token} set in \cs{tikztiming@parser} is used to handle "0"
4287 % which can not be detected using the \cs{tikztiming@numint} value.
4288 % \begin{macrocode}
4289 \def\tikztiming@testfornum@{%
4290 \ifx0\@let@token
4291 \let\tikztiming@next\tikztiming@testfornum@@
4292 \else
4293 \ifnum0<\tikztiming@numint
4294 \let\tikztiming@next\tikztiming@testfornum@@
4295 \else
4296 \def\tikztiming@next{%
4297 \@ifnextchar{.}%
4298 {\expandafter\tikztiming@testfornumfrac\@gobble}%
4299 {%
4300 \tikztiming@numint1\relax
4301 \tikztiming@numfrac0\relax
4302 \global\let\tikztiming@num\tikztiming@wscale
4303 \if@tikztiming@metachar
4304 {\def\@tempa{\expandafter\expandafter\expandafter
4305 \tikztiming@parser
4306 \csname tikztiming@metachar@\meaning\@let@token\endcsname{1}}%
4307 \expandafter\@tempa\@gobble
4308 }%
4309 {\tikztiming@testforcode}%
4310 }%
4311 }%
4312 \fi\fi
4313 \tikztiming@next
4314 }
4315 % \end{macrocode}
4316 % \end{macro}
4317 %
4318 % \begin{macro}{\tikztiming@testfornum@@}
4319 % \begin{macrocode}
4320 \def\tikztiming@testfornum@@{%
4321 \@ifnextchar{.}%
4322 {\expandafter\tikztiming@testfornumfrac\@gobble}%
4323 {\tikztiming@testfornum@@@}%
4324 }
4325 % \end{macrocode}
4326 % \end{macro}
4327 %
4328 % \begin{macro}{\tikztiming@testfornum@@@}
4329 % \begin{macrocode}
4330 \def\tikztiming@testfornum@@@{%
4331 \edef\tikztiming@num{\the\tikztiming@numint.\expandafter\@gobble\the\tikztiming@numfrac}%
4332 \tikztiming@setnum{\tikztiming@wscale * \tikztiming@num}%
4333 \@ifnextchar\bgroup
4334 {%
4335 \expandafter\tikztiming@numfrac\expandafter0\expandafter
4336 \@gobble\the\tikztiming@numfrac\relax
4337 \ifnum0=\tikztiming@numfrac\else
4338 \pgfmathparse{round(\tikztiming@num)}%
4339 \PackageWarning{tikz-timing}%
4340 {Can not repeat group by a non-integer factor!^^J%
4341 Rounding '\tikztiming@num' to '\pgfmathresult'.}{}{}{}%
4342 \global\let\tikztiming@num\pgfmathresult
4343 \fi
4344 \tikztiming@testfornum@@@@
4345 }%
4346 {%
4347 \if@tikztiming@metachar
4348 {\def\@tempa{\expandafter\expandafter\expandafter
4349 \tikztiming@parser
4350 \csname tikztiming@metachar@\meaning\@let@token\expandafter\endcsname
4351 \expandafter{\tikztiming@num}}%
4352 \expandafter\@tempa\@gobble
4353 }%
4354 {\tikztiming@testforcode}%
4355 }%
4356 }
4357 % \end{macrocode}
4358 % \end{macro}
4359 %
4360 % \begin{macro}{\tikztiming@testfornum@@@@}[1]{Characters and other tokens to
4361 % repeat}
4362 % \begin{macrocode}
4363 \def\tikztiming@testfornum@@@@#1{%
4364 \begingroup
4365 \@temptokena{#1}%
4366 \tikztiming@numloop%
4367 \endgroup
4368 \tikztiming@numint1\relax
4369 \tikztiming@numfrac0\relax
4370 \expandafter\tikztiming@parser\tikztiming@numchars
4371 }
4372 % \end{macrocode}
4373 % \end{macro}
4374 %
4375 % \section{Meta-Characters}
4376 %
4377 % \begin{macro}{\tikztimingmetachar}[1]{Meta-character}
4378 % Checks if there is an optional argument and calls \cs{tikztiming@metachar}
4379 % appropriately.
4380 % \begin{macrocode}
4381 \def\tikztimingmetachar#1{%
4382 \@ifnextchar{[}%]
4383 {\tikztiming@metachar{#1}}%
4384 {\tikztiming@metachar{#1}[]}%
4385 }
4386 % \end{macrocode}
4387 % \end{macro}
4388 %
4389 % \begin{macro}{\tikztiming@metachar}[3]{Macro character}{Number of
4390 % Arguments}{Substituted Characters}
4391 % \begin{macrocode}
4392 \def\tikztiming@metachar#1[#2]#3{%
4393 \ifx\relax#3\relax
4394 \expandafter\let\csname tikztiming@metachar@\meaning#1\endcsname\@undefined
4395 \else
4396 \@namedef{tikztiming@metachar@\meaning#1}{}%
4397 \ifx\relax#2\relax
4398 \expandafter\renewcommand\expandafter*%
4399 \csname tikztiming@metachar@\meaning#1\expandafter
4400 \endcsname\expandafter[1]{##1{#3}}%
4401 \else
4402 \expandafter\renewcommand\expandafter*%
4403 \csname tikztiming@metachar@\meaning#1\expandafter
4404 \endcsname\expandafter[#2]{#3}%
4405 \fi
4406 \fi
4407 \ifnum\tikztiming@debug=-1
4408 \message{^^J Defined meta-char '#1' as:
4409 \expandafter\meaning\csname tikztiming@metachar@\meaning#1\endcsname ^^J}%
4410 \fi
4411 }
4412 % \end{macrocode}
4413 % \end{macro}
4414 %
4415 % \begin{macro}{\if@tikztiming@metachar}[2]{True clause}{False clause}
4416 % Only works in an argument of |\@ifnextchar|. This macro sets the needed
4417 % |\@let@token| macro.
4418 % \begin{macrocode}
4419 \def\if@tikztiming@metachar#1#2{%
4420 \@ifundefined{tikztiming@metachar@\meaning\@let@token}{#2}{#1}%
4421 }
4422 % \end{macrocode}
4423 % \end{macro}
4424 %
4425 % \section{Table environment}
4426 % \begin{macrocode}
4427 %\usetikzlibrary{backgrounds}
4428 \newcounter{tikztimingrows}
4429 % \end{macrocode}
4430 %
4431 % \begin{environment}{tikztimingtable}[1]{Optional settings}
4432 % \begin{macrocode}
4433 \def\abc{\tracingassigns=1}
4434 \newenvironment{tikztimingtable}[1][]{%
4435 \begingroup
4436 \setcounter{tikztiming@nrows}{0}%
4437 \def\tikztiming@maxwidth{0.0}%
4438 \let\extracode\tikztiming@extracode
4439 \let\endextracode\tikztiming@endextracode
4440 \let\tablegrid\tikztiming@tablegrid
4441 \let\fulltablegrid\tikztiming@fulltablegrid
4442 \let\horlines\tikztiming@horlines
4443 \let\vertlines\tikztiming@vertlines
4444 \let\marknodes\tikztiming@mark@nodes
4445 \def\background{\pgfonlayer{background}\scope}%
4446 \def\endbackground{\endscope\endpgfonlayer}%
4447 \def\tablerules{\tikztiming@tablerules}%
4448 \def\tableheader{\tikztiming@tableheader}%
4449 \def\rowdist{\tikztiming@rowdist}%
4450 \def\coldist{\tikztiming@coldist}%
4451 \def\nrows{\the\c@tikztiming@nrows}%
4452 \def\twidth{\tikztiming@maxwidth}%
4453 \tikzpicture[timing/table,#1]%
4454 \coordinate (@last row) at (0,\rowdist);
4455 \coordinate (label@header) at ($ -1*(\tikztiming@coldist,0) + 1.5*(0,\tikztiming@rowdist) $);
4456 \coordinate (diagram@header) at ($ 1.5*(0,\tikztiming@rowdist) $);
4457 \coordinate (timing@table@bottom right) at (0,0);
4458 \coordinate (timing@table@bottom left) at ($ -1*(\tikztiming@coldist,0) $);
4459 \tikztiming@picinit
4460 \tikzset{timing/before table}%
4461 \tikztimingtable@checkrow
4462 }{%
4463 \tikzset{timing/after table}%
4464 \endtikzpicture
4465 \endgroup
4466 }
4467 % \end{macrocode}
4468 % \end{environment}
4469 %
4470 % \begin{macro}{\tikztiming@extracode}
4471 % Set "all rows" rectangle node using the auxiliary coordinates.
4472 % \begin{macrocode}
4473 \def\tikztiming@extracode{%
4474 \path
4475 let
4476 \p1 = (row1.north west),
4477 \p2 = (timing@table@bottom right),
4478 \p3 = (\x2-\x1,\y1-\y2),
4479 \p4 = (\pgf@pt@aa * \x3, \pgf@pt@bb * \y3)
4480 in
4481 node [shape=rectangle,anchor=north west,
4482 minimum width=\x4,minimum height=\y4,
4483 inner sep=0pt,outer sep=0pt]
4484 at (\x1,\y1) (all rows) {}
4485 ;
4486 \path
4487 let
4488 \p0 = ($ -1*(\tikztiming@coldist,0) + (0,1) $),
4489 \p1 = (label1.north east),
4490 \p2 = (timing@table@bottom left),
4491 \p3 = (\x0-\x2,\y1-\y2),
4492 \p4 = (\pgf@pt@aa * \x3, \pgf@pt@bb * \y3)
4493 in
4494 node [shape=rectangle,anchor=north east,
4495 minimum width=\x4,minimum height=\y4,
4496 inner sep=0pt,outer sep=0pt]
4497 at (\x1,\y1) (all labels) {}
4498 ;
4499 \@ifnextchar[{\tikztiming@oset}{}%
4500 }
4501 % \end{macrocode}
4502 % \end{macro}
4503 %
4504 % \begin{macro}{\tikztiming@endextracode}
4505 % Now empty because \cs{tikztimingtable@chkendec} handles the
4506 % continuation of the row scanning process.
4507 % \begin{macrocode}
4508 \def\tikztiming@endextracode{%
4509 }%
4510 % \end{macrocode}
4511 % \end{macro}
4512 %
4513 % \begin{macro}{\tikztimingtable@checkrow}
4514 % Checks the next token to be either \cs{end}, \cs{extracode} or
4515 % \cs{begin}. In the case of the latter \cs{tikztimingtable@chkbegec}
4516 % is called to test if it is \cs{begin}|{extracode}|.
4517 % \begin{macrocode}
4518 \def\tikztimingtable@checkrow{%
4519 \@ifnextchar\end
4520 {\tikztimingtable@chkendec}%
4521 {\ifx\@let@token\extracode
4522 \let\tikztiming@next\empty
4523 \else
4524 \ifx\@let@token\begin
4525 \def\tikztiming@next{\tikztimingtable@chkbegec}%
4526 \else
4527 \def\tikztiming@next{\tikztimingtable@row}%
4528 \fi
4529 \fi
4530 \tikztiming@next
4531 }%
4532 }
4533 % \end{macrocode}
4534 % \end{macro}
4535 %
4536 % \begin{macro}{\tikztimingtable@chkbegec}
4537 % Checks if value of \cs{begin} is |{extracode}|. If so
4538 % it is executed, otherwise it is taken as normal row and so
4539 % \cs{tikztimingtable@row} is called.
4540 % \begin{macrocode}
4541 \def\tikztimingtable@chkbegec\begin#1{
4542 \begingroup
4543 \def\@tempa{#1}%
4544 \def\@tempb{extracode}%
4545 \ifx\@tempa\@tempb
4546 \endgroup
4547 \def\tikztiming@next{\begin{extracode}}%
4548 \else
4549 \endgroup
4550 \def\tikztiming@next{\tikztimingtable@row\begin{#1}}%
4551 \fi
4552 \tikztiming@next
4553 }
4554 % \end{macrocode}
4555 % \end{macro}
4556 %
4557 % \begin{macro}{\tikztimingtable@chkendec}
4558 % Checks if value of \cs{end} is |{extracode}|. If so
4559 % it is executed, otherwise it is taken as normal row and so
4560 % \cs{tikztimingtable@row} is called.
4561 % \begin{macrocode}
4562 \def\tikztimingtable@chkendec\end#1{
4563 \begingroup
4564 \def\@tempa{#1}%
4565 \def\@tempb{extracode}%
4566 \ifx\@tempa\@tempb
4567 \endgroup
4568 \def\tikztiming@next{\end{extracode}\tikztimingtable@row}%
4569 \else
4570 \endgroup
4571 \def\tikztiming@next{\end{#1}}%
4572 \fi
4573 \tikztiming@next
4574 }
4575 % \end{macrocode}
4576 % \end{macro}
4577 %
4578 % \begin{macro}{\tikztiming@oset}
4579 % [1]{TikZ Keys}
4580 % Handle optional TikZ settings. The \cs{tikz@options} must be used
4581 % to ensure that the settings apply for the following graphic paths.
4582 % \begin{macrocode}
4583 \def\tikztiming@oset[#1]{%
4584 \let\tikz@options\pgfutil@empty
4585 \tikzset{#1}%
4586 \tikz@options
4587 }
4588 % \end{macrocode}
4589 % \end{macro}
4590 %
4591 % \begin{macro}{\tikztiming@emptycell}
4592 % Just used as marker. Needs unique definition.
4593 % \begin{macrocode}
4594 \def\tikztiming@emptycell{%
4595 \@gobble{tikztiming@emptycell}%
4596 }
4597 % \end{macrocode}
4598 % \end{macro}
4599 %
4600 % \begin{macro}{\tikztimingtable@row}[1]{Row content}
4601 % \begin{macrocode}
4602 \long\def\tikztimingtable@row#1\\{%
4603 \tikztimingtable@row@#1&\tikztiming@emptycell&\\
4604 }
4605 % \end{macrocode}
4606 % \end{macro}
4607 %
4608 % \begin{macro}{\tikztimingtable@row@}[3]{Cell 1}{Cell 2 or empty}{Potential
4609 % further cells}
4610 % \begin{macrocode}
4611 \long\def\tikztimingtable@row@#1&#2&#3\\{%
4612 \ifx\\#3\\\else
4613 \begingroup
4614 \def\@tempa{\tikztiming@emptycell&}%
4615 \def\@tempb{#3}%
4616 \ifx\@tempa\@tempb\else
4617 \PackageWarning{tikz-timing}{%
4618 To many columns in tikztimingtable row! Only two are allowed%
4619 }{}{}{}%
4620 \fi
4621 \endgroup
4622 \fi
4623 \ifx\tikztiming@emptycell#2%
4624 \def\tikztiming@next{\tikztimingtable@row@@{#1}{}}%
4625 \else
4626 \def\tikztiming@next{\tikztimingtable@row@@{#1}{#2}}%
4627 \fi
4628 \tikztiming@next
4629 }%
4630 % \end{macrocode}
4631 % \end{macro}
4632 %
4633 % \begin{macro}{\tikztimingtable@row@@}[2]{Name/Label}{Timing characters}
4634 % \begin{macrocode}
4635 \long\def\tikztimingtable@row@@#1#2{%
4636 \addtocounter{tikztiming@nrows}{1}%
4637 \coordinate (@last row) at ($ (@last row) - (0,\tikztiming@rowdist) $);
4638 \node [anchor=base east,timing/name,alias=last label] (label\the\c@tikztiming@nrows)
4639 at ($ (@last row) - (\tikztiming@coldist,0) $) {\ignorespaces #1\unskip\strut};
4640 \path let \p1 = (timing@table@bottom left), \p2 = (last label.south west) in
4641 coordinate (timing@table@bottom left) at ({min(\x1,\x2)},\y2);
4642 %
4643 \@ifnextchar{[}%
4644 {\tikztiming@tabletiming}%
4645 {\tikztiming@tabletiming[]}%
4646 #2\relax
4647 \path let \p1 = (timing@table@bottom right), \p2 = (timing/end base) in
4648 coordinate (timing@table@bottom right) at ({max(\x1,\x2)},\y2);
4649 %
4650 \pgfmathparse{max(\tikztiming@maxwidth,\tikztimingwidth)}%
4651 \let\tikztiming@maxwidth\pgfmathresult
4652 \tikztimingtable@checkrow
4653 }
4654 % \end{macrocode}
4655 % \end{macro}
4656
4657 % \begin{macro}{\tikztiming@tabletiming}
4658 % \begin{macrocode}
4659 \def\tikztiming@tabletiming[#1]#2\relax{%
4660 \let\tikztiming@lastchar\empty
4661 \let\tikztiming@settings\empty
4662 \ifx\relax#1\relax\else
4663 \tikztiming@testoptarg#1\relax\relax
4664 \fi
4665 \ifx\tikztiming@lastchar\empty
4666 \def\tikztiming@lastchar{@}%
4667 \fi
4668 \edef\@tempa{\noexpand\timing
4669 [name=row\the\c@tikztiming@nrows,alias=last row,%
4670 \expandafter\unexpanded\expandafter{\tikztiming@settings}] at (@last row)}%
4671 \expandafter\@tempa\expandafter{\expandafter[\tikztiming@lastchar]#2};
4672 }
4673 % \end{macrocode}
4674 % \end{macro}
4675
4676 % \begin{macro}{\tikztiming@fulltablegrid}[1]{Optional settings}
4677 % \begin{macrocode}
4678 \newcommand*\tikztiming@fulltablegrid[1][]{%
4679 \begin{pgfonlayer}{background}
4680 \scope[xstep={\timingwidth/2.},ystep={\timingheight/2.},
4681 shift={(all rows.south west)},timing/table/grid,#1]
4682 \draw (0,0) grid ($ (all rows.north east) - (all rows.south west) $);
4683 \endscope
4684 \end{pgfonlayer}
4685 }
4686 % \end{macrocode}
4687 % \end{macro}
4688 %
4689 % \begin{macro}{\tikztiming@tablegrid}[1]{Optional settings}
4690 % \begin{macrocode}
4691 \def\tikztiming@tablegrid{%
4692 \@ifnextchar{*}%
4693 {\tikztiming@tablegrid@{row\row.high end}}%
4694 {\tikztiming@tablegrid@{all rows.north east}}%
4695 }
4696 % \end{macrocode}
4697 % \end{macro}
4698 %
4699 % \begin{macro}{\tikztiming@tablegrid@@}[2]{Optional settings}{End point}
4700 % \begin{macrocode}
4701 \def\tikztiming@tablegrid@#1{%
4702 \@ifnextchar{[}%]
4703 {\tikztiming@tablegrid@@{#1}}%
4704 {\tikztiming@tablegrid@@{#1}[]}%
4705 }
4706 % \end{macrocode}
4707 % \end{macro}
4708 %
4709 % \begin{macro}{\tikztiming@tablegrid@@}[2]{Optional settings}{End point}
4710 % \begin{macrocode}
4711 \def\tikztiming@tablegrid@@#1[#2]{%
4712 \begin{pgfonlayer}{background}
4713 \scope[xstep={\timingwidth/2.},ystep={\timingheight/2.},timing/table/grid,#2]
4714 \foreach \row in {1,...,\nrows} {%
4715 \draw {[shift={(row\row.low start)}]
4716 let \p1 = (#1) in (0,0) grid (\x1,1)};
4717 }%
4718 \endscope
4719 \end{pgfonlayer}
4720 }
4721 % \end{macrocode}
4722 % \end{macro}
4723 %
4724 % \begin{macro}{\tikztiming@tableheader}
4725 % [3]{Optional Settings}{Text title}{Diagram title}
4726 % \begin{macrocode}
4727 \def\tikztiming@tableheader{%
4728 \@ifnextchar[%]
4729 {\tikztiming@tableheader@}%
4730 {\tikztiming@tableheader@@{}[]}%
4731 }
4732 \def\tikztiming@tableheader@[#1]{%
4733 \@ifnextchar[%]
4734 {\tikztiming@tableheader@@{#1}}%
4735 {\tikztiming@tableheader@@{#1}[]}%
4736 }
4737 \def\tikztiming@tableheader@@#1[#2]#3{%
4738 \@ifnextchar[%]
4739 {\tikztiming@tableheader@@@{#1}{#2}{#3}}%
4740 {\tikztiming@tableheader@@@{#1}{#2}{#3}[]}%
4741 }
4742 % \end{macrocode}
4743 % \end{macro}
4744 %
4745 % \begin{macro}{\tikztiming@tableheader}
4746 % [5]{Optional settings}{Optional label@header Settings}{Label title}{Optional Diagram title settings}{Diagram title}
4747 % \begin{macrocode}
4748 \def\tikztiming@tableheader@@@#1#2#3[#4]#5{%
4749 \path
4750 let
4751 \p1 = (label@header),
4752 \p2 = (all labels.east),
4753 \p3 = (all labels.west)
4754 in
4755 (\x2,\y1) -- node [pos=0,anchor=base east,timing/table/header,timing/table/label header,#1,#2]
4756 (label header) {\ignorespaces #3\unskip\strut} (\x3,\y1)
4757 ;
4758 \path
4759 let
4760 \p4 = (diagram@header),
4761 \p5 = (all rows.west),
4762 \p6 = (all rows.east)
4763 in
4764 (\x5,\y4) -- node [pos=0,anchor=base west,timing/table/header,timing/table/row header,#1,#4]
4765 (row header) {\ignorespaces #5\unskip\strut} (\x6,\y4)
4766 ;
4767 \tikztiming@tableheadtrue
4768 }
4769 \newif\iftikztiming@tablehead
4770 % \end{macrocode}
4771 % \end{macro}
4772 %
4773 % \begin{macro}{\tikztiming@tablerules}[1]{Optional Settings}
4774 % \begin{macrocode}
4775 \newcommand*\tikztiming@tablerules[1][]{%
4776 \begin{scope}[#1]
4777 \coordinate (NW) at (current bounding box.north west);
4778 \coordinate (SE) at (current bounding box.south east);
4779 %
4780 \draw [timing/table/rules]
4781 let
4782 \p1 = (NW),
4783 \p2 = (SE),
4784 \p3 = (@last row),
4785 \p4 = (0,\rowdist)
4786 in
4787 ($ (\x1-\tabcolsep,\y3) - (0,.5*\y4) $) --
4788 ($ (\x2+\tabcolsep,\y3) - (0,.5*\y4) $)
4789 \iftikztiming@tablehead
4790 (\x1-\tabcolsep,2.5*\y4) -- (\x2+\tabcolsep,2.5*\y4)
4791 \fi
4792 ;
4793 \draw
4794 \iftikztiming@tablehead [timing/table/midrules] \else [timing/table/rules] \fi
4795 let
4796 \p1 = (NW),
4797 \p2 = (SE)
4798 in
4799 (\x1-\tabcolsep,\rowdist) -- (\x2+\tabcolsep,\rowdist)
4800 ;
4801 \end{scope}
4802 }
4803 % \end{macrocode}
4804 % \end{macro}
4805 %
4806 % \begin{macro}{\tikztiming@horlines}[2]{Optional Settings}{Row numbers}
4807 % \begin{macrocode}
4808 \newcommand*\tikztiming@horlines[2][]{%
4809 \begingroup
4810 \def\list{#2}%
4811 \ifx\list\empty
4812 \def\list{1,2,...,\nrows}%
4813 \fi
4814 \foreach \row in \list {%
4815 \draw [timing/table/lines,#1] let
4816 \p1 = (all rows.south east),
4817 \p2 = (0,\rowdist)
4818 in
4819 ($ (0,\y2) - (0,\row * \y2) $) -- +(\x1,0);
4820 }%
4821 \endgroup
4822 }
4823 % \end{macrocode}
4824 % \end{macro}
4825 %
4826 % \begin{macro}{\tikztiming@vertlines}[2]{Optional Settings}{Column numbers}
4827 % \begin{macrocode}
4828 \newcommand*\tikztiming@vertlines[2][]{%
4829 \begingroup
4830 \def\list{#2}%
4831 \ifx\list\empty
4832 \def\list{0,1,...,\twidth}%
4833 \fi
4834 \draw [timing/table/lines,#1] let
4835 \p1 = ($ (all rows.south east) - (0,2) $)
4836 in
4837 \foreach \clk in \list {
4838 (\clk,+1.5) -- +(0,\y1)
4839 }
4840 ;
4841 \endgroup
4842 }
4843 % \end{macrocode}
4844 % \end{macro}
4845 %
4846 % \section{Shapes}
4847 % \begin{macrocode}
4848 \pgfdeclareshape{tikztiming@shape}{%
4849 \savedanchor\northeast{\tikztiming@northeast}%
4850 \savedanchor\startpoint{\tikztiming@startpoint}%
4851 \savedanchor\endpoint{\tikztiming@endpoint}%
4852 \anchor{center}{\pgfpointorigin}%
4853 \anchor{start}{\startpoint}%
4854 \anchor{end}{\endpoint}%
4855 %
4856 \anchor{origin}{\northeast \pgf@x=-\pgf@x \pgf@y=-\pgf@y }%
4857 \anchor{east}{\northeast \pgf@y=0pt }%
4858 \anchor{west}{\northeast \pgf@y=0pt \pgf@x=-\pgf@x }%
4859 \anchor{north}{\northeast \pgf@x=0pt }%
4860 \anchor{north west}{\northeast \pgf@x=-\pgf@x }%
4861 \anchor{north east}{\northeast}
4862 \anchor{high mid}{\northeast \pgf@x=0pt }%
4863 \anchor{high start}{\northeast \pgf@x=-\pgf@x }%
4864 \anchor{high end}{\northeast}
4865 \anchor{south}{\northeast \pgf@x=0pt \pgf@y=-\pgf@y }%
4866 \anchor{south west}{\northeast \pgf@x=-\pgf@x \pgf@y=-\pgf@y }%
4867 \anchor{south east}{\northeast \pgf@y=-\pgf@y }%
4868 \anchor{low mid}{\northeast \pgf@x=0pt \pgf@y=-\pgf@y }%
4869 \anchor{low start}{\northeast \pgf@x=-\pgf@x \pgf@y=-\pgf@y }%
4870 \anchor{low end}{\northeast \pgf@y=-\pgf@y }%
4871 \anchor{mid}{\pgfpointorigin}%
4872 \anchor{mid east}{\northeast \pgf@y=0pt }%
4873 \anchor{mid west}{\northeast \pgf@y=0pt \pgf@x=-\pgf@x }%
4874 \anchor{mid end}{\northeast \pgf@y=0pt }%
4875 \anchor{mid start}{\northeast \pgf@y=0pt \pgf@x=-\pgf@x }%
4876 \anchor{base}{\northeast \pgf@x=0pt \pgf@y=-\pgf@y }%
4877 \anchor{base west}{\northeast \pgf@x=-\pgf@x \pgf@y=-\pgf@y }%
4878 \anchor{base east}{\northeast \pgf@y=-\pgf@y }%
4879 \anchorborder{%
4880 \@tempdima=\pgf@x
4881 \@tempdimb=\pgf@y
4882 \pgfpointborderrectangle{\pgfpoint{\@tempdima}{\@tempdimb}}{\northeast}%
4883 }%
4884 }
4885 % \end{macrocode}
4886 %
4887 % By default use the old node centers for backwards compatibility.
4888 % \begin{macrocode}
4889 \gdef\tikztiming@oldnodecenter@{}%
4890 \tikzset{timing/old@node@center/.code={\xdef\tikztiming@oldnodecenter@{%
4891 ++($ (0,0) - #1 $)
4892 [timing/no@old@node@center]}}%
4893 }%
4894 \tikzset{timing/no@old@node@center/.code={\gdef\tikztiming@oldnodecenter@{}}}%
4895
4896 \def\tikztiming@oldnodecenter#1{%
4897 [timing/old@node@center={#1}]
4898 ++#1
4899 }
4900
4901 % \end{macrocode}
4902 %
4903 % \section{Other Macros}
4904 %
4905 % \begin{macro}{\tikztiming@iflower}[1]{Character}
4906 % \begin{macrocode}
4907 \def\tikztiming@iflower#1{%
4908 \begingroup
4909 \edef\@tempa{`#1}%
4910 \ifnum\@tempa=\lccode\@tempa
4911 \endgroup
4912 \expandafter
4913 \@firstoftwo
4914 \else
4915 \endgroup
4916 \expandafter
4917 \@secondoftwo
4918 \fi
4919 }
4920 % \end{macrocode}
4921 % \end{macro}
4922 %
4923 % \begin{macro}{\tikztiming@internaldefs}[3]{Character}{Character}{Character}
4924 % \begin{macrocode}
4925 \def\tikztiming@internaldefs{%
4926 \let\draw\relax
4927 \let\path\relax
4928 \let\p\relax
4929 \let\x\relax
4930 \let\y\relax
4931 \let\n\relax
4932 \let\tikztiming@oldnodecenter\relax
4933 \let\tikztiming@oldnodecenter@\relax
4934 \def\width{####1*\noexpand\timingwidth}%
4935 \def\fwidth{\noexpand\timingwidth}%
4936 \def\height{\noexpand\timingheight}%
4937 \def\slope{\noexpand\timingslope}%
4938 \def\zslope{\noexpand\timingzslope}%
4939 \def\dslope{\noexpand\timingdslope}%
4940 \def\gslope{0}%
4941 \def\style{timing/every char,timing/####3}%
4942 \def\bgstyle{draw=none,timing/every bg,timing/####3/background}%
4943 \def\nstyle{timing/every char,timing/####4}%
4944 \def\newdraw{\tikztiming@newdraw}%
4945 \def\newdrawns{\tikztiming@newdraw@nosave}%
4946 \def\code##1{ [/utils/exec={\unexpanded{##1}}] }%
4947 }
4948 % \end{macrocode}
4949 % \end{macro}
4950
4951 % \begin{macro}{\tikztimingsetslope}[1]{Slope value}
4952 % \begin{macrocode}
4953 \def\tikztimingsetslope#1{%
4954 \pgfmathparse{min(1.0,{max(0.0,#1)})}%
4955 \let\tikztiming@slope\pgfmathresult
4956 \edef\timingslope{\tikztiming@slope*\noexpand\timingwidth}%
4957 }
4958 % \end{macrocode}
4959 % \end{macro}
4960 %
4961 % \begin{macro}{\tikztimingsetdslope}[1]{Slope value}
4962 % \begin{macrocode}
4963 \def\tikztimingsetdslope#1{%
4964 \pgfmathparse{min(1.0,{max(0.0,#1)})}%
4965 \let\tikztiming@dslope\pgfmathresult
4966 \edef\timingdslope{\tikztiming@dslope*\noexpand\timingwidth}%
4967 }
4968 % \end{macrocode}
4969 % \end{macro}
4970 %
4971 % \begin{macro}{\tikztimingsetzslope}[1]{Slope value}
4972 % \begin{macrocode}
4973 \def\tikztimingsetzslope#1{%
4974 \pgfmathparse{min(1.0,{max(0.0,#1)})}%
4975 \let\tikztiming@zslope\pgfmathresult
4976 \edef\timingzslope{\tikztiming@zslope*\noexpand\timingwidth}%
4977 }
4978 % \end{macrocode}
4979 % \end{macro}
4980 %
4981 % \begin{macrocode}
4982 \tikztimingsetslope{0.10}%
4983 \tikztimingsetdslope{0.20}%
4984 \tikztimingsetzslope{0.05}%
4985 % \end{macrocode}
4986 %
4987 % \section{Timing Character Definition Macros}
4988 %
4989 % \begin{macro}{\tikztiminguse}[1]{Character(s)}
4990 % \begin{macrocode}
4991 \def\tikztiminguse#1#2{%
4992 \@nameuse{\tikztiming@prefix#1}{#2}{##2}{##3}{##4}%
4993 }
4994 % \end{macrocode}
4995 % \end{macro}
4996 %
4997 % \begin{macro}{\tikztimingdef}[1]{One till three characters}
4998 % \begin{macrocode}
4999 \def\tikztimingdef#1{%
5000 \tikztimingdef@#1\empty\empty\relax
5001 }
5002 % \end{macrocode}
5003 % \end{macro}
5004 %
5005 % \begin{macro}{\tikztimingdef@}[3]{First character}{Second character or
5006 % empty}{Definition code}
5007 % \begin{macrocode}
5008 \def\tikztimingdef@#1#2#3\relax#4{%
5009 \ifx\empty#2\empty
5010 \tikztiming@nameedef{}{#1}{}{#4}%
5011 \else
5012 \tikztiming@nameedef{#1}{#2}{#3}{#4}%
5013 \fi
5014 }
5015 % \end{macrocode}
5016 % \end{macro}
5017 %
5018 % \begin{macro}{\tikztimingcpy}[2]{New Character(s)}{Source Character(s)}
5019 % \begin{macrocode}
5020 \def\tikztimingcpy#1#2{%
5021 \begingroup
5022 \edef\tikztimingcpy@a{#1}%
5023 \edef\tikztimingcpy@b{#2}%
5024 \ifx\tikztimingcpy@a\tikztimingcpy@b
5025 \endgroup
5026 %\message{^^J Copy macro '#2' to '#1' skipped.^^J}%
5027 \else
5028 \endgroup
5029 \@ifundefined{\tikztiming@pfxtr#2\empty\empty\empty}%
5030 {\ifnum\tikztiming@debug>0\relax
5031 \message{^^J Copy macro '#2' to '#1' failed.^^J}\fi}%
5032 {\ifnum\tikztiming@debug>0\relax
5033 \message{^^J Copy macro '#2' to '#1'.^^J}\fi
5034 \expandafter\let
5035 \csname\tikztiming@pfxtr#1\empty\empty\empty\expandafter\endcsname
5036 \csname\tikztiming@pfxtr#2\empty\empty\empty\endcsname
5037 }%
5038 \fi
5039 }
5040 % \end{macrocode}
5041 % \end{macro}
5042 %
5043 %
5044 % \begin{macro}{\tikztiminglet}[2]{Original characters}{New characters}
5045 % \begin{macrocode}
5046 \def\tikztiminglet#1#2{%
5047 \tikztiming@namelet{#1}{#2}%
5048 }
5049 % \end{macrocode}
5050 % \end{macro}
5051 %
5052 %
5053 % \begin{macro}{\tikztiming@chars}[1]{Comma to gobble}
5054 % Initial definition of character list. Will gobble the separation comma in
5055 % front of the first character which is added to the list.
5056 % \begin{macrocode}
5057 \def\tikztiming@chars#1{}
5058 % \end{macrocode}
5059 % \end{macro}
5060 %
5061 % \begin{macro}{\tikztiming@ifcharexists}[1]{Character to check if in list}
5062 % \begin{macrocode}
5063 \def\tikztiming@ifcharexists#1{%
5064 \def\tikztiming@ifcharexists@##1,#1,##2\relax{%
5065 \ifx\relax##2\relax%
5066 \expandafter\@firstoftwo
5067 \else
5068 \expandafter\@secondoftwo
5069 \fi
5070 }%
5071 \expandafter\tikztiming@ifcharexists@
5072 \expandafter,\tikztiming@chars,#1,\relax%
5073 }
5074 % \end{macrocode}
5075 % \end{macro}
5076 %
5077 % \begin{macro}{\tikztiming@addchar}[1]{Character}
5078 % \begin{macrocode}
5079 \def\tikztiming@addchar#1{%
5080 \tikztiming@ifcharexists{#1}{%
5081 \edef\tikztiming@chars{\tikztiming@chars,#1}%
5082 }{}%
5083 }
5084 % \end{macrocode}
5085 % \end{macro}
5086 %
5087 % \begin{macro}{\tikztimingchar}[1]{New character}
5088 % \begin{macrocode}
5089 \def\tikztimingchar#1{%
5090 \uppercase{%
5091 \tikztiming@addchar{#1}%
5092 \tikztimingchar@{#1}}%
5093 }
5094 % \end{macrocode}
5095 % \end{macro}
5096 %
5097 % \begin{macrocode}
5098 \@namedef{\tikztiming@prefix @@}#1#2#3#4{ coordinate (timing/start)}%
5099 % \end{macrocode}
5100 %
5101 % \begin{macro}{\tikztimingchar@}[3]{Character}{Start position}{Character
5102 % drawing code}
5103 % \begin{macrocode}
5104 \def\tikztimingchar@#1#2#3{%
5105 \tikztiming@nameedef{@}{#1}{}{#2 coordinate (timing/start) #3}%
5106 \tikztimingdef{{#1}{#1}}{#3}%
5107 }
5108 % \end{macrocode}
5109 % \end{macro}
5110 %
5111 % \begin{macro}{\tikztimingecopy}[2]{New character}{Original character}
5112 % \begin{macrocode}
5113 \def\tikztimingecopy#1#2{%
5114 \@namedef{tikztiming@alias@#1}{#2}%
5115 \tikztiming@addchar{#1}%
5116 \expandafter\let
5117 \csname tikztiming@triple@#1\expandafter\endcsname
5118 \csname tikztiming@triple@#2\endcsname
5119 \expandafter\let
5120 \csname tikztiming@nocombine@#1\expandafter\endcsname
5121 \csname tikztiming@nocombine@#2\endcsname
5122 }
5123 % \end{macrocode}
5124 % \end{macro}
5125 %
5126 % \begin{macro}{\tikztiming@setref}[2]{Reference Name}{Shift Offset}
5127 % \begin{macrocode}
5128 \def\tikztiming@setref#1#2{%
5129 coordinate (#1) coordinate (#1) at ([shift={(#2)}]#1)
5130 }
5131 % \end{macrocode}
5132 % \end{macro}
5133 %
5134 % \section{NewDraw Macros}
5135 %
5136 % \begin{macro}{\tikztiming@newdraw}
5137 % \begin{macrocode}
5138 \def\tikztiming@newdraw{%
5139 node [timing/save] (timing@save) {};%
5140 \draw [timing/restore] (timing@save) ++(0,0)
5141 }
5142 % \end{macrocode}
5143 % \end{macro}
5144
5145 % \begin{macro}{\tikztiming@newdraw@nosave}
5146 % \begin{macrocode}
5147 \def\tikztiming@newdraw@nosave{%
5148 node [timing/coord] (timing@save) {};%
5149 \draw [timing/nooptions] (timing@save) ++(0,0)
5150 }
5151 % \end{macrocode}
5152 % \end{macro}
5153 %
5154 % \begin{macro}{\tikztiming@baseline}
5155 % \begin{macrocode}
5156 \def\tikztiming@baseline{%
5157 node [timing/save] (timing@save) {};%
5158 \draw [timing/restore] let \p1 = (timing@save) in (\x1,0) ++(0,0)
5159 }
5160 % \end{macrocode}
5161 % \end{macro}
5162 %
5163 % \section{Definition of Timing Characters}
5164 %
5165 % Pre-define list of timing characters to have it in a sorted fashion.
5166 % \begin{macrocode}
5167 \def\tikztiming@chars{H,L,Z,X,M,D,U,T,C}%
5168 % \end{macrocode}
5169 %
5170 % \subsection{Character `S'}
5171 % This character is now implemented as modifier to avoid hassle with triple
5172 % character transitions.
5173 % \begin{macrocode}
5174 \tikztiming@defcode{S}{%
5175 \pgfmathparse{\tikztimingwidth + \tikztiming@num}%
5176 \global\let\tikztimingwidth\pgfmathresult
5177 \tikztiming@output@Eaddcode{%
5178 coordinate (timing@ref) at ($ (timing@ref) + (\tikztiming@num,0) $)
5179 coordinate (timing@refa) at ($ (timing@refa) + (\tikztiming@num,0) $)
5180 coordinate (timing@refb) at ($ (timing@refb) + (\tikztiming@num,0) $)
5181 ++(\tikztiming@num,0)
5182 }%
5183 \tikztiming@parser
5184 }
5185
5186 \tikztiming@defcode{s}{%
5187 \pgfmathparse{\tikztimingwidth + \tikztiming@num/2}%
5188 \global\let\tikztimingwidth\pgfmathresult
5189 \tikztiming@output@Eaddcode{%
5190 coordinate (timing@ref) at ($ (timing@ref) + (\tikztiming@num/2,0) $)
5191 coordinate (timing@refa) at ($ (timing@refa) + (\tikztiming@num/2,0) $)
5192 coordinate (timing@refb) at ($ (timing@refb) + (\tikztiming@num/2,0) $)
5193 ++(\tikztiming@num/2,0)
5194 }%
5195 \tikztiming@parser
5196 }
5197 % \end{macrocode}
5198 %
5199 % \subsection{Character `G'}
5200 % \begin{macrocode}
5201 \tikztiming@defcode{G}{%
5202 \tikztiming@output@addcode{%
5203 \tikztiming@glitch
5204 }%
5205 \tikztiming@parser
5206 }
5207
5208 \tikztiming@defcode{g}{%
5209 \tikztiming@output@addcode{%
5210 \tikztiming@glitch
5211 }%
5212 \tikztiming@parser
5213 }
5214
5215 \def\tikztiming@glitch{%
5216 {[timing/every char,timing/g] let \p1 = +(0,0) in (\x1,0) -- (\x1,\timingheight)
5217 coordinate (timing@dstart) at (\x1,\timingheight/2) (\x1,\y1)
5218 }%
5219 }
5220 % \end{macrocode}
5221 %
5222 % \subsection{Character `H'}
5223 % \begin{macrocode}
5224 \tikztimingchar{H}{++(0,\height)}{[\style] -- ++(#1,0)}
5225
5226 \tikztimingdef{HH}{
5227 -- ++(#1,0)
5228 }
5229
5230 \tikztimingdef{LH}{
5231 -- +(\slope, \height)
5232 -- ++(#1, \height)
5233 }
5234
5235 \tikztimingdef{ZH}{
5236 \newdraw [\style]
5237 -- ++(\zslope,+\height/2.)
5238 -- ++($ (#1,0) - (\zslope,0) $)
5239 }
5240
5241 \tikztimingdef{DH}{
5242 \tikztiming@oldnodecenter@%
5243 \newdraw [\style]
5244 -- +(\dslope/2.,\height/2.)
5245 -- ($ (timing@ref) + (#1,\height/2) $)
5246 }
5247
5248 % \end{macrocode}
5249 %
5250 % \subsection{Character `L'}
5251 % \begin{macrocode}
5252 \tikztimingdef{DL}{
5253 \tikztiming@oldnodecenter@
5254 \newdraw [\style]
5255 -- +(\dslope/2.,-\height/2.)
5256 -- ($ (timing@ref) + (#1,-\height/2) $)
5257 }
5258
5259 % \end{macrocode}
5260 %
5261 % \subsection{Character `'}
5262 % \begin{macrocode}
5263
5264 \tikztimingchar{L}{++(0,0)}{[\style] -- ++(#1,0)}
5265
5266 \tikztimingchar{Z}{++(0,\height/2.)}{%
5267 \newdraw [\style]
5268 -- ++(#1,0)
5269 }
5270
5271 \tikztimingchar{D}{++(0,\height/2.)}{
5272 node [timing/save] (timing@save) {}; \path [\bgstyle] (timing@save) ++(0,0)
5273 -- +(#1,0)
5274 -- +($ (#1,0) + 0.5*(\dslope,\height) $)
5275 -- +(#1,\height)
5276 -- +(0,\height)
5277 -- cycle;
5278 \draw [timing/restore,\style] (timing@save) ++(0,0)
5279 node [timing/save] (timing@dstart) at +(-\dslope/2.,\height/2.0) {}
5280 -- +(#1,0) ++(0,+\height)
5281 -- ++(#1,0) ++(0,-\height)
5282 }
5283
5284 \def\tikztiming@triple@D{}%
5285 \def\tikztiming@triple@D@edge@{}%
5286 \def\tikztiming@nocombine@D@edge@{}%
5287 \def\tikztiming@alias@D@edge@{D}%
5288 % \end{macrocode}
5289 %
5290 % \begin{macro}{\tikztiming@trans@D@fill}[2]{Original width}{Width to subtract}
5291 % \begin{macrocode}
5292 \def\tikztiming@trans@D@fill#1#2{%
5293 node [timing/save] (timing@save) {}; \path [\bgstyle] (timing@save) ++(0,0)
5294 -- +(0.5*\dslope,-0.5*\height)
5295 -- ++($ (#1,-0.5*\height) - (#2,0) $)
5296 -- +(0.5*\dslope,0.5*\height)
5297 -- +(0,\height)
5298 -- ++($ (#2,\height) - (#1,0) + (0.5*\dslope,0) $)
5299 -- cycle;
5300 \draw [timing/restore,\style] (timing@save) ++(0,0)
5301 node [timing/save] (timing@dstart) {}
5302 }
5303 % \end{macrocode}
5304 % \end{macro}
5305 %
5306 % \begin{macrocode}
5307 \tikztimingdef{LL}{
5308 -- ++(#1,0)
5309 }
5310
5311 \tikztimingdef{HL}{
5312 -- ++(\slope,-\height)
5313 \tikztiminguse{HH}{#1-\slope}
5314 }
5315
5316
5317 \tikztimingdef{LZ}{
5318 \newdraw [\style]
5319 -- ++(\zslope,+\height/2.)
5320 -- ++($ (#1,0) - (\zslope,0) $)
5321 }
5322 \tikztimingdef{HZ}{%
5323 \newdraw [\style]
5324 -- ++(\zslope,-\height/2.)
5325 -- ++($ (#1,0) - (\zslope,0) $)
5326 }
5327 \tikztimingdef{ZL}{%
5328 \newdraw [\style]
5329 -- ++(\zslope,-\height/2.)
5330 -- ++($ (#1,0) - (\zslope,0) $)
5331 }
5332
5333 \tikztimingdef{DZ}{
5334 \tikztiming@oldnodecenter@
5335 \newdraw [\style]
5336 -- ($ (timing@ref) + (#1,0) $)
5337 }
5338
5339 \def\tikztiming@chard#1{%
5340 \newdraw [\style,preaction={\bgstyle}]
5341 coordinate (timing@dstart)
5342 -- +(\dslope/2,\height/2)
5343 -- ($ (timing@ref) + (#1,\height/2) $)
5344 -- +(\dslope/2,-\height/2)
5345 -- +(0,-\height)
5346 -- ($ (timing@dstart) + (\dslope/2,-\height/2) $)
5347 -- (timing@dstart)
5348 ($ (timing@ref) + (#1,0) $)
5349 coordinate (timing@ref)
5350 ++(\dslope/2,0)
5351 coordinate (timing@dend)
5352 \tikztiming@oldnodecenter{%
5353 (-\dslope/2,-\height/2)
5354 }%
5355 \newdraw [timing/every char]
5356 }
5357
5358 \def\tikztiming@chard@#1{%
5359 \newdraw [\bgstyle]
5360 -- +(\dslope/2,\height/2)
5361 -- ($ (timing@ref) + (#1,\height/2) $)
5362 -- +(0,-\height)%
5363 -- ($ (timing@save) + (\dslope/2,-\height/2) $)
5364 -- (timing@save)
5365 \newdraw [\style]
5366 coordinate (timing@dstart)
5367 -- +(\dslope/2,\height/2)
5368 -- ($ (timing@ref) + (#1,\height/2) $)
5369 +(0,-\height)%
5370 -- ($ (timing@save) + (\dslope/2,-\height/2) $)
5371 -- (timing@save)
5372 ($ (timing@ref) + (#1,0) $)
5373 coordinate (timing@ref)
5374 \tikztiming@setref{timing@dend}{\dslope/2,0}
5375 \tikztiming@oldnodecenter{%
5376 (0,-\height/2)
5377 }%
5378 \newdraw [timing/every char]
5379 }
5380
5381 \def\tikztiming@@chard#1{%
5382 ++(0,\height/2)
5383 \newdraw [\bgstyle]
5384 -- +(0,\height/2)
5385 -- ($ (timing@ref) + (#1,\height/2) $)
5386 -- +(\dslope/2,-\height/2)
5387 -- +(0,-\height)
5388 -- ($ (timing@save) + (0,-\height/2) $)
5389 -- (timing@save)
5390 \newdraw [\style]
5391 +(0,0)
5392 coordinate (timing/start)
5393 +(-\dslope/2,0)
5394 coordinate (timing@dstart)
5395 +(0,\height/2)
5396 -- ($ (timing@ref) + (#1,\height/2) $)
5397 -- +(\dslope/2,-\height/2)
5398 -- +(0,-\height)
5399 -- ($ (timing@save) + (0,-\height/2) $)
5400 ($ (timing@ref) + (#1,0) $)
5401 coordinate (timing@ref)
5402 ++(\dslope/2,0)
5403 coordinate (timing@dend)
5404 \tikztiming@oldnodecenter{%
5405 (-\dslope/2,-\height/2)
5406 }%
5407 \newdraw [timing/every char]
5408 }
5409
5410 \def\tikztiming@@chard@#1{%
5411 ++(0,\height/2)
5412 \newdraw [\bgstyle]
5413 -- +(0,\height/2)
5414 -- ($ (timing@ref) + (#1,\height/2) $)
5415 -- +(0,-\height)
5416 -- ($ (timing@save) + (0,-\height/2) $)
5417 -- (timing@save)
5418 \newdraw [\style]
5419 +(0,0)
5420 coordinate (timing/start)
5421 coordinate (timing@ref)
5422 \tikztiming@setref{timing@dstart}{-\dslope/2,0}
5423 +(0,\height/2)
5424 -- +(#1,\height/2)
5425 +(#1,-\height/2)
5426 -- ($ (timing@save) + (0,-\height/2) $)
5427 ++(#1,\height/2)
5428 coordinate (timing@ref)
5429 \tikztiming@setref{timing@dend}{\dslope/2,0}
5430 \tikztiming@oldnodecenter{%
5431 (0,-\height/2)
5432 }%
5433 \newdraw [timing/every char]
5434 }
5435
5436 \def\tikztiming@dchardu#1{%
5437 \tikztiming@oldnodecenter@
5438 \newdraw [\bgstyle]
5439 -- +(0,\height/2)
5440 -- ($ (timing@ref) + (#1,\height/2) $)
5441 -- +(\dslope/2,-\height/2)
5442 -- +(0,-\height)
5443 -- ($ (timing@save) + (0,-\height/2) $)
5444 -- (timing@save)
5445 \newdraw [\style]
5446 +(0,\height/2)
5447 -- ($ (timing@ref) + (#1,\height/2) $)
5448 -- +(\dslope/2,-\height/2)
5449 -- +(0,-\height)
5450 -- ($ (timing@save) + (0,-\height/2) $)
5451 ($ (timing@ref) + (#1,0) $)
5452 coordinate (timing@ref)
5453 ++(\dslope/2,0)
5454 coordinate (timing@dend)
5455 \tikztiming@oldnodecenter{%
5456 (-\dslope/2,-\height/2)
5457 }%
5458 \newdraw [timing/every char]
5459 }
5460
5461 \def\tikztiming@uchardd#1{%
5462 \tikztiming@oldnodecenter@
5463 \newdraw [\bgstyle]
5464 -- +(\dslope/2,\height/2)
5465 -- ($ (timing@ref) + (#1,\height/2) $)
5466 -- +(0,-\height)
5467 -- ($ (timing@save) + (\dslope/2,-\height/2) $)
5468 -- (timing@save)
5469 \newdraw [\style]
5470 coordinate (timing@dstart)
5471 -- +(\dslope/2,\height/2)
5472 -- ($ (timing@ref) + (#1,\height/2) $)
5473 +(0,-\height)
5474 -- ($ (timing@save) + (\dslope/2,-\height/2) $)
5475 -- (timing@save)
5476 ($ (timing@ref) + (#1,0) $)
5477 coordinate (timing@ref)
5478 coordinate [shift={(\dslope/2,0)}](timing@dend)
5479 \tikztiming@oldnodecenter{%
5480 ($ (0,0) - (0,\height/2) $)
5481 }%
5482 \newdraw [timing/every char]
5483 }
5484
5485 \tikztimingdef{DD}{%
5486 \tikztiming@dchardu{#1}%
5487 }
5488
5489 \tikztimingdef{UU}{%
5490 \tikztiming@dchardu{#1}%
5491 }
5492
5493 \def\tikztiming@dchard@#1{%
5494 \tikztiming@oldnodecenter@
5495 \newdraw [\bgstyle]
5496 -- +(0,\height/2)
5497 -- ($ (timing@ref) + (#1,\height/2) $)
5498 -- +(0,-\height)
5499 -- ($ (timing@save) + (0,-\height/2) $)
5500 -- (timing@save)
5501 \newdraw [\style]
5502 +(0,\height/2)
5503 -- ($ (timing@ref) + (#1,\height/2) $)
5504 +(0,-\height)
5505 -- ($ (timing@save) + (0,-\height/2) $)
5506 ($ (timing@ref) + (#1,0) $)
5507 coordinate (timing@ref)
5508 \tikztiming@setref{timing@dend}{\dslope/2,0}
5509 \tikztiming@oldnodecenter{%
5510 (0,-\height/2)
5511 }%
5512 \newdraw [timing/every char]
5513 }
5514
5515 \tikztimingdef{DD@}{
5516 \tikztiming@dchard@{#1}%
5517 }
5518
5519 \tikztimingcpy{DDD}{DD@}
5520 \tikztimingcpy{UUU}{DDD}
5521
5522 \tikztimingdef{{D@edge@}{D@edge@}}{%
5523 \tikztiming@oldnodecenter@
5524 \tikztiming@chard{#1}%
5525 }%
5526
5527 \tikztimingdef{@{D@edge@}}{%
5528 \tikztiming@@chard@{#1}%
5529 }%
5530
5531 \tikztimingdef{@{D@edge@}@}{%
5532 \tikztiming@@chard@{#1}%
5533 }%
5534
5535 \tikztimingdef{@{D@edge@}D}{%
5536 \tikztiming@@chard{#1}%
5537 }
5538
5539 \tikztimingdef{D{D@edge@}}{%
5540 \tikztiming@dchardu{#1}%
5541 }
5542
5543 \tikztimingdef{U{U@edge@}}{%
5544 \tikztiming@dchardu{#1}%
5545 }
5546
5547 \tikztimingdef{U{D@edge@}}{%
5548 \tikztiming@oldnodecenter@
5549 \tikztiming@chard{#1}%
5550 }
5551
5552 \tikztimingdef{U{D@edge@}@}{%
5553 \tikztiming@oldnodecenter@%
5554 \tikztiming@chard@{#1}%
5555 }
5556
5557 \tikztimingdef{D{U@edge@}}{%
5558 \tikztiming@oldnodecenter@%
5559 \tikztiming@chard{#1}%
5560 }
5561
5562 \tikztimingdef{D{U@edge@}@}{%
5563 \tikztiming@oldnodecenter@%
5564 \tikztiming@chard@{#1}%
5565 }
5566
5567 \tikztimingdef{D{D@edge@}@}{%
5568 \tikztiming@dchard@{#1}%
5569 }%
5570
5571 \tikztimingdef{U{U@edge@}@}{%
5572 \tikztiming@dchard@{#1}%
5573 }%
5574
5575 \tikztimingdef{{D@edge@}{D@edge@}@}{%
5576 \tikztiming@oldnodecenter@%
5577 \tikztiming@chard@{#1}%
5578 }%
5579
5580 \tikztimingdef{@{D@edge@}}{%
5581 \tikztiming@@chard{#1}%
5582 }%
5583
5584 \tikztimingdef{{D@edge@}D}{%
5585 \tikztiming@oldnodecenter@%
5586 \tikztiming@chard{#1}%
5587 }%
5588
5589 \tikztimingdef{{D@edge@}D@}{%
5590 \tikztiming@oldnodecenter@%
5591 \tikztiming@chard@{#1}%
5592 }%
5593
5594 \tikztimingdef{ZDZ}{
5595 coordinate (timing@ref)
5596 \tikztiming@chard{#1}
5597 }
5598 \tikztimingcpy{ZDX}{ZDZ}
5599 \tikztimingcpy{XDX}{ZDZ}
5600 \tikztimingcpy{XDZ}{ZDZ}
5601
5602 \tikztimingdef{ZDD}{
5603 coordinate (timing@ref)
5604 \tikztiming@chard@{#1}
5605 }
5606
5607 \tikztimingdef{ZDU}{
5608 coordinate (timing@ref)
5609 \tikztiming@chard{#1}
5610 }
5611
5612 \tikztimingcpy{ZUD}{ZDU}
5613 \tikztimingcpy{ZUU}{ZDD}
5614
5615 \tikztimingdef{ZD}{
5616 coordinate (timing@ref)
5617 \tikztiming@chard{#1}
5618 }
5619
5620 \tikztimingdef{@DD}{%
5621 \tikztiming@@chard@{#1}%
5622 }
5623
5624 \tikztimingdef{ZD@}{%
5625 coordinate (timing@ref)
5626 \tikztiming@chard@{#1}%
5627 }
5628
5629 \tikztimingdef{HD@}{%
5630 \tikztiming@setref{timing@ref}{0,-\height/2}
5631 -- ++(\dslope/2, -\height/2)
5632 \tikztiming@chard@{#1}%
5633 }
5634
5635 \tikztimingdef{TD@}{%
5636 \tikztiming@setref{timing@ref}{0,-\height/2 * \value{tikztimingtrans}}
5637 -- ++(\dslope/2, -\height/2 * \value{tikztimingtrans})
5638 \tikztiming@chard@{#1}%
5639 }
5640
5641 \tikztimingdef{TD}{%
5642 \code{\setcounter{tikztimingtrans}{-\value{tikztimingtrans}}}
5643 \tikztiming@setref{timing@ref}{0,\height/2 * \value{tikztimingtrans}}
5644 -- ++(\dslope/2, \height/2 * \value{tikztimingtrans})
5645 \tikztiming@chard{#1}%
5646 }
5647
5648 \tikztimingdef{TDD}{%
5649 \code{\setcounter{tikztimingtrans}{-\value{tikztimingtrans}}}
5650 \tikztiming@setref{timing@ref}{0,\height/2 * \value{tikztimingtrans}}
5651 -- ++(\dslope/2, \height/2 * \value{tikztimingtrans})
5652 \tikztiming@chard@{#1}%
5653 }
5654
5655 \tikztimingdef{TUD}{%
5656 \code{\setcounter{tikztimingtrans}{-\value{tikztimingtrans}}}
5657 \tikztiming@setref{timing@ref}{0,\height/2 * \value{tikztimingtrans}}
5658 -- ++(\dslope/2, \height/2 * \value{tikztimingtrans})
5659 \tikztiming@chard{#1}%
5660 }
5661
5662 \tikztimingcpy{TDU}{TUD}
5663 \tikztimingcpy{TUU}{TDD}
5664
5665 \tikztimingdef{LD@}{%
5666 \tikztiming@setref{timing@ref}{0,\height/2}
5667 -- ++(\dslope/2, \height/2)
5668 \tikztiming@chard@{#1}%
5669 }
5670
5671 \tikztimingdef{@D}{%
5672 \tikztiming@@chard@{#1}%
5673 }
5674
5675 \tikztimingdef{@D@}{%
5676 \tikztiming@@chard@{#1}%
5677 }
5678
5679 \tikztimingcpy{H{D@edge@}@}{HD@}
5680 \tikztimingcpy{L{D@edge@}@}{LD@}
5681 \tikztimingcpy{Z{D@edge@}@}{ZD@}
5682 \tikztimingcpy{T{D@edge@}@}{TD@}
5683
5684 \tikztimingdef{@DZ}{%
5685 \tikztiming@@chard{#1}%
5686 }
5687 \tikztimingdef{@DH}{%
5688 \tikztiming@@chard{#1}%
5689 }
5690 \tikztimingdef{@DL}{%
5691 \tikztiming@@chard{#1}%
5692 }
5693 \tikztimingdef{@DT}{%
5694 \tikztiming@@chard{#1}%
5695 }
5696
5697 \tikztimingdef{LD}{
5698 \tikztiming@setref{timing@ref}{0,\height/2}
5699 -- ++(\dslope/2, \height/2)
5700 \tikztiming@chard{#1}%
5701 }
5702
5703 \tikztimingdef{LDD}{
5704 \tikztiming@setref{timing@ref}{0,\height/2}
5705 -- ++(\dslope/2, \height/2)
5706 \tikztiming@chard@{#1}
5707 }
5708
5709 \tikztimingdef{LDU}{
5710 \tikztiming@setref{timing@ref}{0,\height/2}
5711 -- ++(\dslope/2, \height/2)
5712 \tikztiming@chard{#1}
5713 }
5714
5715 \tikztimingcpy{LUD}{LDU}
5716 \tikztimingcpy{LUU}{LDD}
5717
5718 \tikztimingdef{HD}{
5719 \tikztiming@setref{timing@ref}{0,-\height/2}
5720 -- ++(\dslope/2, -\height/2)
5721 \tikztiming@chard{#1}
5722 }
5723
5724 \tikztimingdef{HDD}{
5725 \tikztiming@setref{timing@ref}{0,-\height/2}
5726 -- ++(\dslope/2, -\height/2)
5727 \tikztiming@chard@{#1}
5728 }
5729
5730 \tikztimingdef{HDU}{
5731 \tikztiming@setref{timing@ref}{0,-\height/2}
5732 -- ++(\dslope/2, -\height/2)
5733 \tikztiming@chard{#1}
5734 }
5735 \tikztimingcpy{HUD}{HDU}
5736 \tikztimingcpy{HUU}{HDD}
5737
5738 % \end{macrocode}
5739 %
5740 % \subsection{Character `M'}
5741 % \begin{macrocode}
5742 \tikztimingecopy{M}{Z}
5743 \tikztimingchar{M}{++(0,\height/2.)}{
5744 \newdraw [\style]
5745 -- ++(#1,0)
5746 \newdraw [\style/base]
5747 }
5748
5749 \tikztimingdef{ZM}{
5750 \newdraw [\style]
5751 -- ++(#1,0)
5752 \newdraw [\style/base]
5753 }
5754
5755 \tikztimingdef{LM}{
5756 \newdraw [\style/base]
5757 -- ++($ (1/8,0) + (0,\height/2) $)
5758 \newdraw [\style]
5759 -- ++($ (-1/8,0) + (#1,0) $)
5760 \newdraw [\style/base]
5761 }
5762
5763 \tikztimingdef{HM}{
5764 \newdraw [\style/base]
5765 -- ++($ (1/8,0) + (0,-1*\height/2) $)
5766 \newdraw [\style]
5767 -- ++($ (-1/8,0) + (#1,0) $)
5768 \newdraw [\style/base]
5769 }
5770
5771 \tikztimingdef{DM}{
5772 \tikztiming@oldnodecenter@%
5773 \newdraw [\style]
5774 -- ($ (timing@ref) + (#1,0) $)
5775 \newdraw [\style/base]
5776 }
5777
5778 % \end{macrocode}
5779 %
5780 % \subsection{Character `T'}
5781 % \begin{macrocode}
5782 \newcounter{tikztimingtrans}
5783 \newcounter{tikztimingtranspos}
5784
5785 \tikztimingchar{T}{++(0,0)}{
5786 -- ++(#1,0)
5787 }
5788 \def\tikztiming@nocombine@T{}%
5789
5790 \tikztimingdef{HT}{%
5791 {[\style]
5792 \code{\setcounter{tikztimingtrans}{-1}}
5793 -- ++(\slope,\value{tikztimingtrans}*\height) -- ++($ (#1,0) - (\slope,0) $)
5794 }
5795 }
5796
5797 \tikztimingdef{LT}{%
5798 {[\style]
5799 \code{\setcounter{tikztimingtrans}{+1}}
5800 -- ++(\slope,\value{tikztimingtrans}*\height) -- ++($ (#1,0) - (\slope,0) $)
5801 }
5802 }
5803
5804 \tikztimingdef{TL}{%
5805 \code{\setcounter{tikztimingtranspos}{\value{tikztimingtrans}}%
5806 \addtocounter{tikztimingtranspos}{+1}}
5807 -- ++(\slope, -0.5*\value{tikztimingtranspos}*\height) -- ++($ (#1,0) - (\slope,0) $)
5808 }
5809
5810 \tikztimingdef{TH}{%
5811 \code{\setcounter{tikztimingtranspos}{\value{tikztimingtrans}}%
5812 \addtocounter{tikztimingtranspos}{-1}}
5813 -- ++(\slope, -0.5*\value{tikztimingtranspos}*\height) -- ++($ (#1,0) - (\slope,0) $)
5814 }
5815
5816 \tikztimingdef{TZ}{%
5817 \newdraw [\style]
5818 \code{\setcounter{tikztimingtrans}{-\value{tikztimingtrans}}}
5819 -- ++(\zslope,\value{tikztimingtrans}*\height/2.)
5820 -- ++($ (#1,0) - (\zslope,0) $)
5821 }
5822
5823 \tikztimingdef{ZT}{%
5824 \newdraw [timing/every char] {[\style]
5825 \code{\setcounter{tikztimingtrans}{-\value{tikztimingtrans}}}
5826 -- ++(\zslope,\value{tikztimingtrans}*\height/2.)
5827 -- ++($ (#1,0) - (\zslope,0) $)
5828 }
5829 }
5830
5831 \tikztimingdef{TT}{%
5832 {[\style]
5833 \code{\setcounter{tikztimingtrans}{-\value{tikztimingtrans}}}
5834 -- ++(\slope,\value{tikztimingtrans}*\height)
5835 -- ++($ (#1,0) - (\slope,0) $)
5836 }
5837 }
5838
5839 \tikztimingdef{DT}{
5840 \code{\setcounter{tikztimingtrans}{-1}}
5841 \tikztiming@oldnodecenter@%
5842 \newdraw [timing/every char] {[\style]
5843 -- +(\dslope/2.,-\height/2)
5844 -- ($ (timing@ref) + (#1,-\height/2) $)
5845 }
5846 }
5847
5848 \tikztimingdef{TM}{%
5849 \newdraw [\style/base]
5850 \code{\setcounter{tikztimingtrans}{-\value{tikztimingtrans}}}
5851 -- ++($ (1/8,0) + (0,\value{tikztimingtrans}*\height/2) $)
5852 \newdraw [\style]
5853 -- ++($ (-1/8,0) + (#1,0) $)
5854 \newdraw [\style/base]
5855 }
5856 % \end{macrocode}
5857 %
5858 % \subsection{Character `C'}
5859 % \begin{macrocode}
5860 \tikztimingecopy{C}{T}
5861 % \end{macrocode}
5862 %
5863 % \subsection{Character `U'}
5864 % \begin{macrocode}
5865 \tikztimingecopy{U}{D}
5866
5867 \def\tikztiming@triple@U@edge@{}%
5868 \def\tikztiming@nocombine@U@edge@{}%
5869 \def\tikztiming@alias@U@edge@{D@edge@}%
5870
5871 \tikztimingcpy{UU@}{DD@}%
5872
5873 \tikztimingdef{UDU}{%
5874 \tikztiming@oldnodecenter@%
5875 \tikztiming@chard{#1}%
5876 }
5877 \tikztimingcpy{DUD}{UDU}%
5878
5879 \tikztimingdef{UDD}{%
5880 \tikztiming@uchardd{#1}%
5881 }
5882
5883 \tikztimingcpy{{D@edge@}DD}{UDD}
5884 \tikztimingcpy{{U@edge@}UU}{{D@edge@}DD}
5885
5886 \tikztimingdef{H{D@edge@}}{
5887 \tikztiming@setref{timing@ref}{0,-\height/2}
5888 -- ++(\dslope/2, -\height/2)
5889 \tikztiming@chard{#1}%
5890 }
5891
5892 \tikztimingdef{L{D@edge@}}{
5893 \tikztiming@setref{timing@ref}{0,\height/2}
5894 -- ++(\dslope/2, \height/2)
5895 \tikztiming@chard{#1}%
5896 }
5897
5898 \tikztimingdef{Z{D@edge@}}{
5899 coordinate (timing@ref)
5900 \tikztiming@chard{#1}%
5901 }
5902
5903 \tikztimingdef{T{D@edge@}}{
5904 \code{\setcounter{tikztimingtrans}{-\value{tikztimingtrans}}}
5905 \tikztiming@setref{timing@ref}{0,\height/2 * \value{tikztimingtrans}}
5906 -- ++(\dslope/2, \height/2 * \value{tikztimingtrans})
5907 \tikztiming@chard{#1}%
5908 }
5909
5910 \tikztimingdef{{D@edge@}DU}{
5911 \tikztiming@oldnodecenter@
5912 \tikztiming@chard{#1}
5913 }
5914 \tikztimingcpy{{U@edge@}UD}{{D@edge@}DU}
5915
5916 \tikztimingdef{DDU}{%
5917 \tikztiming@dchardu{#1}
5918 }
5919
5920 \tikztimingcpy{DUU}{UDD}%
5921 \tikztimingcpy{UUD}{DDU}%
5922
5923 \tikztimingdef{@UU}{%
5924 \tikztiming@@chard@{#1}%
5925 }
5926
5927 \tikztimingdef{@UD}{%
5928 \tikztiming@@chard{#1}%
5929 }
5930
5931 \tikztimingdef{@DU}{%
5932 \tikztiming@@chard{#1}%
5933 }
5934
5935 \tikztimingdef{UD}{%
5936 \tikztiming@oldnodecenter@%
5937 \tikztiming@chard{#1}%
5938 }
5939
5940 \tikztimingdef{DU}{%
5941 \tikztiming@oldnodecenter@%
5942 \tikztiming@chard{#1}%
5943 }
5944
5945 \tikztimingdef{UD@}{%
5946 \tikztiming@oldnodecenter@%
5947 \tikztiming@chard@{#1}%
5948 }
5949
5950 \tikztimingdef{DU@}{%
5951 \tikztiming@oldnodecenter@%
5952 \tikztiming@chard@{#1}%
5953 }
5954
5955 % \end{macrocode}
5956 %
5957 % \subsection{Character `X'}
5958 % \begin{macrocode}
5959 \tikztimingecopy{X}{Z}
5960 % \end{macrocode}
5961 %
5962 % Save current list of characters as list of default characters.
5963 % \begin{macrocode}
5964 \let\tikztiming@chars@default\tikztiming@chars
5965 % \end{macrocode}
5966 %
5967 % \clearpage
5968 % \section{Libraries}
5969 %
5970 % \begin{macrocode}
5971 \newcommand*\usetikztiminglibrary[2][]{%
5972 \edef\tikztiming@library@options{#1}%
5973 \@ifnextchar{[}%]
5974 {\tikztiming@library{#2}}%
5975 {\tikztiming@library{#2}[]}%
5976 }
5977 \def\tikztiming@library#1[#2]{%
5978 \edef\tikztiming@library@date{#2}%
5979 \tikztiming@library@#1,\relax
5980 }
5981 % \end{macrocode}
5982 % Load the library as package. The \LaTeX\ core macro \cs{zap@space} is patched
5983 % to a no-op to keep spaces in the option text. Otherwise the option keys may
5984 % not contain spaces.
5985 % \begin{macrocode}
5986 \def\tikztiming@zap@space#1 \@empty{#1}
5987
5988 \def\tikztiming@library@#1,{%
5989 \IfFileExists{tikz-timing-#1.sty}%
5990 { \let\tikztiming@orig@zap@space\zap@space
5991 \let\zap@space\tikztiming@zap@space
5992 \RequirePackage
5993 [\tikztiming@library@options]%
5994 {tikz-timing-#1}%
5995 [\tikztiming@library@date]%
5996 \let\zap@space\tikztiming@orig@zap@space
5997 }%
5998 {\PackageError{tikz-timing}%
5999 {No tikz-timing library `#1' found!}{}%
6000 }%
6001 \@ifnextchar\relax{}{\tikztiming@library@}%
6002 }
6003 % \end{macrocode}
6004 % \iffalse
6005 %</tikz-timing.sty>
6006 % \fi
6007 %
6008 % \subsection{Libraries}
6009 %
6010 % \subsubsection{Either High or Low}
6011 % \iffalse
6012 %<*tikz-timing-either.sty>
6013 % \fi
6014 % \begin{macrocode}
6015 %<!COPYRIGHT>
6016 \NeedsTeXFormat{LaTeX2e}[1999/12/01]
6017 \ProvidesPackage{tikz-timing-either}[%
6018 %<!DATE>
6019 %<!VERSION>
6020 %<*DRIVER>
6021 2099/01/01 develop
6022 %</DRIVER>
6023 tikz-timing library for uncertain transitions]
6024 % \end{macrocode}
6025 %
6026 % Provides character "E".
6027 % \begin{macrocode}
6028 \tikztimingchar{E}{
6029 ++(0,0)
6030 \code{\setcounter{tikztimingtranspos}{0}}%
6031 \code{\setcounter{tikztimingtrans}{1}}%
6032 }{
6033 \code{\setcounter{tikztimingtranspos}{0}}%
6034 \code{\setcounter{tikztimingtrans}{1}}%
6035 \tikztiminguse{D}{#1}%
6036 \newdraw [\style]
6037 }
6038 \def\tikztiming@triple@E{}%
6039
6040 \tikztimingdef{LE@}{%
6041 \newdraw [\bgstyle]
6042 -- ++(\slope,\height)%
6043 -- ++($ (#1,0) - (\slope,0) $)%
6044 -- ++(0,-\height)%
6045 -- ++($ -1*(#1,0) $)%
6046 \newdraw [\style]
6047 -- ++(\slope,\height)%
6048 -- ++($ (#1,0) - (\slope,0) $)%
6049 ++($ -1*(#1,\height) $)%
6050 -- ++($ 1*(#1,0) $)%
6051 ++(0,.5\height)%
6052 \newdraw [\nstyle]
6053 \code{\setcounter{tikztimingtranspos}{0}}%
6054 \code{\setcounter{tikztimingtrans}{1}}%
6055 }%
6056
6057 \tikztimingdef{HE@}{%
6058 \newdraw [\bgstyle]
6059 -- ++(\slope,-\height)%
6060 -- ++($ (#1,0) - (\slope,0) $)%
6061 -- ++(0,\height)%
6062 -- ++($ -1*(#1,0) $)%
6063 \newdraw [\style]
6064 -- ++(\slope,-\height)%
6065 -- ++($ (#1,0) - (\slope,0) $)%
6066 ++($ -1*(#1,-\height) $)%
6067 -- ++($ 1*(#1,0) $)%
6068 ++(0,-.5\height)%
6069 \newdraw [\nstyle]
6070 \code{\setcounter{tikztimingtranspos}{1}}%
6071 \code{\setcounter{tikztimingtrans}{-1}}%
6072 }%
6073
6074 \tikztimingdef{TE@}{%
6075 \newdraw [\bgstyle]
6076 -- ++(\slope,-\height * \value{tikztimingtrans})%
6077 -- ++($ (#1,0) - (\slope,0) $)%
6078 -- ++(0,\height * \value{tikztimingtrans})%
6079 -- ++($ -1*(#1,0) $)%
6080 \newdraw [\style]
6081 -- ++(\slope,-\height * \value{tikztimingtrans})%
6082 -- ++($ (#1,0) - (\slope,0) $)%
6083 ++($ -1*(#1,-\height * \value{tikztimingtrans}) $)%
6084 -- ++($ 1*(#1,0) $)%
6085 ++(0,-1*\value{tikztimingtrans}*.5*\height)%
6086 \newdraw [\nstyle]
6087 }%
6088
6089 \tikztimingdef{LEL}{%
6090 \newdraw [\style,preaction={\bgstyle}]
6091 -- +(\slope,\height)%
6092 -- +(#1,\height)%
6093 -- +($ (#1,0) + (\slope,0) $)%
6094 -- +(0,0)
6095 ++(#1,\height/2) coordinate (timing@ref)
6096 ++(\slope,-\height/2)%
6097 \newdraw [\nstyle]
6098 }%
6099
6100 \tikztimingdef{LEH}{%
6101 \newdraw [\style,preaction={\bgstyle}]
6102 -- +(\slope,\height)%
6103 -- +($ (#1,\height) + (\slope,0) $)%
6104 -- +(#1,0)%
6105 -- +(0,0)
6106 ++(#1,\height/2) coordinate (timing@ref)
6107 ++(\slope,\height/2)%
6108 \newdraw [\nstyle]
6109 }%
6110
6111 \tikztimingdef{HEH}{%
6112 \newdraw [\style,preaction={\bgstyle}]
6113 -- +($ (#1,0) + (\slope,0) $)%
6114 -- +(#1,-\height)%
6115 -- +(\slope,-\height)
6116 -- +(0,0)
6117 ++(#1,-\height/2) coordinate (timing@ref)
6118 ++(\slope,\height/2)%
6119 \newdraw [\nstyle]
6120 }%
6121
6122 \tikztimingdef{HEL}{%
6123 \newdraw [\style,preaction={\bgstyle}]
6124 -- +(#1,0)
6125 -- +($ (#1,-\height) + (\slope,0) $)%
6126 -- +(\slope,-\height)
6127 -- +(0,0)
6128 ++(#1,-\height/2) coordinate (timing@ref)
6129 ++(\slope,-\height/2)%
6130 \newdraw [\nstyle]
6131 }%
6132
6133 \tikztimingdef{HET}{
6134 \newdraw [\style,preaction={\bgstyle}]
6135 -- +(#1,0)
6136 {[\nstyle]
6137 -- +($ (#1,-\height) + (\slope,0) $)%
6138 }
6139 -- +(\slope,-\height)
6140 -- +(0,0)
6141 {[\nstyle]
6142 ++(#1,-\height/2) coordinate (timing@ref)
6143 ++(\slope,-\height/2)%
6144 }
6145 \newdraw [\nstyle]
6146 \code{\setcounter{tikztimingtrans}{-1}}%
6147 }
6148
6149 \tikztimingdef{LET}{
6150 \newdraw [\style,preaction={\bgstyle}]
6151 -- +(\slope,\height)%
6152 {[\nstyle]
6153 -- +($ (#1,\height) + (\slope,0) $)%
6154 }
6155 -- +(#1,0)%
6156 -- +(0,0)
6157 {[\nstyle]
6158 ++(#1,\height/2)%
6159 coordinate (timing@ref)
6160 ++(\slope,\height/2)%
6161 }
6162 \newdraw [\nstyle]
6163 \code{\setcounter{tikztimingtrans}{1}}%
6164 }
6165
6166 \tikztimingdef{HEE}{%
6167 \newdraw [\style,preaction={\bgstyle}]
6168 -- +(#1,0) coordinate (timing@refb)
6169 \tikztiming@setref{timing@ref}{0,-\height/2}
6170 -- +($ (#1,-\height) + (\slope,0) $) coordinate (timing@refa)
6171 -- +(\slope,-\height)
6172 -- +(0,0)
6173 \tikztiming@setref{timing@ref}{#1,-\height/2}
6174 ++($ (#1,-\height) + (\slope,0) $)%
6175 \code{\setcounter{tikztimingtranspos}{1}}%
6176 \code{\setcounter{tikztimingtrans}{-1}}%
6177 \newdraw [\nstyle]
6178 }%
6179
6180 \tikztimingdef{LEE}{%
6181 \newdraw [\style,preaction={\bgstyle}]
6182 -- +(#1,0) coordinate (timing@refa)
6183 \tikztiming@setref{timing@ref}{0,\height/2}
6184 -- +($ (#1,\height) + (\slope,0) $) coordinate (timing@refb)
6185 -- +(\slope,\height)
6186 -- +(0,0)
6187 ++(#1,0) \tikztiming@setref{timing@ref}{0,\height/2}
6188 \code{\setcounter{tikztimingtranspos}{0}}%
6189 \code{\setcounter{tikztimingtrans}{1}}%
6190 \newdraw [\nstyle]
6191 }%
6192
6193 \tikztimingdef{TEE}{%
6194 \newdraw [\style,preaction={\bgstyle}]
6195 -- +(\slope, -\height * \value{tikztimingtrans})%
6196 -- +($ (#1,0) + (\slope, -\height * \value{tikztimingtrans}) $)
6197 -- +(#1,0)
6198 -- +(0,0)%
6199 \code{\setcounter{tikztimingtranspos}{\value{tikztimingtrans}}%
6200 \addtocounter{tikztimingtranspos}{+1}}
6201 +($ (#1,0) + (\slope/2 + \slope/2 * \value{tikztimingtrans}, -\height/2 * \value{tikztimingtranspos}) $)
6202 coordinate (timing@refa)
6203 +($ (#1,0) + (\slope/2 - \slope/2 * \value{tikztimingtrans}, \height - \height/2 * \value{tikztimingtranspos}) $)
6204 coordinate (timing@refb)
6205 ++(#1,0)
6206 \tikztiming@setref{timing@ref}{0,-\height/2 * \value{tikztimingtrans}}
6207 ++(
6208 .5 * \slope + .5 * \value{tikztimingtrans} * \slope,
6209 -.5 * \height - .5 * \value{tikztimingtrans} * \height
6210 )
6211 \code{\setcounter{tikztimingtrans}{-\value{tikztimingtrans}}}
6212 \newdraw [\nstyle]
6213 }%
6214
6215
6216 \tikztimingdef{TEH}{%
6217 \newdraw [\style,preaction={\bgstyle}]
6218 -- ++(\slope,-\height * \value{tikztimingtrans})
6219 -- ++($ (#1,0) - (\slope/2 + \slope/2 * \value{tikztimingtrans},0) $)
6220 -- ++(\slope * \value{tikztimingtrans},
6221 \height * \value{tikztimingtrans})
6222 -- ++($ -1*(#1,0) - (\slope/2 + \slope/2 * \value{tikztimingtrans},0) $)
6223 ++($ (#1,-\height/2 * \value{tikztimingtrans}) $) coordinate (timing@ref)
6224 ++(\slope,\height/2)
6225 \newdraw [\nstyle]
6226 }
6227
6228 \tikztimingdef{TEL}{%
6229 \newdraw [\style,preaction={\bgstyle}]
6230 -- ++(\slope,-\height * \value{tikztimingtrans})
6231 -- ++($ (#1,0) - (\slope/2 - \slope/2 * \value{tikztimingtrans},0) $)
6232 -- ++(-\slope * \value{tikztimingtrans},
6233 \height * \value{tikztimingtrans})
6234 -- ++($ -1*(#1,0) - (\slope/2 + -\slope/2 * \value{tikztimingtrans},0) $)
6235 ++($ (#1,-\height/2 * \value{tikztimingtrans}) $) coordinate (timing@ref)
6236 ++(\slope,-\height/2)
6237 \newdraw [\nstyle]
6238 }
6239
6240 \tikztimingdef{TEZ}{%
6241 \newdraw [\style,preaction={\bgstyle}]
6242 -- ++(\slope,-\height * \value{tikztimingtrans})
6243 -- ++($ (#1,0) - (\slope,0) $)
6244 -- ++(\zslope,
6245 \height/2 * \value{tikztimingtrans})
6246 -- ++(-\zslope,
6247 \height/2 * \value{tikztimingtrans})
6248 -- ++($ -1*(#1,0) $)
6249 ++($ (#1,0) + (0,-\height/2 * \value{tikztimingtrans}) $)
6250 coordinate (timing@ref)
6251 ++(\zslope,0)
6252 \newdraw [\nstyle]
6253 }
6254
6255 \tikztimingdef{TED}{%
6256 \newdraw [\style,preaction={\bgstyle}]
6257 -- ++(\slope,-\height * \value{tikztimingtrans})
6258 -- ++($ (#1,0) - (\slope,0) $)
6259 -- ++(\dslope/2,
6260 \height/2 * \value{tikztimingtrans})
6261 -- ++(-\dslope/2,
6262 \height/2 * \value{tikztimingtrans})
6263 -- ++($ -1*(#1,0) $)
6264 ++($ (#1,0) + (0,-\height/2 * \value{tikztimingtrans}) $)
6265 coordinate (timing@ref)
6266 ++(\dslope/2,0)
6267 \newdraw [\nstyle]
6268 }
6269
6270 \tikztimingdef{TET}{%
6271 \newdraw [\style,preaction={\bgstyle}]
6272 -- +(\slope, -\height * \value{tikztimingtrans})%
6273 {[\nstyle]
6274 -- +($ (#1,0) + (\slope, -\height * \value{tikztimingtrans}) $)%
6275 }
6276 -- +(#1,0)%
6277 -- +(0,0)%
6278 {[\nstyle]
6279 ++($ (#1,0) + (0, -\height/2 * \value{tikztimingtrans}) $)%
6280 coordinate (timing@ref)
6281 ++(\slope, -\height/2 * \value{tikztimingtrans})%
6282 }
6283 \code{\setcounter{tikztimingtrans}{-\value{tikztimingtrans}}}
6284 \newdraw [\nstyle]
6285 }%
6286
6287 \tikztimingdef{EEZ}{%
6288 \newdraw [\style,preaction={\bgstyle}]
6289 -- (timing@refb)
6290 -- ($ (timing@ref) + (#1,+\height/2) $)
6291 -- ($ (timing@ref) + (#1,0) + (\zslope,0) $)
6292 -- ($ (timing@ref) + (#1,-\height/2) $)
6293 -- (timing@refa)
6294 ($ (timing@ref) + (#1,0) + (\zslope,0) $)
6295 coordinate (timing@ref) at ($ (timing@ref) + (#1,0) $)
6296 \newdraw
6297 }%
6298
6299 \tikztimingdef{EED}{%
6300 \newdraw [\style,preaction={\bgstyle}]
6301 -- (timing@refb)
6302 -- ($ (timing@ref) + (#1,+\height/2) $)
6303 -- ($ (timing@ref) + (#1,0) + (\dslope/2,0) $)
6304 -- ($ (timing@ref) + (#1,-\height/2) $)
6305 -- (timing@refa)
6306 ($ (timing@ref) + (#1,0) + (\dslope/2,0) $)
6307 coordinate (timing@ref) at ($ (timing@ref) + (#1,0) $)
6308 \newdraw
6309 }%
6310
6311
6312 \tikztimingdef{HEZ}{%
6313 \newdraw [\style,preaction={\bgstyle}]
6314 -- +(#1,0)
6315 -- +($ (#1,-\height/2) + (\zslope,0) $)%
6316 -- +(#1,-\height)
6317 -- +(\slope,-\height)
6318 -- +(0,0)
6319 ++(#1,-\height/2) coordinate (timing@ref)
6320 ++(\zslope,0)%
6321 \newdraw
6322 }%
6323
6324
6325 \tikztimingdef{LEZ}{%
6326 \newdraw [\style,preaction={\bgstyle}]
6327 -- +(\slope,\height)
6328 -- +(#1,\height)
6329 -- +($ (#1,\height/2) + (\zslope,0) $)%
6330 -- +(#1,0)
6331 -- +(0,0)
6332 ++(#1,\height/2) coordinate (timing@ref)
6333 ++(\zslope,0)%
6334 \newdraw
6335 }%
6336
6337
6338 \tikztimingdef{LED}{%
6339 \newdraw [\style,preaction={\bgstyle}]
6340 -- +(\slope,\height)
6341 -- +(#1,\height)
6342 -- +($ (#1,\height/2) + (\dslope/2,0) $)%
6343 -- +(#1,0)
6344 -- +(0,0)
6345 ++(#1,\height/2) coordinate (timing@ref)
6346 ++(\dslope/2,0)%
6347 \newdraw
6348 }%
6349
6350 \tikztimingdef{HED}{%
6351 \newdraw [\style,preaction={\bgstyle}]
6352 -- +(#1,0)
6353 -- +($ (#1,-\height/2) + (\dslope/2,0) $)%
6354 -- +(#1,-\height)
6355 -- +(\slope,-\height)
6356 -- +(0,0)
6357 ++(#1,-\height/2) coordinate (timing@ref)
6358 ++(\dslope/2,0)%
6359 \newdraw
6360 }%
6361
6362
6363 \tikztimingdef{EZ}{%
6364 \newdraw [\style]
6365 -- ($ (timing@ref) + (#1,0) $)%
6366 }
6367
6368 \tikztimingdef{EM}{%
6369 \newdraw [\style]
6370 -- ($ (timing@ref) + (#1,0) $)%
6371 \newdraw [\style/base]
6372 }
6373
6374 \tikztimingdef{EL}{%
6375 -- ($ (timing@ref) + (#1,-\height/2) $)%
6376 }%
6377 \tikztimingdef{EH}{%
6378 -- ($ (timing@ref) + (#1,+\height/2) $)%
6379 }%
6380
6381 \tikztimingdef{ED@}{%
6382 \tikztiming@chard@{#1}%
6383 }
6384 \tikztimingcpy{E{D@edge@}@}{ED@}
6385
6386 \tikztimingdef{ED}{%
6387 \tikztiming@chard{#1}%
6388 }
6389 \tikztimingcpy{E{D@edge@}}{ED}
6390 \tikztimingdef{EDD}{%
6391 \tikztiming@chard@{#1}%
6392 }
6393 \tikztimingdef{EUU}{%
6394 \tikztiming@chard@{#1}%
6395 }
6396 \tikztimingdef{EDU}{%
6397 \tikztiming@chard{#1}%
6398 }
6399 \tikztimingdef{EUD}{%
6400 \tikztiming@chard{#1}%
6401 }
6402
6403
6404 \tikztimingdef{DE@}{%
6405 \tikztiming@oldnodecenter@%
6406 \newdraw [\bgstyle]
6407 -- +(\dslope/2,\height/2)
6408 -- ($ (timing@ref) + (#1,\height/2) $)%
6409 -- ($ (timing@ref) + (#1,-\height/2) $)%
6410 -- ($ (timing@save) + (\dslope/2,-\height/2) $)
6411 -- (timing@save)
6412 \newdraw [\style]
6413 -- +(\dslope/2,\height/2)
6414 -- ($ (timing@ref) + (#1,\height/2) $)%
6415 ($ (timing@ref) + (#1,-\height/2) $)%
6416 -- ($ (timing@save) + (\dslope/2,-\height/2) $)
6417 -- (timing@save)
6418 ($ (timing@ref) + (#1,0) $)%
6419 coordinate (timing@ref)
6420 }
6421
6422 \tikztimingdef{EEE}{%
6423 \newdraw [\style,preaction={\bgstyle}]
6424 -- (timing@refb)
6425 -- ($ (timing@refb) + (#1,0) $)
6426 -- ($ (timing@refa) + (#1,0) $)
6427 -- (timing@refa)
6428 ++(#1,0) coordinate (timing@refa)
6429 coordinate (timing@refb) at ($ (timing@refb) + (#1,0) $)
6430 coordinate (timing@ref) at ($ (timing@ref) + (#1,0) $)
6431 \newdraw [\nstyle]
6432 }%
6433
6434 \tikztimingdef{EET}{%
6435 \newdraw [\style,preaction={\bgstyle}]
6436 -- (timing@refb)
6437 {[\nstyle]
6438 -- ($ (timing@ref) + (#1,+\height/2) + (\slope/2 + \slope/2 * \value{tikztimingtrans},0) $)
6439 -- ($ (timing@ref) + (#1,-\height/2) + (\slope/2 - \slope/2 * \value{tikztimingtrans},0) $)
6440 }
6441 -- (timing@refa)
6442 {[\nstyle]
6443 ($ (timing@ref) + (#1,\height/2 * \value{tikztimingtrans}) + (\slope,0) $)
6444 }
6445 coordinate (timing@ref) at ($ (timing@ref) + (#1,0) $)
6446 \newdraw [\nstyle]
6447 }%
6448
6449 \tikztimingdef{EEL}{%
6450 \newdraw [\style,preaction={\bgstyle}]
6451 -- (timing@refb)
6452 -- ($ (timing@ref) + (#1,+\height/2) $)
6453 -- ($ (timing@ref) + (#1,-\height/2) + (\slope,0) $)
6454 -- (timing@refa)
6455 ($ (timing@ref) + (#1,-\height/2) + (\slope,0) $)
6456 coordinate (timing@ref) at ($ (timing@ref) + (#1,0) $)
6457 \newdraw [\nstyle]
6458 }%
6459
6460 \tikztimingdef{EEH}{%
6461 \newdraw [\style,preaction={\bgstyle}]
6462 -- (timing@refb)
6463 -- ($ (timing@ref) + (#1,+\height/2) + (\slope,0) $)
6464 -- ($ (timing@ref) + (#1,-\height/2) $)
6465 -- (timing@refa)
6466 ($ (timing@ref) + (#1,+\height/2) + (\slope,0) $)
6467 coordinate (timing@ref) at ($ (timing@ref) + (#1,0) $)
6468 \newdraw [\nstyle]
6469 }%
6470
6471
6472 \tikztimingdef{EE@}{%
6473 \newdraw [\bgstyle]
6474 let \p0 = (timing@ref), \p1 = (timing@refa), \p2 = (timing@refb) in
6475 -- (\p2)
6476 -- ($ (\x0,\y2) + (#1,0) $)
6477 -- +(0,\y1-\y2)
6478 -- (\p1)
6479 \newdraw [\style]
6480 let \p0 = (timing@ref), \p1 = (timing@refa), \p2 = (timing@refb) in
6481 -- (\p2)
6482 -- ($ (\x0,\y2) + (#1,0) $)
6483 +(0,\y1-\y2)
6484 -- (\p1)
6485 ($ (timing@ref) + (#1,0) $) coordinate (timing@ref)
6486 \newdraw [\nstyle]
6487 }%
6488
6489 \tikztimingdef{ZE@}{
6490 \newdraw [\bgstyle]
6491 -- +(\zslope,\height/2)
6492 -- +(#1,\height/2)%
6493 -- +(#1,-\height/2)%
6494 -- +(\zslope,-\height/2)
6495 -- +(0,0)
6496 \newdraw [\style]
6497 -- +(\zslope,\height/2)
6498 -- +(#1,\height/2)%
6499 +(#1,-\height/2)%
6500 -- +(\zslope,-\height/2)
6501 -- +(0,0)
6502 ++(#1,0) coordinate (timing@ref)
6503 }
6504
6505 \tikztimingdef{ZEH}{%
6506 \newdraw [\style,preaction={\bgstyle}]
6507 -- +(\zslope, \height/2)
6508 -- +($ (#1,0) + (\slope, \height/2) $)
6509 -- +(#1,-\height/2)
6510 -- +(\zslope, -\height/2)
6511 -- +(0,0)
6512 ++(#1,0) coordinate (timing@ref)
6513 ++(\slope, \height/2)
6514 \newdraw [\nstyle]
6515 }
6516
6517 \tikztimingdef{ZEL}{%
6518 \newdraw [\style,preaction={\bgstyle}]
6519 -- +(\zslope, \height/2)
6520 -- +(#1,\height/2)
6521 -- +($ (#1,0) + (\slope, -\height/2) $)
6522 -- +(\zslope, -\height/2)
6523 -- +(0,0)
6524 ++(#1,0) coordinate (timing@ref)
6525 ++(\slope, -\height/2)
6526 \newdraw [\nstyle]
6527 }
6528
6529 \tikztimingdef{ZET}{%
6530 \newdraw [\style,preaction={\bgstyle}]
6531 -- +(\zslope, \height/2)
6532 {[\nstyle]
6533 -- +($ (#1, \height/2) + (\slope/2 - \slope/2 * \value{tikztimingtrans}, 0) $)
6534 -- +($ (#1,-\height/2) + (\slope/2 + \slope/2 * \value{tikztimingtrans}, 0) $)
6535 }
6536 -- +(\zslope, -\height/2)
6537 -- +(0,0)
6538 {[\nstyle]
6539 ++(#1,0) coordinate (timing@ref)
6540 ++(\slope,-\height/2 * \value{tikztimingtrans})
6541 }
6542 \code{\setcounter{tikztimingtrans}{-\value{tikztimingtrans}}}
6543 \newdraw [\nstyle]
6544 }
6545
6546 \tikztimingdef{DET}{%
6547 \tikztiming@oldnodecenter@%
6548 \newdraw [\style,preaction={\bgstyle}]
6549 -- +(\dslope/2, \height/2)
6550 {[\nstyle]
6551 -- ($ (timing@ref) + (#1, \height/2) + (\slope/2 - \slope/2 * \value{tikztimingtrans}, 0) $)
6552 -- ($ (timing@ref) + (#1,-\height/2) + (\slope/2 + \slope/2 * \value{tikztimingtrans}, 0) $)
6553 }
6554 -- ($ (timing@save) + (\dslope/2, -\height/2) $)
6555 -- (timing@save)
6556 {[\nstyle]
6557 ($ (timing@ref) + (#1,0) $) coordinate (timing@ref)
6558 ++(\slope,-\height/2 * \value{tikztimingtrans})
6559 }
6560 \code{\setcounter{tikztimingtrans}{-\value{tikztimingtrans}}}
6561 \newdraw [\nstyle]
6562 }
6563
6564 \tikztimingdef{ZEZ}{%
6565 \newdraw [\style,preaction={\bgstyle}]
6566 -- +(\zslope, \height/2)
6567 -- +(#1,\height/2)
6568 -- +($ (#1,0) + (\zslope, 0) $)
6569 -- +(#1,-\height/2)
6570 -- +(\zslope, -\height/2)
6571 -- +(0,0)
6572 ++(#1,0) coordinate (timing@ref)
6573 ++(\zslope, 0)
6574 \newdraw [\nstyle]
6575 }
6576
6577 \tikztimingdef{ZEE}{%
6578 \newdraw [\style,preaction={\bgstyle}]
6579 -- +(\zslope, \height/2)
6580 -- +($ (#1,0) + (\slope, \height/2) $) coordinate (timing@refb)
6581 -- +(#1,-\height/2) coordinate (timing@refa)
6582 -- +(\zslope, -\height/2)
6583 -- +(0,0)
6584 +(#1,0) coordinate (timing@ref)
6585 ++(#1,-\height/2)
6586 \code{\setcounter{tikztimingtranspos}{0}}%
6587 \code{\setcounter{tikztimingtrans}{1}}%
6588 }
6589
6590 \tikztimingdef{DEE}{%
6591 \tikztiming@oldnodecenter@
6592 \newdraw [\style,preaction={\bgstyle}]
6593 -- +(\dslope/2, \height/2)
6594 -- ($ (timing@ref) + (#1,0) + (\slope, \height/2) $) coordinate (timing@refb)
6595 -- ($ (timing@ref) + (#1,-\height/2) $) coordinate (timing@refa)
6596 -- ($ (timing@save) + (\dslope/2, -\height/2) $)
6597 -- (timing@save)
6598 coordinate (timing@ref) at ($ (timing@ref) + (#1,0) $)
6599 (timing@refa)
6600 \code{\setcounter{tikztimingtranspos}{0}}%
6601 \code{\setcounter{tikztimingtrans}{1}}%
6602 }
6603
6604
6605 \tikztimingdef{DED}{%
6606 \tikztiming@oldnodecenter@%
6607 \newdraw [\style,preaction={\bgstyle}]
6608 -- +(\dslope/2, \height/2)
6609 -- ($ (timing@ref) + (#1,\height/2) $)
6610 -- ($ (timing@ref) + (#1,0) + (\dslope/2,0) $)
6611 -- ($ (timing@ref) + (#1,-\height/2) $)
6612 -- ($ (timing@save) + (\dslope/2, -\height/2) $)
6613 -- (timing@save)
6614 ($ (timing@ref) + (#1,0) $)
6615 coordinate (timing@ref)
6616 ++(\dslope/2,0)
6617 \newdraw [\nstyle]
6618 }
6619
6620 \tikztimingdef{ZED}{%
6621 \newdraw [\style,preaction={\bgstyle}]
6622 -- +(\zslope, \height/2)
6623 -- +(#1,\height/2)
6624 -- +($ (#1,0) + (\dslope/2, 0) $)
6625 -- +(#1,-\height/2)
6626 -- +(\zslope, -\height/2)
6627 -- +(0,0)
6628 ++(#1,0) coordinate (timing@ref)
6629 ++(\dslope/2, 0)
6630 \newdraw [\nstyle]
6631 }
6632
6633 \tikztimingdef{DEZ}{%
6634 \tikztiming@oldnodecenter@
6635 \newdraw [\style,preaction={\bgstyle}]
6636 -- +(\dslope/2, \height/2)
6637 -- ($ (timing@ref) + (#1,\height/2) $)
6638 -- ($ (timing@ref) + (#1,0) + (\zslope, 0) $)
6639 -- ($ (timing@ref) + (#1,-\height/2) $)
6640 -- ($ (timing@save) + (\dslope/2, -\height/2) $)
6641 -- (timing@save)
6642 ($ (timing@ref) + (#1,0) $)
6643 coordinate (timing@ref)
6644 ++(\zslope, 0)
6645 \newdraw [\nstyle]
6646 }
6647
6648
6649 \tikztimingdef{DEH}{%
6650 \tikztiming@oldnodecenter@%
6651 \newdraw [\style,preaction={\bgstyle}]
6652 -- +(\dslope/2, \height/2)
6653 -- ($ (timing@ref) + (#1,0) + (\slope, \height/2) $)
6654 -- ($ (timing@ref) + (#1,-\height/2) $)
6655 -- ($ (timing@save) + (\dslope/2, -\height/2) $)
6656 -- (timing@save)
6657 ($ (timing@ref) + (#1,0) $) coordinate (timing@ref)
6658 ++(\slope, \height/2)
6659 \newdraw [\nstyle]
6660 }
6661
6662 \tikztimingdef{DEL}{%
6663 \tikztiming@oldnodecenter@%
6664 \newdraw [\style,preaction={\bgstyle}]
6665 -- +(\dslope/2, \height/2)
6666 -- ($ (timing@ref) + (#1,\height/2) $)
6667 -- ($ (timing@ref) + (#1,0) + (\slope, -\height/2) $)
6668 -- ($ (timing@save) + (\dslope/2, -\height/2) $)
6669 -- (timing@save)
6670 ($ (timing@ref) + (#1,0) $) coordinate (timing@ref)
6671 ++(\slope, -\height/2)
6672 \newdraw [\nstyle]
6673 }
6674
6675
6676 \tikztimingdef{@E}{%
6677 \code{\setcounter{tikztimingtranspos}{0}}%
6678 \code{\setcounter{tikztimingtrans}{1}}%
6679 \tikztiminguse{@D}{#1}
6680 }
6681
6682 \tikztimingdef{@DE}{%
6683 \tikztiming@@chard{#1}%
6684 }
6685 \tikztimingdef{DDE}{
6686 ++(0,-\height/2)
6687 \tikztiming@oldnodecenter{%
6688 (0,+\height/2)
6689 }%
6690 \tikztiming@@chard{#1}%
6691 }
6692
6693 \tikztimingdef{@EH}{%
6694 \tikztiming@setref{timing/start}{0,\height/2}
6695 \newdraw [\bgstyle]
6696 -- +(0,\height)
6697 -- +($ (#1,\height) + (\slope,0) $)
6698 -- +(#1,0)
6699 -- +(0,0)
6700 \newdraw [\style]
6701 +(0,\height)
6702 -- +($ (#1,\height) + (\slope,0) $)
6703 -- +(#1,0)
6704 -- +(0,0)
6705 ++(#1,\height/2) coordinate (timing@ref)
6706 ++(\slope,\height/2)
6707 \newdraw [\nstyle]
6708 }
6709
6710 \tikztimingdef{@ET}{%
6711 \tikztiming@setref{timing/start}{0,\height/2}
6712 \newdraw [\bgstyle]
6713 -- +(0,\height)
6714 {[\nstyle]
6715 -- ($ (timing@ref) + (#1,\height/2) + (\slope,0) $)
6716 }
6717 -- ($ (timing@ref) + (#1,-\height/2) $)
6718 -- (timing@save)
6719 \newdraw [\style]
6720 +(0,\height)
6721 {[\nstyle]
6722 -- ($ (timing@ref) + (#1,\height/2) + (\slope,0) $)
6723 }
6724 -- ($ (timing@ref) + (#1,-\height/2) $)
6725 -- (timing@save)
6726 {[\nstyle]
6727 ($ (timing@ref) + (#1,0) $) coordinate (timing@ref)
6728 ++(\slope,\height/2)
6729 }
6730 \newdraw [\nstyle]
6731 \code{\setcounter{tikztimingtrans}{-\value{tikztimingtrans}}}
6732 }
6733
6734 \tikztimingdef{ET}{%
6735 {[\style]
6736 -- ($ (timing@ref) + (#1,\height/2 * \value{tikztimingtrans}) $)
6737 }
6738 }
6739
6740 \tikztimingdef{@EL}{%
6741 \tikztiming@setref{timing/start}{0,\height/2}
6742 \newdraw [\bgstyle]
6743 -- +(0,\height)
6744 -- +(#1,\height)
6745 -- +($ (#1,0) + (\slope,0) $)
6746 -- +(0,0)
6747 \newdraw [\style]
6748 +(0,\height)
6749 -- +(#1,\height)
6750 -- +($ (#1,0) + (\slope,0) $)
6751 -- +(0,0)
6752 ++(#1,\height/2) coordinate (timing@ref)
6753 ++(\slope,-\height/2)
6754 \newdraw [\nstyle]
6755 }
6756
6757 \tikztimingdef{@ED}{%
6758 \tikztiming@setref{timing/start}{0,\height/2}
6759 \newdraw [\bgstyle]
6760 -- +(0,\height)
6761 -- +(#1,\height)
6762 -- +($ (#1,\height/2) + (\dslope/2,0) $)
6763 -- +(#1,0)
6764 -- +(0,0)
6765 \newdraw [\style]
6766 +(0,\height)
6767 -- +(#1,\height)
6768 -- +($ (#1,\height/2) + (\dslope/2,0) $)
6769 -- +(#1,0)
6770 -- +(0,0)
6771 ++(#1,\height/2) coordinate (timing@ref)
6772 ++(\dslope/2,0)
6773 }
6774
6775 \tikztimingdef{@EZ}{%
6776 \tikztiming@setref{timing/start}{0,\height/2}
6777 \newdraw [\bgstyle]
6778 -- +(0,\height)
6779 -- +(#1,\height)
6780 -- +($ (#1,\height/2) + (\zslope,0) $)
6781 -- +(#1,0)
6782 -- +(0,0)
6783 \newdraw [\style]
6784 +(0,\height)
6785 -- +(#1,\height)
6786 -- +($ (#1,\height/2) + (\zslope,0) $)
6787 -- +(#1,0)
6788 -- +(0,0)
6789 ++(#1,\height/2) coordinate (timing@ref)
6790 ++(\zslope,0)
6791 }
6792
6793
6794 \tikztimingdef{@EE}{%
6795 \tikztiming@setref{timing/start}{0,\height/2}
6796 \newdraw [\bgstyle]
6797 -- +(0,\height)
6798 -- +($ (#1,\height) + (\slope,0) $)
6799 -- +(#1,0)
6800 -- +(0,0)
6801 \newdraw [\style]
6802 +(0,\height)
6803 -- +($ (#1,\height) + (\slope,0) $) coordinate (timing@refb)
6804 -- +(#1,0) coordinate (timing@refa)
6805 -- +(0,0)
6806 ++(#1,0)
6807 \tikztiming@setref{timing@ref}{0,\height/2}
6808 \code{\setcounter{tikztimingtranspos}{0}}%
6809 \code{\setcounter{tikztimingtrans}{1}}%
6810 }
6811
6812 \def\tikztiming@nocombine@E{}%%
6813 % \end{macrocode}
6814 %
6815 % \iffalse
6816 %</tikz-timing-either.sty>
6817 % \fi
6818 %
6819 % \subsubsection{Clock Arrows}
6820 % \iffalse
6821 %<*tikz-timing-clockarrows.sty>
6822 % \fi
6823 % \begin{macrocode}
6824 %<!COPYRIGHT>
6825 \NeedsTeXFormat{LaTeX2e}[1999/12/01]
6826 \ProvidesPackage{tikz-timing-clockarrows}[%
6827 %<!DATE>
6828 %<!VERSION>
6829 %<*DRIVER>
6830 2099/01/01 develop
6831 %</DRIVER>
6832 tikz-timing library for timing clock arrows]
6833 % \end{macrocode}
6834 %
6835 % \begin{macrocode}
6836 \tikztiming@iftrans{CC}%
6837 {\let\tikztiming@trans@C@normal@C\tikztiming@trans@CC}%
6838 {\PackageError{\@currname}{No 'CC' transition defined by the main tikz-timing
6839 package.}{}}%
6840 \tikztiming@iftrans{HC}%
6841 {\let\tikztiming@trans@H@normal@C\tikztiming@trans@HC}%
6842 {\PackageError{\@currname}{No 'HC' transition defined by the main tikz-timing
6843 package.}{}}%
6844 \tikztiming@iftrans{LC}%
6845 {\let\tikztiming@trans@L@normal@C\tikztiming@trans@LC}%
6846 {\PackageError{\@currname}{No 'LC' transition defined by the main tikz-timing
6847 package.}{}}%
6848
6849 \tikztimingdef{CC}{%
6850 \code{\setcounter{tikztimingtrans}{-\value{tikztimingtrans}}}
6851 [timing/c/save]
6852 \newdraw [\style,timing/c/restore,>=\noexpand\tikztiming@c@arrow@tip,timing/c/arrow@style]
6853 -- ++(\slope*\noexpand\tikztiming@c@arrow@pos,\value{tikztimingtrans}*\height*\noexpand\tikztiming@c@arrow@pos)
6854 ; \draw [timing/restore,timing/c/restore] (timing@save) ++(0,0) [\style]
6855 -- ++(\slope,\value{tikztimingtrans}*\height)
6856 -- ++($ (#1,0) - (\slope,0) $)
6857 }
6858 \let\tikztiming@trans@C@arrow@C\tikztiming@trans@CC
6859
6860 \tikztimingdef{HC}{%
6861 \code{\setcounter{tikztimingtrans}{-1}}
6862 [timing/c/save]
6863 \newdraw [\style,timing/c/restore,>=\noexpand\tikztiming@c@arrow@tip,timing/c/arrow@style]
6864 -- ++(\slope*\noexpand\tikztiming@c@arrow@pos,\value{tikztimingtrans}*\height*\noexpand\tikztiming@c@arrow@pos)
6865 ; \draw [timing/restore,timing/c/restore] (timing@save) ++(0,0) [\style]
6866 -- ++(\slope,\value{tikztimingtrans}*\height)
6867 -- ++($ (#1,0) - (\slope,0) $)
6868 }
6869 \let\tikztiming@trans@H@arrow@C\tikztiming@trans@HC
6870
6871 \tikztimingdef{LC}{%
6872 \code{\setcounter{tikztimingtrans}{+1}}
6873 [timing/c/save]
6874 \newdraw [\style,timing/c/restore,>=\noexpand\tikztiming@c@arrow@tip,timing/c/arrow@style]
6875 -- ++(\slope*\noexpand\tikztiming@c@arrow@pos,\value{tikztimingtrans}*\height*\noexpand\tikztiming@c@arrow@pos)
6876 ; \draw [timing/restore,timing/c/restore] (timing@save) ++(0,0) [\style]
6877 -- ++(\slope,\value{tikztimingtrans}*\height)
6878 -- ++($ (#1,0) - (\slope,0) $)
6879 }
6880 \let\tikztiming@trans@L@arrow@C\tikztiming@trans@LC
6881
6882
6883 \tikzset{timing/c/.cd,
6884 rising arrows/.code={%
6885 \let\tikztiming@trans@CC\tikztiming@trans@C@arrow@C%
6886 \let\tikztiming@trans@LC\tikztiming@trans@L@arrow@C%
6887 \let\tikztiming@trans@HC\tikztiming@trans@H@arrow@C%
6888 \def\tikztiming@clockarrow@style{\ifnum1=\c@tikztimingtrans\tikzset{->,timing/c/arrow}\fi}%
6889 },%
6890 falling arrows/.code={%
6891 \let\tikztiming@trans@CC\tikztiming@trans@C@arrow@C%
6892 \let\tikztiming@trans@LC\tikztiming@trans@L@arrow@C%
6893 \let\tikztiming@trans@HC\tikztiming@trans@H@arrow@C%
6894 \def\tikztiming@clockarrow@style{\ifnum-1=\c@tikztimingtrans\tikzset{->,timing/c/arrow}\fi}%
6895 },%
6896 dual arrows/.code={%
6897 \let\tikztiming@trans@CC\tikztiming@trans@C@arrow@C%
6898 \let\tikztiming@trans@LC\tikztiming@trans@L@arrow@C%
6899 \let\tikztiming@trans@HC\tikztiming@trans@H@arrow@C%
6900 \def\tikztiming@clockarrow@style{\tikzset{->,timing/c/arrow}}%
6901 },%
6902 no arrows/.code={%
6903 \let\tikztiming@trans@CC\tikztiming@trans@C@normal@C%
6904 \let\tikztiming@trans@LC\tikztiming@trans@L@normal@C%
6905 \let\tikztiming@trans@HC\tikztiming@trans@H@normal@C%
6906 \def\tikztiming@clockarrow@style{}%
6907 },%
6908 arrow@style/.code={\tikztiming@clockarrow@style},%
6909 arrow/.style={},%
6910 arrow pos/.store in=\tikztiming@c@arrow@pos,
6911 arrow tip/.store in=\tikztiming@c@arrow@tip,
6912 save/.code={%
6913 \global\let\tikztiming@clockarrow@savedstyle\tikztiming@clockarrow@style
6914 \global\let\tikztiming@trans@saved@CC\tikztiming@trans@CC
6915 \global\let\tikztiming@c@arrow@savedpos\tikztiming@c@arrow@pos
6916 \global\let\tikztiming@c@arrow@savedtip\tikztiming@c@arrow@tip
6917 },
6918 restore/.code={%
6919 \let\tikztiming@clockarrow@style\tikztiming@clockarrow@savedstyle
6920 \let\tikztiming@trans@CC\tikztiming@trans@saved@CC
6921 \let\tikztiming@c@arrow@pos\tikztiming@c@arrow@savedpos
6922 \let\tikztiming@c@arrow@tip\tikztiming@c@arrow@savedtip
6923 },
6924 }
6925 \tikzset{timing/c/.cd,
6926 no arrows,
6927 arrow pos=0.95,
6928 arrow tip=to,
6929 }
6930
6931 % \end{macrocode}
6932 % Use the \pkg{pgfopts} to handle the package options.
6933 % \begin{macrocode}
6934 \RequirePackage{pgfopts}
6935 \ProcessPgfOptions{/tikz/timing/c}
6936 % \end{macrocode}
6937 % \iffalse
6938 %</tikz-timing-clockarrows.sty>
6939 % \fi
6940 %
6941 % \subsubsection{Arrows}
6942 % \iffalse
6943 %<*tikz-timing-arrows.sty>
6944 % \fi
6945 % \begin{macrocode}
6946 %<!COPYRIGHT>
6947 \NeedsTeXFormat{LaTeX2e}[1999/12/01]
6948 \ProvidesPackage{tikz-timing-arrows}[%
6949 %<!DATE>
6950 %<!VERSION>
6951 %<*DRIVER>
6952 2099/01/01 develop
6953 %</DRIVER>
6954 tikz-timing library for timing arrows]
6955 % \end{macrocode}
6956 %
6957 % This library is only defining the "A" and "W" basic transitions ("AA", "AW", "WA", "WW").
6958 % While "W" is simply a copy of "A" with a different style. Both simple draw a line from |low|
6959 % to |high| and than move the position to the right according to the |width| value and back to
6960 % the |low| position. The different arrow directions are done by different styles.
6961 % \begin{macrocode}
6962 \tikzset{timing/.cd,
6963 A/.style={timing/a},
6964 W/.style={timing/w},
6965 a/.style={->},
6966 w/.style={<-},
6967 }
6968
6969 \tikztimingchar{A}{++(0,0)}{%
6970 \newdraw [\style] -- ++(0,\height)
6971 \newdraw [timing/every char] ++(#1,-\height)
6972 }
6973 \def\tikztiming@nocombine@A{}%
6974
6975 \tikztimingecopy{W}{A}
6976 % \end{macrocode}
6977 %
6978 % \iffalse
6979 %</tikz-timing-arrows.sty>
6980 % \fi
6981 %
6982 % \subsubsection{Overlays}
6983 % \iffalse
6984 %<*tikz-timing-overlays.sty>
6985 % \fi
6986 % \begin{macrocode}
6987 %<!COPYRIGHT>
6988 \NeedsTeXFormat{LaTeX2e}[1999/12/01]
6989 \ProvidesPackage{tikz-timing-overlays}[%
6990 %<!DATE>
6991 %<!VERSION>
6992 %<*DRIVER>
6993 2099/01/01 develop
6994 %</DRIVER>
6995 tikz-timing library for timing overlays]
6996 % \end{macrocode}
6997 %
6998 % \begin{macro}{\tikztiming@defcode{O}}
6999 % The last character before the "O" is saved and restored. Also the drawing
7000 % state is saved and restored by the \cs{tikztiming@overlay@begin} and
7001 % \cs{tikztiming@overlay@end} macros. The parser end macro
7002 % \cs{tikztiming@parser@end} which is triggered at the end of the overlay string
7003 % is redefined to avoid problems. The double \TeX\ group is necessary because
7004 % the overlay string can close and reopen the inner \TeX\
7005 % group.
7006 % \begin{macrocode}
7007 \tikztiming@defcode{O}#1{%
7008 \ifx\relax#1\empty
7009 \def\tikztiming@next{\tikztiming@parser#1}%
7010 \else
7011 \let\tikztiming@overlay@lastchar\tikztiming@lastchar
7012 \let\tikztiming@overlay@width\tikztimingwidth
7013 \tikztiming@output@addcode{\tikztiming@overlay@begin}%
7014 \begingroup
7015 \def\tikztiming@parser@end{%
7016 \def\tikztiming@output@nextchar{@}%
7017 \tikztiming@output@flush
7018 }
7019 \begingroup
7020 \tikztiming@parser #1\relax
7021 \endgroup
7022 \endgroup
7023 \tikztiming@output@addcode{\tikztiming@overlay@end}%
7024 \global\let\tikztiming@lastchar\tikztiming@overlay@lastchar
7025 \global\let\tikztimingwidth\tikztiming@overlay@width
7026 \def\tikztiming@next{\expandafter\tikztiming@parser\@firstofone}%
7027 \fi
7028 \tikztiming@next
7029 }
7030 % \end{macrocode}
7031 % \end{macro}
7032 %
7033 % Set the later expanded macros to some sane initial value.
7034 % \begin{macrocode}
7035 \let\tikztiming@overlay@save\empty
7036 \let\pgf@sh@nt@tikztiming@overlay@node\empty
7037 % \end{macrocode}
7038 %
7039 % \begin{macro}{\tikztiming@overlay@begin}
7040 % The drawing transition state (for "T", etc.) is saved and restored.
7041 % In order to be able to include an "O" inside the argument of another one the
7042 % overlay save node coordinates (\cs{pfg@sh@nt@tikztiming@overlay@node}) is also
7043 % saved and restored. The \cs{tikztiming@overlay@save} macro also includes an
7044 % self-assignment to its old version, which implements a stack. The macros must
7045 % be global because the overlay string can reopen a new TikZ path.
7046 % \begin{macrocode}
7047 \def\tikztiming@overlay@begin{
7048 [/utils/exec={%
7049 \xdef\tikztiming@overlay@save{%
7050 \noexpand\global\noexpand\c@tikztimingtrans\the\c@tikztimingtrans\relax%
7051 \noexpand\global\noexpand\c@tikztimingtranspos\the\c@tikztimingtranspos\relax%
7052 \noexpand\gdef\noexpand\pgf@sh@nt@tikztiming@overlay@node
7053 {\csname pgf@sh@nt@tikztiming@overlay@node\endcsname}%
7054 \noexpand\gdef\noexpand\pgf@sh@nt@timing@refa
7055 {\csname pgf@sh@nt@timing@refa\endcsname}%
7056 \noexpand\gdef\noexpand\pgf@sh@nt@timing@refb
7057 {\csname pgf@sh@nt@timing@refb\endcsname}%
7058 \noexpand\gdef\noexpand\pgf@sh@nt@timing@ref
7059 {\csname pgf@sh@nt@timing@ref\endcsname}%
7060 \noexpand\gdef\noexpand\tikztiming@overlay@save{%
7061 \expandafter\unexpanded\expandafter{\tikztiming@overlay@save}%
7062 }%
7063 }%
7064 }]%
7065 node [timing/save] (tikztiming@overlay@node) {}
7066 }%
7067 % \end{macrocode}
7068 % \end{macro}
7069 %
7070 % \begin{macro}{\tikztiming@overlay@end}
7071 % Start new drawing path, restore position and saved drawing state.
7072 % \begin{macrocode}
7073 \def\tikztiming@overlay@end{%
7074 \tikztiming@newdraw (tikztiming@overlay@node)
7075 [/utils/exec={\tikztiming@overlay@save}]
7076 }%
7077 % \end{macrocode}
7078 % \end{macro}
7079 %
7080 %
7081 % \iffalse
7082 %</tikz-timing-overlays.sty>
7083 % \fi
7084 %
7085 % \subsubsection{Column Type}
7086 % \iffalse
7087 %<*tikz-timing-columntype.sty>
7088 % \fi
7089 % \begin{macrocode}
7090 %<!COPYRIGHT>
7091 \NeedsTeXFormat{LaTeX2e}[1999/12/01]
7092 \ProvidesPackage{tikz-timing-columntype}[%
7093 %<!DATE>
7094 %<!VERSION>
7095 %<*DRIVER>
7096 2099/01/01 develop
7097 %</DRIVER>
7098 tikz-timing library for timing cell types]
7099 % \end{macrocode}
7100 %
7101 % The \pkg{array} package is needed to define the column type.
7102 % \begin{macrocode}
7103 \RequirePackage{array}
7104
7105 \tikzset{timing/columntype/.code 2 args =
7106 \newcolumntype{#1}{>{\celltiming}#2<{\endcelltiming}}%
7107 }%
7108 % \end{macrocode}
7109 %
7110 % The options |type| (calls |timing/columntype|) and |notype| are defined.
7111 % \begin{macrocode}
7112 \RequirePackage{pgfopts}
7113 \tikzset{timing/columntype/.cd,
7114 type/.style 2 args={/tikz/timing/columntype={#1}{#2}},%
7115 notype/.code={},
7116 notype/.value forbidden={},
7117 }
7118
7119 \ProcessPgfOptions{/tikz/timing/columntype}
7120 % \end{macrocode}
7121 % Use default settings if no options where given. This works because all options
7122 % so far will change the default type.
7123 % \begin{macrocode}
7124 \expandafter\ifx\csname opt@\@currname.\@currext\endcsname\empty
7125 \tikzset{timing/columntype={T}{l}}%
7126 \fi
7127 % \end{macrocode}
7128 %
7129 % \begin{macro}{\celltiming}[1]{Some ignored tokens}
7130 % The macro first reads everything to the |\ignorespaces| placed by the
7131 % |tabular|. After placing the tokens except |\ignorespaces| back a
7132 % |tikzpicture| is started. The \cs{tikztiming@endhook} is defined to call
7133 % \cs{end@celltiming}.
7134 % After the usual init process the input is tested for an optional argument and
7135 % \cs{tikztiming@celltiming} is called accordantly.
7136 % \begin{macrocode}
7137 \def\celltiming#1\ignorespaces{%
7138 #1%
7139 \begin{tikzpicture}[timing/picture,baseline={(0,0)}]
7140 \def\tikztiming@endhook{\end@celltiming}
7141 \tikztiming@init
7142 \let\tikztiming@settings\empty
7143 \@ifnextchar{[}%
7144 {\tikztiming@celltiming}%
7145 {\tikztiming@celltiming[]}%
7146 }
7147 \let\endcelltiming\relax
7148 % \end{macrocode}
7149 % \end{macro}
7150 %
7151 % \begin{macro}{\tikztiming@celltiming}[1]{Optional Initial Character or
7152 % Settings}
7153 % First the optional argument is tested to see if it is a single initial
7154 % character or some settings. The \cs{tikztiming@testoptarg} macro sets the
7155 % \cs{lastchar} and \cs{settings} macros to the appropriate values.
7156 %
7157 % If the \cs{lastchar} is empty it is set to the normal start value.
7158 %
7159 % Then a \pkg{pgf} scope with the potential user settings is started. The macros
7160 % |\unskip| and |\\| which are used internally by the |tabular| environment are
7161 % |\let| to |\relax| to work as end marker for the \cs{tikztiming@parser}. This
7162 % will not influence the table because they will revert to their original
7163 % definition at the end of the |tikzpicture| environment.
7164 %
7165 % Finally the \cs{tikztiming@parser} is called.
7166 % \begin{macrocode}
7167 \def\tikztiming@celltiming[#1]{%
7168 \ifx\relax#1\relax\else
7169 \tikztiming@testoptarg#1\relax\relax
7170 \fi
7171 \ifx\tikztiming@lastchar\empty
7172 \def\tikztiming@lastchar{@}%
7173 \fi
7174 \expandafter\scope\expandafter[\tikztiming@settings]%
7175 \begingroup
7176 \let\unskip\relax
7177 \let\\\relax
7178 \tikztiming@parser
7179 }
7180 % \end{macrocode}
7181 % \end{macro}
7182 %
7183 % \begin{macro}{\end@celltiming}
7184 % This macro is called from the \cs{tikztiming@endhook} which is located in
7185 % \cs{tikztiming@parser@end} when the end marker (|\relax| or alias) is
7186 % encountered. It executes the accumulated \cs{tikztiming@str} and places the
7187 % timing shape. Finally the |scope| and |tikzpicture| is closed.
7188 % \begin{macrocode}
7189 \def\end@celltiming{%
7190 \tikzset{timing/before}%
7191 \tikztiming@str;
7192 \expandafter\node
7193 \expandafter[\tikztiming@settings,shape=tikztiming@shape,anchor=origin] at (0,0) {};
7194 \tikzset{timing/after}%
7195 \endscope
7196 \end{tikzpicture}%
7197 }
7198 % \end{macrocode}
7199 % \end{macro}
7200 %
7201 % \iffalse
7202 %</tikz-timing-columntype.sty>
7203 % \fi
7204 %
7205 % \subsubsection{Nice Timing Tables}
7206 % \iffalse
7207 %<*tikz-timing-nicetabs.sty>
7208 % \fi
7209 % \begin{macrocode}
7210 %<!COPYRIGHT>
7211 \NeedsTeXFormat{LaTeX2e}[1999/12/01]
7212 \ProvidesPackage{tikz-timing-nicetabs}[%
7213 %<!DATE>
7214 %<!VERSION>
7215 %<*DRIVER>
7216 2099/01/01 develop
7217 %</DRIVER>
7218 tikz-timing library for nice timing tables]
7219 % \end{macrocode}
7220 %
7221 % The dimensions of the following packages are used.
7222 % \begin{macrocode}
7223 \RequirePackage{array}
7224 \RequirePackage{booktabs}
7225 % \end{macrocode}
7226
7227 %
7228 % \begin{macro}{\tikztiming@nicetabs@tableheader}[1]{Optional Settings}
7229 % Calculate separator heights and set nodes appropriately, then call
7230 % the normal table header macro.
7231 % \begin{macrocode}
7232 \newcommand*\tikztiming@nicetabs@tableheader[1][]{%
7233 \path [timing/table/midrules] [/utils/exec=\xdef\@gtempa{\the\pgflinewidth}];
7234 \path [timing/table/header,#1]
7235 let \p1 = (0,\belowrulesep + \aboverulesep + \@gtempa
7236 + \arraystretch\ht\strutbox + \arraystretch*\extrarowheight
7237 + \arraystretch\dp\strutbox)
7238 in
7239 coordinate (diagram@header) at (0,\y1)
7240 coordinate (label@header) at ($ -1*(\tikztiming@coldist,0) + (0,\y1) $)
7241 ;
7242 \tikztiming@normal@tableheader[#1]%
7243 }
7244 % \end{macrocode}
7245 % \end{macro}
7246 %
7247 % \begin{macro}{\tikztiming@nicetabs@tablerules}[1]{Optional Settings}
7248 % \begin{macrocode}
7249 \newcommand*\tikztiming@nicetabs@tablerules[1][]{%
7250 \begin{scope}[#1]
7251 \coordinate (NW) at (current bounding box.north west);
7252 \coordinate (SE) at (current bounding box.south east);
7253 %
7254 \draw [timing/table/rules]
7255 let
7256 \p1 = (NW),
7257 \p2 = (SE),
7258 \p3 = (last label.base),
7259 \p4 = ($ (0,\y3) - (0,\arraystretch\dp\strutbox + \aboverulesep +
7260 .5\pgflinewidth) $)
7261 in
7262 (\x1-\tabcolsep,\y4) -- (\x2+\tabcolsep,\y4)
7263 \iftikztiming@tablehead
7264 let
7265 \p5 = ([email protected]),
7266 \p6 = ($ (0,\y5) + (0,\arraystretch\ht\strutbox + \arraystretch*\extrarowheight
7267 + \belowrulesep + .5\pgflinewidth) $)
7268 in
7269 (\x1-\tabcolsep,\y6) -- (\x2+\tabcolsep,\y6)
7270 \fi
7271 ;
7272 \draw
7273 \iftikztiming@tablehead [timing/table/midrules] \else [timing/table/rules] \fi
7274 let
7275 \p1 = (NW),
7276 \p2 = (SE),
7277 \p3 = (0, \arraystretch\ht\strutbox + \arraystretch*\extrarowheight +
7278 \belowrulesep + .5\pgflinewidth)
7279 in
7280 (\x1-\tabcolsep, \y3)
7281 --
7282 (\x2+\tabcolsep, \y3)
7283 ;
7284 \end{scope}
7285 }
7286 % \end{macrocode}
7287 % \end{macro}
7288 %
7289 % \begin{macrocode}
7290 \let\tikztiming@normal@tableheader\tikztiming@tableheader
7291 \let\tikztiming@normal@tablerules\tikztiming@tablerules
7292 \let\tikztiming@normal@coldist\tikztiming@coldist
7293 \let\tikztiming@normal@rowdist\tikztiming@rowdist
7294
7295 \tikzset{%
7296 timing/no nice tabs/.code={%
7297 \let\tikztiming@coldist\tikztiming@normal@coldist
7298 \let\tikztiming@rowdist\tikztiming@normal@rowdist
7299 \let\tikztiming@tableheader\tikztiming@normal@tableheader
7300 \let\tikztiming@tablerules\tikztiming@normal@tablerules
7301 },
7302 timing/nice tabs/.code={%
7303 \ifx\tikztiming@tableheader\tikztiming@nicetabs@tableheader\else
7304 \let\tikztiming@normal@coldist\tikztiming@coldist
7305 \let\tikztiming@normal@rowdist\tikztiming@rowdist
7306 \fi
7307 \def\tikztiming@rowdist{%
7308 \arraystretch\ht\strutbox
7309 +\arraystretch*\extrarowheight
7310 +\arraystretch\dp\strutbox
7311 }%
7312 \def\tikztiming@coldist{2\tabcolsep}%
7313 \let\tikztiming@tableheader\tikztiming@nicetabs@tableheader
7314 \let\tikztiming@tablerules\tikztiming@nicetabs@tablerules
7315 },
7316 timing/nicetabs/no nice tabs/.style={/tikz/timing/no nice tabs},
7317 timing/nicetabs/off/.style={/tikz/timing/no nice tabs},
7318 timing/nicetabs/nice tabs/.style={/tikz/timing/nice tabs},
7319 timing/nicetabs/on/.style={/tikz/timing/nice tabs},
7320 }
7321 %
7322 \tikzset{timing/nice tabs}%
7323 % \end{macrocode}
7324 %
7325 % Use the \pkg{pgfopts} to handle the package options.
7326 % \begin{macrocode}
7327 \RequirePackage{pgfopts}
7328 \ProcessPgfOptions{/tikz/timing/nicetabs}
7329 % \end{macrocode}
7330 % \iffalse
7331 %</tikz-timing-nicetabs.sty>
7332 % \fi
7333 %
7334 % \subsubsection{Counters}
7335 % \iffalse
7336 %<*tikz-timing-counters.sty>
7337 % \fi
7338 % \begin{macrocode}
7339 %<!COPYRIGHT>
7340 \NeedsTeXFormat{LaTeX2e}[1999/12/01]
7341 \ProvidesPackage{tikz-timing-counters}[%
7342 %<!DATE>
7343 %<!VERSION>
7344 %<*DRIVER>
7345 2099/01/01 develop
7346 %</DRIVER>
7347 tikz-timing library for counter values]
7348 % \end{macrocode}
7349 %
7350 %
7351 % \begin{macrocode}
7352 \newif\if@tikztiming@counter@wraps
7353
7354 \tikzset{%
7355 timing/new counter/.style={timing/counter/new={#1}},
7356 timing/counter/.cd,
7357 new/.code={\tikztiming@counter@new{#1}},
7358 new/.value required,
7359 opt/.cd,
7360 char/.initial=,
7361 char/.value required,
7362 reset char/.initial=,
7363 reset char/.value required,
7364 reset type/.is choice,
7365 reset type/width/.code={\def\tikztiming@resettype{0}},
7366 reset type/arg/.code={\def\tikztiming@resettype{1}},
7367 reset type/both/.code={\def\tikztiming@resettype{2}},
7368 reset type/Both/.code={\def\tikztiming@resettype{3}},
7369 half width char/.initial=,
7370 half width char/.value required,
7371 base/.initial=10,
7372 base/.value required,
7373 increment/.initial=1,
7374 increment/.value required,
7375 max value/.initial=,
7376 max value/.value required,
7377 min value/.initial=,
7378 min value/.value required,
7379 wraps/.is if=@tikztiming@counter@wraps,
7380 digits/.initial=,
7381 digits/.value required,
7382 fg style/.initial=,
7383 bg style/.initial=,
7384 text style/.initial=,
7385 text format/.initial=,
7386 fg style/.value required,
7387 bg style/.value required,
7388 text style/.value required,
7389 text format/.value required,
7390 }
7391 \def\tikztiming@counter@textformat{}%
7392 % \end{macrocode}
7393 %
7394 % \begin{macro}{\tikztimingcounter}[1]{Counter Character}
7395 % \begin{macrocode}
7396 \def\tikztimingcounter#1{%
7397 \csname tikztiming@counter@#1\endcsname
7398 }
7399 % \end{macrocode}
7400 % \end{macro}
7401 %
7402 % \begin{macro}{\tikztimingsetcounter}[2]{Counter Character}{pgfmath expression}
7403 % \begin{macrocode}
7404 \def\tikztimingsetcounter#1#2{%
7405 \begingroup
7406 \pgfmathtruncatemacro\@tempa{#2}%
7407 \expandafter\global\expandafter\let\csname tikztiming@counter@#1\endcsname\@tempa
7408 \endgroup
7409 }
7410 % \end{macrocode}
7411 % \end{macro}
7412 %
7413 % \begin{macro}{\tikztiming@counter@new}[1]{Styles}
7414 % Most parts of this macro is enclosed in a group to keep most changes locally.
7415 % \begin{macrocode}
7416 \def\tikztiming@counter@new#1{%
7417 \begingroup
7418 \def\tikztiming@resettype{0}%
7419 % \end{macrocode}
7420 % The argument is taken as pgf keys relative to the "/tikz/timing/counter/opt" path.
7421 % The counter character is mandatory and an error is raised if it is not defined.
7422 % \begin{macrocode}
7423 \pgfqkeys{/tikz/timing/counter/opt}{#1}%
7424 \tikzset{timing/counter/opt/char/.get=\counterchar}%
7425 \ifx\counterchar\empty
7426 \PackageError{tikz-timing-counters}{Counter character must be given using
7427 the 'char' key!}{}%
7428 \endgroup
7429 \else
7430 % \end{macrocode}
7431 % The counter boundary test code is now assembled in |\@tempb|.
7432 % If the "wraps" option was used the \cs{tikztiming@counter@wrap} macro is used with the
7433 % "min value" and "max value" as (expanded) arguments.
7434 % \begin{macrocode}
7435 \pgfkeys{/tikz/timing/counter/opt/min value/.get=\min}%
7436 \pgfkeys{/tikz/timing/counter/opt/max value/.get=\max}%
7437 \if@tikztiming@counter@wraps
7438 \ifx\min\empty
7439 \def\min{0}%
7440 \fi
7441 \ifx\max\empty
7442 \PackageError{tikz-timing-counters}{The option 'wraps' needs the option 'max value' to be set!}{}%
7443 \fi
7444 \def\@tempb{%
7445 \noexpand\tikztiming@counter@wrap%
7446 {\expandafter\unexpanded\expandafter{\min}}%
7447 {\expandafter\unexpanded\expandafter{\max}}%
7448 }%
7449 \else
7450 % \end{macrocode}
7451 % Otherwise either the \cs{tikztiming@counter@maxsat}, \cs{tikztiming@counter@minsat} or \cs{tikztiming@counter@minmaxsat}
7452 % macro is used if "max value", "min value" or both are set, respectively.
7453 % \begin{macrocode}
7454 \ifx\min\empty
7455 \ifx\max\empty
7456 \let\@tempb\empty
7457 \else
7458 \def\@tempb{%
7459 \noexpand\tikztiming@counter@maxsat%
7460 {\expandafter\unexpanded\expandafter{\max}}%
7461 }%
7462 \fi
7463 \else
7464 \ifx\max\empty
7465 \def\@tempb{%
7466 \noexpand\tikztiming@counter@minsat%
7467 {\expandafter\unexpanded\expandafter{\min}}%
7468 }%
7469 \else
7470 \def\@tempb{%
7471 \noexpand\tikztiming@counter@minmaxsat%
7472 {\expandafter\unexpanded\expandafter{\min}}%
7473 {\expandafter\unexpanded\expandafter{\max}}%
7474 }%
7475 \fi
7476 \fi
7477 \fi
7478 % \end{macrocode}
7479 % The counter styles are set up.
7480 % \begin{macrocode}
7481 \pgfkeys{/tikz/timing/counter/opt/fg style/.get=\fgstyle}%
7482 \pgfkeys{/tikz/timing/counter/opt/bg style/.get=\bgstyle}%
7483 \pgfkeys{/tikz/timing/counter/opt/text style/.get=\textstyle}%
7484 \pgfkeys{/tikz/timing/counter/opt/text format/.get=\textformat}%
7485 % \end{macrocode}
7486 % Finally the \cs{tikztiming@counter@new@} macro is called with most of the
7487 % settings as expanded arguments.
7488 % \begin{macrocode}
7489 \pgfkeys{/tikz/timing/counter/opt/increment/.get=\increment}%
7490 \edef\@tempa{%
7491 \noexpand\tikztiming@counter@new@
7492 {\pgfkeysvalueof{/tikz/timing/counter/opt/char}}%
7493 {\pgfkeysvalueof{/tikz/timing/counter/opt/base}}%
7494 {\pgfkeysvalueof{/tikz/timing/counter/opt/half width char}}%
7495 {\pgfkeysvalueof{/tikz/timing/counter/opt/reset char}}%
7496 {\pgfkeysvalueof{/tikz/timing/counter/opt/digits}}%
7497 {\expandafter\unexpanded\expandafter{\increment}}%
7498 {\@tempb}%
7499 {\min}%
7500 {\tikztiming@resettype}%
7501 {\expandafter\unexpanded\expandafter{\fgstyle}}%
7502 {\expandafter\unexpanded\expandafter{\bgstyle}}%
7503 {\expandafter\unexpanded\expandafter{\textstyle}}%
7504 {\expandafter\unexpanded\expandafter{\textformat}}%
7505 }%
7506 \expandafter\expandafter\expandafter\endgroup
7507 \expandafter\@tempa
7508 \fi
7509 }
7510 % \end{macrocode}
7511 % \end{macro}
7512 %
7513 % \begin{macro}{\tikztiming@counter@new@}[9]{Character}{Base}{Half Width
7514 % Character}{Reset Character}{Number of Digits}{Increment}{Boundary Code}{Min Value}{Reset Type}
7515 % \begin{macrocode}
7516 \def\tikztiming@counter@new@#1#2#3#4#5#6#7#8#9{%
7517 \ifx\empty#8\empty
7518 \@namedef{tikztiming@counter@#1}{0}%
7519 \else
7520 \expandafter
7521 \pgfmathtruncatemacro\csname tikztiming@counter@#1\endcsname{#8}%
7522 \fi
7523 \tikztimingmetachar{#1}[1]{ { [timing/counter/#1] ##1D{[timing/counter/#1/text]\tikztiming@counter@vs{#1}{#2}{#5}{#6}{#7}} } }%
7524 \ifx\empty#3\empty
7525 \tikztiming@iflower{#1}{}%
7526 {\lowercase{\tikztimingmetachar{#1}}[1]%
7527 { { [timing/counter/#1] ##1d{[timing/counter/#1/text]\tikztiming@counter@vs{#1}{#2}{#5}{#6}{#7}}} }%
7528 }%
7529 \else
7530 \tikztimingmetachar{#3}[1]{%
7531 { [timing/counter/#1] ##1d{[timing/counter/#1/text]\tikztiming@counter@vs{#1}{#2}{#5}{#6}{#7}} }%
7532 }%
7533 \fi
7534 \ifx\empty#4\empty\else
7535 \ifcase0#9\relax
7536 \tikztimingmetachar{#4}[1]{[|/utils/exec=\tikztiming@counter@reset{#1}{##1}|]}%
7537 \or
7538 \tikztimingmetachar{#4}[2]{[|/utils/exec=\tikztimingsetcounter{#1}{##2}|]}%
7539 \or
7540 \uppercase{\tikztimingmetachar{#4}}[1]{[|/utils/exec=\tikztiming@counter@reset{#1}{##1}|]}%
7541 \lowercase{\tikztimingmetachar{#4}}[2]{[|/utils/exec=\tikztimingsetcounter{#1}{##2}|]}%
7542 \or
7543 \lowercase{\tikztimingmetachar{#4}}[1]{[|/utils/exec=\tikztiming@counter@reset{#1}{##1}|]}%
7544 \uppercase{\tikztimingmetachar{#4}}[2]{[|/utils/exec=\tikztimingsetcounter{#1}{##2}|]}%
7545 \fi
7546 \fi
7547 \tikztiming@counter@new@@{#1}%
7548 }
7549 % \end{macrocode}
7550 % \end{macro}
7551 %
7552 % \begin{macro}{\tikztiming@counter@new@@}[5]{Character}{Foreground Style}{Background Style}{Text Style}
7553 % {Text format}
7554 % The counter styles are set up.
7555 % \begin{macrocode}
7556 \def\tikztiming@counter@new@@#1#2#3#4#5{%
7557 \tikzset{timing/counter/#1/.style={}}%
7558 \ifx\empty#2\empty\else
7559 \tikzset{timing/counter/#1/.append style={%
7560 /tikz/timing/d/.style={#2}%
7561 }}%
7562 \fi
7563 \ifx\empty#3\empty\else
7564 \tikzset{timing/counter/#1/.append style={%
7565 /tikz/timing/d/background/.style={#3}%
7566 }}%
7567 \fi
7568 \tikzset{timing/counter/#1/text/.style={#4}}%
7569 \ifx\empty#5\empty\else
7570 \tikzset{timing/counter/#1/.append style={%
7571 /utils/exec={\def\tikztiming@counter@textformat{#5}}%
7572 }}%
7573 \fi
7574 }
7575 % \end{macrocode}
7576 % \end{macro}
7577 %
7578 % \begin{macro}{\tikztiming@counter@reset}[2]{Character to Reset}{Reset value}
7579 % The counter is set first using pgf to round the value correctly and then again
7580 % with \cs{setcounter} to make it global.
7581 % \begin{macrocode}
7582 \def\tikztiming@counter@reset#1#2{%
7583 \begingroup
7584 \pgfmathtruncatemacro\@tempa{round((#2)/\tikztiming@wscale)}%
7585 \expandafter\global\expandafter\let\csname tikztiming@counter@#1\endcsname\@tempa
7586 \endgroup
7587 }
7588 % \end{macrocode}
7589 % \end{macro}
7590 %
7591 % \begin{macro}{\tikztiming@counter@vs}[5]{Character}{Base}{Number of Digits}{Increment}{Boundary Code}
7592 % Note: \cs{pgfmathdectoBase} is only used for a base different to 10 to allow
7593 % negative number for decimal base.
7594 % \begin{macrocode}
7595 \def\tikztiming@counter@vs#1#2#3#4#5{%
7596 \begingroup
7597 \ifx\empty#3\empty\else
7598 \pgfmathsetbasenumberlength{#3}%
7599 \fi
7600 \ifnum#2=10
7601 \expandafter\expandafter\expandafter\tikztiming@counter@textformat
7602 \expandafter\expandafter\expandafter{\csname tikztiming@counter@#1\endcsname}%
7603 \else
7604 \pgfmathdectoBase\pgfmathresult{\@nameuse{tikztiming@counter@#1}}{#2}%
7605 \expandafter\tikztiming@counter@textformat\expandafter{\pgfmathresult}%
7606 \fi
7607 \edef\N{\@nameuse{tikztiming@counter@#1}}%
7608 \pgfmathtruncatemacro\N{\N + #4}%
7609 #5%
7610 \expandafter\global\expandafter\let\csname tikztiming@counter@#1\endcsname\N
7611 \endgroup
7612 }
7613 % \end{macrocode}
7614 % \end{macro}
7615 %
7616 % The following macros checks the boundaries of the counter value. The value is stored in the
7617 % macro \cs{N}, the boundaries are provided as arguments. If necessary the value can be
7618 % adjusted by changing \cs{N}. All values are taken as \emph{integers}.
7619 %
7620 % \begin{macro}{\tikztiming@counter@minsat}[1]{Minimum Value}
7621 % \begin{macrocode}
7622 \def\tikztiming@counter@minsat#1{%
7623 \pgfmathtruncatemacro\MIN{#1}%
7624 \ifnum\N<\MIN \let\N\MIN \fi
7625 }
7626 % \end{macrocode}
7627 % \end{macro}
7628 %
7629 % \begin{macro}{\tikztiming@counter@maxsat}[1]{Maximum Value}
7630 % \begin{macrocode}
7631 \def\tikztiming@counter@maxsat#1{%
7632 \pgfmathtruncatemacro\MAX{#1}%
7633 \ifnum\N>\MAX \let\N\MAX \fi
7634 }
7635 % \end{macrocode}
7636 % \end{macro}
7637 %
7638 % \begin{macro}{\tikztiming@counter@minmaxsat}[2]{Minimum Value}{Maximum Value}
7639 % \begin{macrocode}
7640 \def\tikztiming@counter@minmaxsat#1#2{%
7641 \tikztiming@counter@minsat{#1}%
7642 \tikztiming@counter@maxsat{#2}%
7643 }
7644 % \end{macrocode}
7645 % \end{macro}
7646 %
7647 % \begin{macro}{\tikztiming@counter@wrap}[2]{Minimum Value}{Maximum Value}
7648 % \begin{macrocode}
7649 \def\tikztiming@counter@wrap#1#2{%
7650 \pgfmathtruncatemacro\MIN{#1}%
7651 \pgfmathtruncatemacro\MAX{#2}%
7652 \ifnum\N>\MAX
7653 \pgfmathtruncatemacro\N{\MIN + (\N-\MAX-1)}%
7654 \fi
7655 \ifnum\N<\MIN
7656 \pgfmathtruncatemacro\N{\MAX - (\MIN-\N+1)}%
7657 \fi
7658 }
7659 % \end{macrocode}
7660 % \end{macro}
7661 %
7662 % Use the \pkg{pgfopts} to handle the package options.
7663 % \begin{macrocode}
7664 \RequirePackage{pgfopts}
7665 \ProcessPgfOptions{/tikz/timing/counter}
7666 % \end{macrocode}
7667 % \iffalse
7668 %</tikz-timing-counters.sty>
7669 % \fi
7670 %
7671 % \subsubsection{Advanced Nodes}
7672 % \iffalse
7673 %<*tikz-timing-advnodes.sty>
7674 % \fi
7675 % \begin{macrocode}
7676 %<!COPYRIGHT>
7677 \NeedsTeXFormat{LaTeX2e}[1999/12/01]
7678 \ProvidesPackage{tikz-timing-advnodes}[%
7679 %<!DATE>
7680 %<!VERSION>
7681 %<*DRIVER>
7682 2099/01/01 develop
7683 %</DRIVER>
7684 tikz-timing library for advanced nodes]
7685 % \end{macrocode}
7686 %
7687 % \begin{macrocode}
7688
7689 \let\tikztiming@orig@oldnodecenter\tikztiming@oldnodecenter
7690
7691 \tikzset{timing/nodes/.cd,
7692 simple/.code={%
7693 \let\tikztiming@oldnodecenter\tikztiming@orig@oldnodecenter
7694 \tikzset{%
7695 timing/inline node/.style={shape=coordinate},
7696 }%
7697 },
7698 advanced/.code={%
7699 \let\tikztiming@oldnodecenter\@gobble
7700 \tikzset{%
7701 timing/inline node/.style={shape=tikztiming coordinate},
7702 timing/nodes/new center,
7703 }%
7704 },
7705 old center/.code={%
7706 \let\tikztiming@nodecenteranchor\tikztiming@old@nodecenteranchor
7707 },%
7708 new center/.code={%
7709 \let\tikztiming@nodecenteranchor\empty
7710 },%
7711 }
7712 \tikzset{timing/nodes/.cd,advanced,new center}
7713
7714 \def\anchoralias#1#2{%
7715 \expandafter\def
7716 \csname pgf@anchor@\pgf@sm@shape@name @#1\expandafter\endcsname
7717 \expandafter{\csname pgf@anchor@\pgf@sm@shape@name @#2\endcsname}%
7718 }
7719
7720 \def\tikztiming@anchorpoint#1#2#3{%
7721 \pgf@xa=#2\relax
7722 \pgf@ya=#3\relax
7723 \expandafter\edef\csname#1\endcsname{%
7724 \pgf@x=\the\pgf@xa\relax
7725 \pgf@y=\the\pgf@ya\relax
7726 }%
7727 \expandafter\addtosavedmacro\csname#1\endcsname
7728 }
7729 % \end{macrocode}
7730 %
7731 % \begin{macro}{\tikztiming@tryanchor@}[2]{From}{To}
7732 % \begin{macrocode}
7733 \def\tikztiming@tryanchor#1#2{%
7734 \let\tikztiming@next\relax
7735 \ifnum\tikztiming@debug>2
7736 \message{^^J Try Anchor: '#1' '#2' ^^J }%
7737 \def\tikztiming@next{\message{^^J TERM ^^J}}%
7738 \fi
7739 \ifx\relax#1\empty\else
7740 \ifx\relax#2\empty\else
7741 \def\tikztiming@next{%
7742 \@ifundefined{tikztiming@anchors@#1@#2}%
7743 {%
7744 \edef\@tempa{%
7745 {\csname tikztiming@alias@#1\endcsname}%
7746 {\csname tikztiming@alias@#2\endcsname}%
7747 }%
7748 \expandafter\tikztiming@tryanchor@\@tempa{#1}{#2}%
7749 }%
7750 {\let\tikztiming@tryanchor\@gobbletwo
7751 \ifnum\tikztiming@debug>2
7752 \message{^^J Anchor: '#1' '#2' ^^J }%
7753 \fi
7754 \@nameuse{tikztiming@anchors@#1@#2}%
7755 }%
7756 }%
7757 \fi\fi
7758 \tikztiming@next
7759 }
7760 % \end{macrocode}
7761 % \end{macro}
7762 %
7763 % \begin{macro}{\tikztiming@tryanchor@}[4]{Alias From}{Alias To}{From}{To}
7764 % \begin{macrocode}
7765 \def\tikztiming@tryanchor@#1#2#3#4{%
7766 \tikztiming@tryanchor{#3}{#2}%
7767 \tikztiming@tryanchor{#1}{#4}%
7768 \tikztiming@tryanchor{#1}{#2}%
7769 \let\tikztiming@tryanchor@\@gobblefour
7770 \tikztiming@tryanchor{#3}{}%
7771 \tikztiming@tryanchor{}{#4}%
7772 }
7773 % \end{macrocode}
7774 % \end{macro}
7775 %
7776 % \begin{macrocode}
7777 \pgfdeclareshape{tikztiming coordinate}{%
7778 \savedmacro\anchorpoints{%
7779 \let\anchorpoint\tikztiming@anchorpoint
7780 \let\slope\@tempdima
7781 \let\dslope\@tempdimb
7782 \let\zslope\@tempdimc
7783 \let\height\pgf@yb
7784 \let\fromchar\tikztiming@node@fromchar
7785 \let\tochar\tikztiming@node@tochar
7786 %
7787 \ifnum\tikztiming@debug>2
7788 \message{^^J Node: \fromchar \tochar ^^J}%
7789 \fi
7790 %
7791 \edef\@tempa{{timing/\tochar}}%
7792 \expandafter\lowercase\expandafter
7793 {\expandafter\tikzset\@tempa}%
7794 \pgfpointxy{\timingslope}{0}%
7795 \slope=\pgf@x\relax
7796 \pgfpointxy{\timingdslope}{0}%
7797 \dslope=\pgf@x\relax
7798 \pgfpointxy{\timingzslope}{0}%
7799 \zslope=\pgf@x\relax
7800 \pgfpointxy{0}{\timingheight}%
7801 \height=\pgf@y\relax
7802 \edef\anchorpoints{%
7803 \noexpand\pgf@yb=\the\height\relax
7804 \let\noexpand\height\noexpand\pgf@yb
7805 }%
7806 %
7807 \tikztiming@tryanchor{\fromchar}{\tochar}%
7808 }
7809 \savedanchor\lowpoint{%
7810 \pgfpointanchor{timing/start base}{center}%
7811 \pgf@x=0pt
7812 }%
7813 \anchor{origin}{%
7814 \pgfpointorigin
7815 \anchorpoints
7816 \@nameuse{originoffset}
7817 \pgf@x=-\pgf@x
7818 \pgf@y=-\pgf@y
7819 }%
7820 \anchor{old center}{%
7821 \pgfpointorigin
7822 \tikztiming@old@nodecenteranchor
7823 }%
7824 \anchor{new center}{\pgfpointorigin}%
7825 \anchor{center}{%
7826 \pgfpointorigin
7827 \tikztiming@nodecenteranchor
7828 }%
7829 \anchor{MID}{\tikztiming@useanchor{HIGH}\advance\pgf@y by -.5\height\relax }%
7830 \anchor{LOW}{\tikztiming@useanchor{HIGH}\advance\pgf@y by -\height\relax }%
7831 \anchor{HIGH}{\tikztiming@useanchor{HIGH}}%
7832 \anchor{TOP}{%
7833 \tikztiming@nodes@getoffset
7834 \tikztiming@useanchor{HIGH}
7835 \advance\pgf@y by \pgf@ya\relax
7836 }%
7837 \anchor{BOTTOM}{%
7838 \tikztiming@nodes@getoffset
7839 \tikztiming@useanchor{HIGH}
7840 \advance\pgf@y by -\pgf@ya\relax
7841 \advance\pgf@y by -\height\relax
7842 }%
7843 \anchor{mid}{\tikztiming@useanchor{mid}}%
7844 \anchor{low}{\tikztiming@useanchor{low}}%
7845 \anchor{high}{\tikztiming@useanchor{high}}%
7846 \anchor{low2}{\tikztiming@useanchor{low2}}%
7847 \anchor{high2}{\tikztiming@useanchor{high2}}%
7848 %
7849 \expandafter\anchorborder\expandafter{\csname pgf@anchor@\pgf@sm@shape@name @center\endcsname}%
7850 %
7851 \nodeparts{}%
7852 }
7853
7854 \def\tikztiming@nodes@getoffset{%
7855 \begingroup
7856 \pgfpointxy{0}{1}%
7857 \pgfmathsetresultunitscale{\pgf@y}%
7858 \pgfpoint{0}{\tikztiming@nodes@offset}%
7859 \global\pgf@ya=\pgf@y
7860 \endgroup
7861 }
7862
7863 \tikzset{%
7864 timing/nodes/.cd,
7865 offset/.store in=\tikztiming@nodes@offset,
7866 offset=0.25,
7867 }
7868
7869 \def\tikztiming@nodecenteranchor{}
7870
7871 \def\tikztiming@old@nodecenteranchor{%
7872 \anchorpoints
7873 \@ifundefined{oldcenter}%
7874 {\@nameuse{originoffset}%
7875 \pgf@x=-\pgf@x\relax
7876 \pgf@y=-\pgf@y\relax
7877 }%
7878 {\@nameuse{oldcenter}}%
7879 }
7880
7881 \def\tikztiming@useanchor#1{%
7882 \anchorpoints
7883 \@ifundefined{#1}%
7884 {\PackageError{tikz-timing}%
7885 {No such anchor '#1' defined for this transition!}{}%
7886 \pgfpointorigin
7887 }%
7888 {\@nameuse{#1}}%
7889 }
7890
7891 \tikzset{%
7892 every tikztiming coordinate node/.style={anchor=origin},
7893 }
7894 % \end{macrocode}
7895 % \begin{macrocode}
7896 \def\tikztiming@anchors#1#2{%
7897 \@namedef{tikztiming@anchors@#1@#2}%
7898 }
7899 \def\tikztiming@anchorslet#1#2#3#4{%
7900 \expandafter\let
7901 \csname tikztiming@anchors@#1@#2\expandafter\endcsname
7902 \csname tikztiming@anchors@#3@#4\endcsname
7903 }
7904
7905 \tikztiming@anchors{@}{D}{%
7906 \anchorpoint{originoffset}{0pt}{.5\height}%
7907 \anchorpoint{mid}{0pt}{0pt}%
7908 \anchorpoint{high}{0pt}{.5\height}%
7909 \anchorpoint{low}{0pt}{-.5\height}%
7910 \anchorpoint{HIGH}{0pt}{.5\height}%
7911 }
7912
7913 \tikztiming@anchors{@}{H}{%
7914 \anchorpoint{originoffset}{0pt}{\height}%
7915 \anchorpoint{high}{0pt}{0pt}%
7916 \anchorpoint{HIGH}{0pt}{0pt}%
7917 }
7918
7919 \tikztiming@anchors{@}{L}{%
7920 \anchorpoint{originoffset}{0pt}{0pt}%
7921 \anchorpoint{low}{0pt}{0pt}%
7922 \anchorpoint{HIGH}{0pt}{\height}%
7923 }
7924
7925 \tikztiming@anchors{@}{T}{%
7926 \anchorpoint{originoffset}{0pt}{0pt}%
7927 \anchorpoint{low}{0pt}{0pt}%
7928 \anchorpoint{HIGH}{0pt}{\height}%
7929 }
7930
7931 \tikztiming@anchors{@}{Z}{%
7932 \anchorpoint{originoffset}{0pt}{.5\height}%
7933 \anchorpoint{mid}{0pt}{0pt}%
7934 \anchorpoint{HIGH}{0pt}{.5\height}%
7935 }
7936
7937 \tikztiming@anchors{D}{D}{%
7938 \anchorpoint{originoffset}{0pt}{0pt}%
7939 \anchorpoint{mid}{0pt}{0pt}%
7940 \anchorpoint{HIGH}{0pt}{.5\height}%
7941 \anchorpoint{high}{0pt}{.5\height}%
7942 \anchorpoint{low}{0pt}{-.5\height}%
7943 }
7944
7945 \tikztiming@anchors{L}{H}{%
7946 \anchorpoint{originoffset}{.5\slope}{.5\height}%
7947 \anchorpoint{mid}{0pt}{0pt}%
7948 \anchorpoint{high}{.5\slope}{.5\height}%
7949 \anchorpoint{low}{-.5\slope}{-.5\height}%
7950 \anchorpoint{HIGH}{-.5\slope}{.5\height}%
7951 }
7952
7953 \tikztiming@anchors{E}{H}{%
7954 \anchorpoint{originoffset}{-.5\slope}{-.5\height}%
7955 \anchorpoint{oldcenter}{-.5\slope}{-.5\height}%
7956 \anchorpoint{mid}{0pt}{0pt}%
7957 \anchorpoint{high}{.5\slope}{.5\height}%
7958 \anchorpoint{low}{-.5\slope}{-.5\height}%
7959 \anchorpoint{HIGH}{-.5\slope}{.5\height}%
7960 }
7961
7962 \tikztiming@anchors{T}{T}{%
7963 \anchorpoint{mid}{0pt}{0pt}%
7964 \anchorpoint{HIGH}{-.5\slope}{.5\height}%
7965 \ifnum 1=\c@tikztimingtrans
7966 \anchorpoint{originoffset}{.5\slope}{-.5\height}%
7967 \anchorpoint{high}{-.5\slope}{.5\height}%
7968 \anchorpoint{low}{.5\slope}{-.5\height}%
7969 \else
7970 \anchorpoint{originoffset}{.5\slope}{.5\height}%
7971 \anchorpoint{high}{.5\slope}{.5\height}%
7972 \anchorpoint{low}{-.5\slope}{-.5\height}%
7973 \fi
7974 }
7975 \tikztiming@anchorslet{T}{E}{T}{T}%
7976
7977 \tikztiming@anchors{T}{@}{%
7978 \ifnum 1=\c@tikztimingtrans
7979 \anchorpoint{high}{0pt}{0pt}%
7980 \anchorpoint{HIGH}{0pt}{0pt}%
7981 \else
7982 \anchorpoint{low}{0pt}{0pt}%
7983 \anchorpoint{HIGH}{0pt}{\height}%
7984 \fi
7985 }
7986
7987 \tikztiming@anchors{H}{H}{%
7988 \anchorpoint{originoffset}{0pt}{0pt}%
7989 \anchorpoint{high}{0pt}{0pt}%
7990 \anchorpoint{HIGH}{0pt}{0pt}%
7991 }
7992
7993 \tikztiming@anchors{L}{L}{%
7994 \anchorpoint{originoffset}{0pt}{0pt}%
7995 \anchorpoint{low}{0pt}{0pt}%
7996 \anchorpoint{HIGH}{0pt}{\height}%
7997 }
7998
7999 \tikztiming@anchors{Z}{Z}{%
8000 \anchorpoint{originoffset}{0pt}{0pt}%
8001 \anchorpoint{mid}{0pt}{0pt}%
8002 \anchorpoint{HIGH}{0pt}{.5\height}%
8003 }
8004
8005 \tikztiming@anchors{E}{E}{%
8006 \anchorpoint{mid}{0pt}{0pt}%
8007 \ifnum 1=\c@tikztimingtrans
8008 \anchorpoint{originoffset}{.5\slope}{.5\height}%
8009 \anchorpoint{HIGH}{-.5\slope}{.5\height}%
8010 \anchorpoint{high}{.5\slope}{.5\height}%
8011 \anchorpoint{low}{-.5\slope}{-.5\height}%
8012 \else
8013 \anchorpoint{originoffset}{-.5\slope}{.5\height}%
8014 \anchorpoint{oldcenter}{-.5\slope}{-.5\height}%
8015 \anchorpoint{HIGH}{-.5\slope}{.5\height}%
8016 \anchorpoint{high}{-.5\slope}{.5\height}%
8017 \anchorpoint{low}{.5\slope}{-.5\height}%
8018 \fi
8019 }
8020
8021 \tikztiming@anchors{H}{L}{%
8022 \anchorpoint{originoffset}{.5\slope}{-.5\height}%
8023 \anchorpoint{mid}{0pt}{0pt}%
8024 \anchorpoint{high}{-.5\slope}{.5\height}%
8025 \anchorpoint{HIGH}{-.5\slope}{.5\height}%
8026 \anchorpoint{low}{.5\slope}{-.5\height}%
8027 }
8028 \tikztiming@anchorslet{H}{E}{H}{L}%
8029
8030 \tikztiming@anchors{E}{L}{%
8031 \anchorpoint{originoffset}{-.5\slope}{.5\height}%
8032 \anchorpoint{oldcenter}{-.5\slope}{-.5\height}%
8033 \anchorpoint{mid}{0pt}{0pt}%
8034 \anchorpoint{high}{-.5\slope}{.5\height}%
8035 \anchorpoint{HIGH}{-.5\slope}{.5\height}%
8036 \anchorpoint{low}{.5\slope}{-.5\height}%
8037 }
8038
8039 \tikztiming@anchors{E}{T}{%
8040 \anchorpoint{mid}{0pt}{0pt}%
8041 \anchorpoint{HIGH}{-.5\slope}{.5\height}%
8042 \ifnum 1=\c@tikztimingtrans
8043 \anchorpoint{originoffset}{-.5\slope}{-.5\height}%
8044 \anchorpoint{oldcenter}{-.5\slope}{-.5\height}%
8045 \anchorpoint{high}{.5\slope}{.5\height}%
8046 \anchorpoint{low}{-.5\slope}{-.5\height}%
8047 \else
8048 \anchorpoint{originoffset}{-.5\slope}{.5\height}%
8049 \anchorpoint{oldcenter}{-.5\slope}{-.5\height}%
8050 \anchorpoint{high}{-.5\slope}{.5\height}%
8051 \anchorpoint{low}{.5\slope}{-.5\height}%
8052 \fi
8053 }
8054
8055 \tikztiming@anchors{E}{Z}{%
8056 \anchorpoint{mid}{0pt}{0pt}%
8057 \anchorpoint{oldcenter}{-\zslope}{-.5\height}%
8058 \anchorpoint{HIGH}{-\zslope}{.5\height}%
8059 \anchorpoint{high}{-\zslope}{.5\height}%
8060 \anchorpoint{low}{-\zslope}{-.5\height}%
8061 }
8062
8063 \tikztiming@anchors{Z}{D}{%
8064 \anchorpoint{originoffset}{0pt}{0pt}%
8065 \anchorpoint{mid}{0pt}{0pt}%
8066 \anchorpoint{HIGH}{0pt}{.5\height}%
8067 \anchorpoint{high}{.5\dslope}{.5\height}%
8068 \anchorpoint{low}{.5\dslope}{-.5\height}%
8069 }
8070
8071 \tikztiming@anchors{D}{Z}{%
8072 \anchorpoint{originoffset}{0pt}{0pt}%
8073 \anchorpoint{oldcenter}{-.5\dslope}{-.5\height}%
8074 \anchorpoint{mid}{0pt}{0pt}%
8075 \anchorpoint{HIGH}{-.5\dslope}{.5\height}%
8076 \anchorpoint{high}{-.5\dslope}{.5\height}%
8077 \anchorpoint{low}{-.5\dslope}{-.5\height}%
8078 }
8079
8080 \tikztiming@anchors{D}{H}{%
8081 \anchorpoint{originoffset}{0pt}{0pt}%
8082 \anchorpoint{oldcenter}{-.5\dslope}{-.5\height}%
8083 \anchorpoint{mid}{0pt}{0pt}%
8084 \anchorpoint{HIGH}{-.5\dslope}{.5\height}%
8085 \anchorpoint{high}{.5\dslope}{.5\height}%
8086 \anchorpoint{high2}{-.5\dslope}{.5\height}%
8087 \anchorpoint{low}{-.5\dslope}{-.5\height}%
8088 }
8089
8090 \tikztiming@anchors{D}{L}{%
8091 \anchorpoint{originoffset}{0pt}{0pt}%
8092 \anchorpoint{oldcenter}{-.5\dslope}{-.5\height}%
8093 \anchorpoint{mid}{0pt}{0pt}%
8094 \anchorpoint{HIGH}{-.5\dslope}{.5\height}%
8095 \anchorpoint{high}{-.5\dslope}{.5\height}%
8096 \anchorpoint{low2}{-.5\dslope}{-.5\height}%
8097 \anchorpoint{low}{.5\dslope}{-.5\height}%
8098 }
8099 \tikztiming@anchorslet{D}{T}{D}{L}%
8100
8101 \tikztiming@anchors{D@edge@}{D}{%
8102 \anchorpoint{originoffset}{0pt}{0pt}%
8103 \anchorpoint{oldcenter}{-.5\dslope}{-.5\height}%
8104 \anchorpoint{mid}{0pt}{0pt}%
8105 \anchorpoint{HIGH}{-.5\dslope}{.5\height}%
8106 \anchorpoint{high}{-.5\dslope}{.5\height}%
8107 \anchorpoint{high2}{.5\dslope}{.5\height}%
8108 \anchorpoint{low}{-.5\dslope}{-.5\height}%
8109 \anchorpoint{low2}{.5\dslope}{-.5\height}%
8110 }
8111 \tikztiming@anchorslet{D}{U}{D@edge@}{D}
8112 \tikztiming@anchorslet{U}{D}{D@edge@}{D}
8113 \tikztiming@anchorslet{D}{D@edge@}{D@edge@}{D}
8114 \tikztiming@anchorslet{D@edge@}{D@edge@}{D@edge@}{D}
8115 \tikztiming@anchorslet{D}{E}{D@edge@}{D}
8116 \tikztiming@anchorslet{E}{D}{D@edge@}{D}
8117
8118 \tikztiming@anchorslet{L}{E}{L}{H}%
8119 \tikztiming@anchorslet{L}{T}{L}{H}%
8120 \tikztiming@anchorslet{H}{T}{H}{L}%
8121 \tikztiming@anchorslet{T}{H}{H}{L}%
8122
8123 \tikztiming@anchors{D}{D}{%
8124 \anchorpoint{originoffset}{0pt}{0pt}%
8125 \anchorpoint{oldcenter}{0pt}{-.5\height}%
8126 \anchorpoint{mid}{0pt}{0pt}%
8127 \anchorpoint{high}{0pt}{.5\height}%
8128 \anchorpoint{low}{0pt}{-.5\height}%
8129 \anchorpoint{HIGH}{0pt}{.5\height}%
8130 }
8131 \tikztiming@anchorslet{D}{@}{D}{D}
8132 \tikztiming@anchorslet{E}{@}{D}{D}
8133 \tikztiming@anchorslet{U}{U}{D}{D}
8134
8135 \tikztiming@anchorslet{@}{E}{@}{D}
8136
8137 \tikztiming@anchors{L}{D}{%
8138 \anchorpoint{originoffset}{.5\dslope}{.5\height}%
8139 \anchorpoint{mid}{0pt}{0pt}%
8140 \anchorpoint{high}{.5\dslope}{.5\height}%
8141 \anchorpoint{low}{-.5\dslope}{-.5\height}%
8142 \anchorpoint{low2}{.5\dslope}{-.5\height}%
8143 \anchorpoint{HIGH}{-.5\dslope}{.5\height}%
8144 }
8145
8146 \tikztiming@anchors{T}{D}{%
8147 \anchorpoint{mid}{0pt}{0pt}%
8148 \anchorpoint{HIGH}{-.5\dslope}{.5\height}%
8149 \ifnum 1=\c@tikztimingtrans
8150 \anchorpoint{originoffset}{.5\dslope}{-.5\height}%
8151 \anchorpoint{high}{-.5\dslope}{.5\height}%
8152 \anchorpoint{high2}{.5\dslope}{.5\height}%
8153 \anchorpoint{low}{.5\dslope}{-.5\height}%
8154 \else
8155 \anchorpoint{originoffset}{.5\dslope}{.5\height}%
8156 \anchorpoint{high}{.5\dslope}{.5\height}%
8157 \anchorpoint{low}{-.5\dslope}{-.5\height}%
8158 \anchorpoint{low2}{.5\dslope}{-.5\height}%
8159 \fi
8160 }
8161
8162 \tikztiming@anchors{H}{D}{%
8163 \anchorpoint{originoffset}{.5\dslope}{-.5\height}%
8164 \anchorpoint{mid}{0pt}{0pt}%
8165 \anchorpoint{HIGH}{-.5\dslope}{.5\height}%
8166 \anchorpoint{high}{-.5\dslope}{.5\height}%
8167 \anchorpoint{high2}{.5\dslope}{.5\height}%
8168 \anchorpoint{low}{.5\dslope}{-.5\height}%
8169 }
8170
8171 \tikztiming@anchors{Z}{E}{%
8172 \anchorpoint{mid}{0pt}{0pt}%
8173 \anchorpoint{high}{\zslope}{.5\height}%
8174 \anchorpoint{low}{\zslope}{-.5\height}%
8175 \anchorpoint{HIGH}{0pt}{.5\height}%
8176 }
8177
8178 \tikztiming@anchors{Z}{H}{%
8179 \anchorpoint{mid}{0pt}{0pt}%
8180 \anchorpoint{high}{\zslope}{.5\height}%
8181 \anchorpoint{HIGH}{0pt}{.5\height}%
8182 }
8183
8184 \tikztiming@anchors{Z}{T}{%
8185 \anchorpoint{mid}{0pt}{0pt}%
8186 \anchorpoint{HIGH}{0pt}{.5\height}%
8187 \ifnum1=\c@tikztimingtrans\relax
8188 \anchorpoint{low}{\zslope}{-.5\height}%
8189 \else
8190 \anchorpoint{high}{\zslope}{.5\height}%
8191 \fi
8192 }
8193
8194 \tikztiming@anchors{T}{H}{%
8195 \ifnum1=\c@tikztimingtrans\relax
8196 \anchorpoint{high}{0pt}{0pt}%
8197 \anchorpoint{HIGH}{0pt}{0pt}%
8198 \else
8199 \anchorpoint{originoffset}{.5\slope}{.5\height}%
8200 \anchorpoint{low}{-.5\slope}{-.5\height}%
8201 \anchorpoint{mid}{0pt}{0pt}%
8202 \anchorpoint{high}{.5\slope}{.5\height}%
8203 \anchorpoint{HIGH}{-.5\slope}{.5\height}%
8204 \fi
8205 }
8206
8207 \tikztiming@anchors{T}{L}{%
8208 \ifnum1=\c@tikztimingtrans\relax
8209 \anchorpoint{originoffset}{.5\slope}{-.5\height}%
8210 \anchorpoint{low}{.5\slope}{-.5\height}%
8211 \anchorpoint{mid}{0pt}{0pt}%
8212 \anchorpoint{high}{-.5\slope}{.5\height}%
8213 \anchorpoint{HIGH}{-.5\slope}{.5\height}%
8214 \else
8215 \anchorpoint{low}{0pt}{0pt}%
8216 \anchorpoint{HIGH}{0pt}{\height}%
8217 \fi
8218 }
8219
8220 \tikztiming@anchors{T}{Z}{%
8221 \ifnum1=\c@tikztimingtrans\relax
8222 \anchorpoint{high}{0pt}{0pt}%
8223 \anchorpoint{mid}{\zslope}{-.5\height}%
8224 \anchorpoint{HIGH}{0pt}{0pt}%
8225 \else
8226 \anchorpoint{low}{0pt}{0pt}%
8227 \anchorpoint{mid}{\zslope}{.5\height}%
8228 \anchorpoint{HIGH}{0pt}{\height}%
8229 \fi
8230 }
8231
8232 \tikztiming@anchors{Z}{L}{%
8233 \anchorpoint{mid}{0pt}{0pt}%
8234 \anchorpoint{low}{\zslope}{-.5\height}%
8235 \anchorpoint{HIGH}{0pt}{.5\height}%
8236 }
8237
8238 \tikztiming@anchors{H}{Z}{%
8239 \anchorpoint{high}{0pt}{0pt}%
8240 \anchorpoint{mid}{\zslope}{-.5\height}%
8241 \anchorpoint{HIGH}{0pt}{0pt}%
8242 }
8243
8244 \tikztiming@anchors{L}{Z}{%
8245 \anchorpoint{low}{0pt}{0pt}%
8246 \anchorpoint{mid}{\zslope}{.5\height}%
8247 \anchorpoint{HIGH}{0pt}{\height}%
8248 }
8249
8250 \tikztiming@anchors{Z}{Z}{%
8251 \anchorpoint{mid}{0pt}{0pt}%
8252 \anchorpoint{HIGH}{0pt}{.5\height}%
8253 }
8254
8255 \tikztiming@anchors{H}{@}{%
8256 \anchorpoint{high}{0pt}{0pt}%
8257 \anchorpoint{HIGH}{0pt}{0pt}%
8258 }
8259
8260 \tikztiming@anchors{L}{@}{%
8261 \anchorpoint{low}{0pt}{0pt}%
8262 \anchorpoint{HIGH}{0pt}{\height}%
8263 }
8264
8265 \tikztiming@anchors{Z}{@}{%
8266 \anchorpoint{mid}{0pt}{0pt}%
8267 \anchorpoint{HIGH}{0pt}{.5\height}%
8268 }
8269
8270 \tikztiming@anchors{}{@}{%
8271 \anchorpoint{originoffset}{0pt}{.5\height}%
8272 \anchorpoint{mid}{0pt}{0pt}%
8273 \anchorpoint{high}{0pt}{.5\height}%
8274 \anchorpoint{low}{0pt}{-.5\height}%
8275 \anchorpoint{HIGH}{0pt}{.5\height}%
8276 }
8277
8278 % \end{macrocode}
8279 %
8280 % Use the \pkg{pgfopts} to handle the package options.
8281 % \begin{macrocode}
8282 \RequirePackage{pgfopts}
8283 \ProcessPgfOptions{/tikz/timing/node}
8284 % \end{macrocode}
8285 % \iffalse
8286 %</tikz-timing-advnodes.sty>
8287 % \fi
8288 %
8289 % \subsubsection{Intervals}
8290 % \iffalse
8291 %<*tikz-timing-interval.sty>
8292 % \fi
8293 % \begin{macrocode}
8294 %<!COPYRIGHT>
8295 \NeedsTeXFormat{LaTeX2e}[1999/12/01]
8296 \ProvidesPackage{tikz-timing-interval}[%
8297 %<!DATE>
8298 %<!VERSION>
8299 %<*DRIVER>
8300 2099/01/01 develop
8301 %</DRIVER>
8302 tikz-timing library for alternative Z transitions]
8303 % \end{macrocode}
8304 %
8305 % \begin{macrocode}
8306 \let\tikztiming@linterval\relax
8307 \let\tikztiming@rinterval\relax
8308
8309 \tikztimingdef{LZ}{
8310 \tikztiming@rinterval
8311 {\newdraw [\style]}
8312 {-- ++(\zslope,+\height/2.)}
8313 -- ++($ (#1,0) - (\zslope,0) $)
8314 }
8315
8316 \tikztimingdef{HZ}{%
8317 \tikztiming@rinterval
8318 {\newdraw [\style]}
8319 {-- ++(\zslope,-\height/2.)}
8320 -- ++($ (#1,0) - (\zslope,0) $)
8321 }
8322
8323 \tikztimingdef{TZ}{%
8324 \code{\setcounter{tikztimingtrans}{-\value{tikztimingtrans}}}
8325 \tikztiming@rinterval
8326 {\newdraw [\style]}
8327 {-- ++(\zslope,\value{tikztimingtrans}*\height/2.)}
8328 -- ++($ (#1,0) - (\zslope,0) $)
8329 }
8330
8331 \tikztimingdef{ZL}{%
8332 \tikztiming@linterval
8333 {\newdraw}
8334 {-- ++(\zslope,-\height/2.)}
8335 -- ++($ (#1,0) - (\zslope,0) $)
8336 }
8337
8338 \tikztimingdef{ZH}{%
8339 \tikztiming@linterval
8340 {\newdraw}
8341 {-- ++(\zslope,\height/2.)}
8342 -- ++($ (#1,0) - (\zslope,0) $)
8343 }
8344
8345 \tikztimingdef{ZT}{%
8346 \code{\setcounter{tikztimingtrans}{-\value{tikztimingtrans}}}
8347 \tikztiming@linterval
8348 {\newdraw [\style]}
8349 {-- ++(\zslope,\value{tikztimingtrans}*\height/2.)}
8350 -- ++($ (#1,0) - (\zslope,0) $)
8351 }
8352
8353 \def\tikztiming@onetwo#1#2{#1#2}
8354 \def\tikztiming@twoone#1#2{#2#1}
8355
8356 \let\tikztiming@linterval\tikztiming@onetwo
8357 \let\tikztiming@rinterval\tikztiming@onetwo
8358
8359 \tikzset{timing/interval/.code={\pgfqkeys{/tikz/timing/interval}{#1}}}
8360 \tikzset{timing/interval/.cd,
8361 lo/.style={/tikz/timing/interval/left open},
8362 lc/.style={/tikz/timing/interval/left close},
8363 ro/.style={/tikz/timing/interval/right open},
8364 rc/.style={/tikz/timing/interval/right close},
8365 left close/.code={\let\tikztiming@linterval\tikztiming@onetwo},
8366 left open/.code={\let\tikztiming@linterval\tikztiming@twoone},
8367 right open/.code={\let\tikztiming@rinterval\tikztiming@onetwo},
8368 right close/.code={\let\tikztiming@rinterval\tikztiming@twoone},
8369 }
8370 \tikzset{
8371 timing/interval/normal/.style={/tikz/timing/interval/left close,/tikz/timing/interval/right open},
8372 timing/interval/verilog/.style={/tikz/timing/interval/normal},
8373 timing/interval/metachar/.style={/tikz/timing/metachar={#1}[2]{[timing/interval={##2}]}},
8374 }
8375
8376 % \end{macrocode}
8377 % \iffalse
8378 %</tikz-timing-interval.sty>
8379 % \fi
8380 %
8381 % \subsubsection{Beamer Overlay Support}
8382 % \iffalse
8383 %<*tikz-timing-beamer.sty>
8384 % \fi
8385 % \begin{macrocode}
8386 %<!COPYRIGHT>
8387 \NeedsTeXFormat{LaTeX2e}[1999/12/01]
8388 \ProvidesPackage{tikz-timing-beamer}[%
8389 %<!DATE>
8390 %<!VERSION>
8391 %<*DRIVER>
8392 2099/01/01 develop
8393 %</DRIVER>
8394 tikz-timing library for beamer overlay support]
8395 % \end{macrocode}
8396 %
8397 % Experimental library for marginal beamer overlay support. It will change in future versions. Use at own risk!
8398 % \begin{macrocode}
8399
8400 \PackageWarning{\@currname}{This library is experimental and will change in future versions!}{}{}
8401
8402 \tikztiming@defcode<#1>{
8403 \tikztiming@output@addcode{
8404 node [timing/save] (timing@save) {};%
8405 \onslide<#1>
8406 \draw [timing/restore] (timing@save) ++(0,0)
8407 }
8408 \tikztiming@parser
8409 }
8410 % \end{macrocode}
8411 % \iffalse
8412 %</tikz-timing-beamer.sty>
8413 % \fi
8414 %
8415 % \subsubsection{Compatibility with \protect\pkg{ifsym} Macros}
8416 % \iffalse
8417 %<*tikz-timing-ifsym.sty>
8418 % \fi
8419 % \begin{macrocode}
8420 %<!COPYRIGHT>
8421 \NeedsTeXFormat{LaTeX2e}[1999/12/01]
8422 \ProvidesPackage{tikz-timing-ifsym}[%
8423 %<!DATE>
8424 %<!VERSION>
8425 %<*DRIVER>
8426 2099/01/01 develop
8427 %</DRIVER>
8428 tikz-timing library for ifsym compatible macros]
8429 % \end{macrocode}
8430 %
8431 %
8432 % Set up styles to match behaviour of \pkg{ifsym}. Slope and size is is adjusted.
8433 % The macros only have 60\% of the height.
8434 % \begin{macrocode}
8435 \tikzset{%
8436 timing/ifsym/macro/.style={/tikz/timing/ifsym,/utils/exec={\pgfmathparse{.6*\f@size}\let\ysize\pgfmathresult},/tikz/y=\ysize},
8437 timing/ifsym/.style={%
8438 /tikz,timing/slope=0,x=\f@size,y=\f@size,line width=0.1ex,
8439 % \end{macrocode}
8440 % Define "|" to create a glitch. While it can be ignored in "H|L" or "L|H" it can
8441 % also be used like "L|L" and "H|H".
8442 % \begin{macrocode}
8443 timing/metachar={|}{G},
8444 % \end{macrocode}
8445 % The "X" is used for "M" and is set to black.
8446 % \begin{macrocode}
8447 timing/x/.style={},
8448 % \end{macrocode}
8449 % Define "M"/"m" to be equal to "X"/"x":
8450 % \begin{macrocode}
8451 timing/metachar={M}[1]{#1X},
8452 timing/metachar={m}[1]{#1x},
8453 % \end{macrocode}
8454 %
8455 % Code changes:
8456 % \begin{macrocode}
8457 /utils/exec={%
8458 % \end{macrocode}
8459 %
8460 % The |setdslope| macro is redefined to allow value higher than 1.
8461 % \begin{macrocode}
8462 \def\tikztimingsetdslope##1{%
8463 \pgfmathparse{max(0.0,##1)}%
8464 \let\tikztiming@dslope\pgfmathresult
8465 \edef\timingdslope{\tikztiming@dslope*\noexpand\timingwidth}%
8466 }
8467 % \end{macrocode}
8468 %
8469 % The "<" and ">" characters are defined as code characters. They
8470 % check if there appear twice which doubles their width.
8471 % A macro is used to remove the second appearance from the input.
8472 % \begin{macrocode}
8473 \tikztiming@defcode{<}{%
8474 \@ifnextchar{<}%
8475 {\tikztiming@ifsym@longslope{X}{D}}%
8476 {\tikztiming@parser [timing/dslope=1] 0Xd;}%
8477 }%
8478 \tikztiming@defcode{>}{%
8479 \@ifnextchar{>}%
8480 {\tikztiming@ifsym@longslope{D}{X}}%
8481 {\tikztiming@parser [timing/dslope=1] 0Dx;}%
8482 }%
8483 \def\tikztiming@ifsym@longslope##1##2##3{
8484 \tikztiming@parser [timing/dslope=2.] 0##1 ##2;%
8485 }%
8486 % \end{macrocode}
8487 % \begin{macrocode}
8488 }},
8489 }
8490 % \end{macrocode}
8491 %
8492 % Define library options.
8493 % \begin{macrocode}
8494 \tikzset{%
8495 timing/ifsym/.cd,
8496 provide/.code={\let\tikztiming@ifsym@def\providecommand},
8497 renew/.code={\let\tikztiming@ifsym@def\renewcommand},
8498 new/.code={\let\tikztiming@ifsym@def\newcommand},
8499 off/.code={\let\tikztiming@ifsym@def\@gobbletwo},
8500 }
8501 % \end{macrocode}
8502 %
8503 % Execute library options.
8504 % \begin{macrocode}
8505 \tikzset{timing/ifsym/provide}%
8506 \RequirePackage{pgfopts}
8507 \ProcessPgfOptions{/tikz/timing/ifsym}
8508 % \end{macrocode}
8509 %
8510 % Provide all timing symbol macros from |[electronic]{ifsym}|:
8511 % \begin{macrocode}
8512 \tikztiming@ifsym@def{\RaisingEdge}{\hbox{\texttiming[timing/ifsym/macro]{.4L .4H}}}
8513 \tikztiming@ifsym@def{\FallingEdge}{\hbox{\texttiming[timing/ifsym/macro]{.4H .4L}}}
8514 \tikztiming@ifsym@def{\ShortPulseHigh}{\hbox{\texttiming[timing/ifsym/macro]{.4L .2H .4L}}}
8515 \tikztiming@ifsym@def{\ShortPulseLow}{\hbox{\texttiming[timing/ifsym/macro]{.4H .2L .4H}}}
8516 \tikztiming@ifsym@def{\PulseHigh}{\hbox{\texttiming[timing/ifsym/macro]{.4L .6H .4L}}}
8517 \tikztiming@ifsym@def{\PulseLow}{\hbox{\texttiming[timing/ifsym/macro]{.4H .6L .4H}}}
8518 \tikztiming@ifsym@def{\LongPulseHigh}{\hbox{\texttiming[timing/ifsym/macro]{.4L H .4L}}}
8519 \tikztiming@ifsym@def{\LongPulseLow}{\hbox{\texttiming[timing/ifsym/macro]{.4H L .4H}}}
8520 % \end{macrocode}
8521 %
8522 % Provide \cs{textifsym} macro:
8523 % \begin{macro}{\textifsym}
8524 % \begin{macrocode}
8525 \tikztiming@ifsym@def{\textifsym}{\texttiming[timing/ifsym]}
8526 % \end{macrocode}
8527 % \end{macro}
8528 %
8529 % Clean-up:
8530 % \begin{macrocode}
8531 \let\tikztiming@ifsym@def\@undefined
8532 % \end{macrocode}
8533 % \iffalse
8534 %</tikz-timing-ifsym.sty>
8535 % \fi
8536 %
8537 %
8538 % \Finale
8539 % \endinput