Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I just asked this question: Does the program counter always have to change (upon an instruction tick)? - Stack Overflow, where I used the following code:

% min-timing.tex
% pdflatex min-timing.tex                               # to obtain min-timing.pdf
% convert -density 300x min-timing.pdf min-timing.png   # to obtain min-timing.png

% \documentclass[border=0]{standalone} % incorrectly crops image - use minimal + preview
\documentclass{minimal}

% minimal doesn't have \scriptsize, \tiny:
\makeatletter
\def\scriptsize{\@setfontsize{\scriptsize}{7}{8pt}}
\def\tiny{\@setfontsize{\tiny}{5}{6pt}}
\def\ttiny{\@setfontsize{\ttiny}{4}{5pt}}
\makeatother

\usepackage{tikz}
\usetikzlibrary{arrows,chains,matrix,positioning,scopes,snakes,decorations.markings}
\usepackage{tikz-timing}
\usetikztiminglibrary[rising arrows]{clockarrows}
\usetikztiminglibrary{advnodes}

\usepackage[graphics,tightpage,active]{preview}
\PreviewEnvironment{tikzpicture}
\newlength{\imagewidth}
\newlength{\imagescale}

\usepackage{helvet}

\begin{document}


\begin{tikztimingtable}[%
    timing/nodes/advanced,
    timing/dslope=0.1,
    timing/name/.style={font=\sffamily\scriptsize},
    timing/d/text/.style={font=\sffamily\ttiny},
  ]
  %
  % start timing diagram
  %
  \textcolor{black}{Instruction} & [black]
    Z 2D{push}    4D{mov}     4D{sub}     4D{movl}    4D{mov}     2D{leave}   2D{ret}     2D{...} \\ %
  \textcolor{black}{PC Address} & [black]
    Z 2D{8048394} 4D{8048395} 4D{8048397} 4D{804839a} 4D{80483a1} 2D{80483a4} 2D{80483a5} 2D{...} \\ %
  \textcolor{red}{Instruction tick} & [red]
    S G 2{S}      G 4{S}      G 4{S}      G 4{S}      G 4{S}      G 2{S}      G 2{S}      G 2{S}  \\ %
  \textcolor{brown}{Clock} & [brown]
    Z 2{C}        4{C}        4{C}        4{C}        4{C}        2{C}        2{C}        2{C}    \\ %
  %
  % end timing diagram
  %
  % there must NOT be an uncommented line before \extracode!
  %
\extracode
  \tablerules
  \tablegrid
\end{tikztimingtable}

\end{document}

... to obtain this image:

min-timing.png

I was wandering - (how) is it possible to have the G (glitch) symbols in "Instruction tick" be rendered as an "up arrow", like the rising clock edge?

share|improve this question
    
Calling @Martin Scharrer for great justice :) –  sdaau Oct 8 '11 at 9:40
1  
In the meantime, you might want to check where G is parsed and put a [->] (or [<-]). –  percusse Oct 8 '11 at 10:35
    
Cheers @percusse - missed that possibility - thanks! –  sdaau Oct 9 '11 at 11:59
add comment

2 Answers

up vote 4 down vote accepted

You need the arrows library and then can use A for an upwards arrow (A = Arrow) and W for an downwards arrow (W = arroW). After the arrow a length according to the timing letter width is inserted. This means 4A is equal to G 4S.

So what you need is:

  \textcolor{red}{Instruction tick} & [red]
    S 2A          4A          4A          4A          4A          2A          2A          2A      \\

after loading:

\usetikztiminglibrary{arrows}

This gives:

Result

Please see the manual for more information and examples on that library.


BTW: Note that you don't need to use 4{S} to get a space of 4. You can use 4S directly. The difference is that 4S makes a space with width 4 directly, while 4{S} is turned into SSSS internally by the repetition { } code and then combined to 4S by the internal optimizer, which is of course less efficient as writing 4S directly.

share|improve this answer
    
Awesome - that looks pretty good, many thanks @Martin Scharrer! Also thanks for the S note... Cheers! –  sdaau Oct 9 '11 at 12:00
add comment

I think you have two options: either replace all glitch signals with arrows (0A instead of G):

\textcolor{red}{Instruction tick} & [red]
S 0A 2{S}      0A 4{S}      0A 4{S}      0A 4{S}      0A 4{S}      0A 2{S}      0A 2{S}      0A 2{S}  \\ %

You will need to specify 0A to preserve spacing between the signals (simply A won't do, as it inserts extra space behind the symbol). Also, you will need to load the arrows timing library: \usetikztiminglibrary{arrows}

Or, if you want to make the code semantically correct, use overlays (I would suggest this one, although it is a tiny bit more verbose than than the previous one):

\textcolor{red}{Instruction tick} & [red]
S O{A}{G} 2{S}      O{A}{G} 4{S}      O{A}{G} 4{S}      O{A}{G} 4{S}      O{A}{G} 4{S}      O{A}{G} 2{S}      O{A}{G} 2{S}      O{A}{G} 2{S}  \\ %

Again, you will need the arrows library and additionally the overlays library: \usetikztiminglibrary{arrows, overlays}.

share|improve this answer
    
Yes, arrows is the way to got and was written by me just for such diagrams. However, you can do it better (see also my answer): the space which is part of A is intended to avoid the need of explicit Ss, so instead of 0A 2{S} (which should be written as 0A 2S anyway) you can write simply 2S. I don't get the "semantically correct" part and wouldn't use overlays of A and G. After all, the diagrams doesn't show logical glitches. –  Martin Scharrer Oct 8 '11 at 16:15
    
@Martin Scharrer: With "semantically correct" I just meant that the intention of the author was to visualize glitches and the 'markup' for them is G. In order to show that in the code, I thought an overlay could be used. Of course this is unnecessary, partly also because the typographic effect is the same. –  Count Zero Oct 8 '11 at 17:53
1  
I don't think so. He just used G as a marker, not as his intended function, which is to be placed in normal signals, e.g. LGL. Note that G doesn't interrupt the path because of this and therefore timing/g/.style={->} doesn't work. –  Martin Scharrer Oct 8 '11 at 17:56
    
Just to confirm - I indeed used G as a marker, not as a glitch; I simply missed realizing A is a more appropriate symbol at the time, and G was the closest one to a "vertical marker", that is why I used it ... Thanks for the comments - cheers! –  sdaau Oct 9 '11 at 12:03
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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