0

I'm trying to recreate the timing diagrams for AHB-lite and APB, but I'm having some issues recreating the "Transient" and "HIGH/LOW to HIGH" timing characters.

enter image description here

Goal

ARM's version

Current Solution

My Version of the AHB-Lite read

Code

\documentclass{scrartcl}
\usepackage{tikz}
\usepackage{tikz-timing}
\usetikztiminglibrary{either}

\newcommand{\timingaxis}[1][]{%
  \begin{scope}[#1]
  \draw [timing/table/axis] (0,+1) -- (\twidth+1,+1);
  \foreach \n in {0,1,...,\twidth} {
    \draw [timing/table/axis ticks]
        (\n,+1) -- +(0,-.2)
        node [below,inner sep=2pt] {\scalebox{.75}{\tiny\n}};
  }
  \draw [timing/table/axis] (0,-\rowdist*\nrows+1.5*\rowdist) -- (\twidth+1,-\rowdist*\nrows+1.5*\rowdist);
  \foreach \n in {0,1,...,\twidth} {
    \draw [timing/table/axis ticks]
        (\n,-\rowdist*\nrows+1.5*\rowdist) -- +(0,-.2)
        node [below,inner sep=2pt] {\scalebox{.75}{\tiny\n}};
  }
  \end{scope}
}
\tikzset{%
    timing/table/axis/.style={->,>=latex},
    timing/table/axis ticks/.style={},
}

\begin{document}

% Defining foreground (fg) and background (bg) colors
\definecolor{bgblue}{rgb}{0.41961,0.80784,0.80784}%
\definecolor{bgred}{rgb}{1,0.61569,0.61569}%
\definecolor{fgblue}{rgb}{0,0,0.6}%
\definecolor{fgred}{rgb}{0.6,0,0}%

\begin{figure}
    \centering
    \begin{tikztimingtable}[
        timing/coldist=4pt,     % column distance
        xscale=2.05,yscale=1.1, % scale diagrams
        semithick               % set line width
      ]
      \\
      HCLK          & 4H 3{4C}  [[timing/slope=0]] H\\
      \\
      HADDR[31:0]   & 0.2D 0.4U {7.6D{A}} 0.4U {7.6D{B}} 0.4U 0.4D \\
      HWRITE        & 0.4H 0.4e 7.7L 0.2E0H 7.7E 0.4U 0.4D \\
      HDATA[31:0]   & 0.2D 0.4U 7.6D 5U {3D{Data (A)}} 0.4U 0.4D \\
      HREADY        & 0.4H [| timing/e/background/ ={ fill=gray } |]0.2e 7.8H 0.2e 8H 0.2E0H 0.4E \\
      \\
    \begin{extracode}
      \begin{pgfonlayer}{background}
        \begin{scope}[semitransparent,semithick, loosely dotted]
          \vertlines[red]{0,2,4,...,16}
          \vertlines[blue]{1,3,5,...,16}
        \end{scope}
      \end{pgfonlayer}
        \timingaxis\relax
      \tablerules
      % \begin{pgfonlayer}{background}
      %   \foreach \n in {1,...,8}
      %     \draw [help lines] (A\n) -- (B\n);
      % \end{pgfonlayer}
    \end{extracode}
    \end{tikztimingtable}
    \caption{AHB-Lite Read transfer}
    \label{fig:ahbl1}
\end{figure}

\end{document}
1
  • Welcome to TeX.SE!
    – Mensch
    Feb 25, 2023 at 22:31

1 Answer 1

1

I'm not very familiar with tikz but I'm trying to solve your problem. I think you are close to the goal. All you need is to read the manual, try different ideas, and think more, never give up! enter image description here Below is what I'm thinking:

  1. Looks like some polygons did not fill correctly, just make the timing/e/background/.style={fill=gray} to be global, and now all the polygons fill gray:timing/e/background/.style={fill=gray} set to global
  2. But the HWRITE row looks strange, after changing to HWRITE& 0.4H 0.4e 7.7L 0.2E 0H 7.7D 0.4U 0.4D look close to our goal.enter image description here Then read the tikz-timing manual 4.3 Overlays, we use the overlay to cover the strange path, change to HWRITE & 0.4H 0.4e 7.7L 0.2E 0H O{0D} 7.7D 0.4U 0.4D, look worse!enter image description here But don't worry, since tikz-timing is always under the control of tikz, add an offset to the overlays HWRITE & 0.4H 0.4e 7.7L 0.2E 0H O{[yshift=-3.9]0D} 7.7D{} 0.4U 0.4D:enter image description here
  3. The same way to solve the last row HREADY & 0.4H 0.2e 7.8H 0.2e 8H 0.2E 0L O{[yshift=3.9]0D} 0.4Denter image description here The final code should be:
\documentclass{scrartcl}
\usepackage{tikz}
\usepackage{tikz-timing}
\usetikztiminglibrary{either}

\newcommand{\timingaxis}[1][]{%
  \begin{scope}[#1]
  \draw [timing/table/axis] (0,+1) -- (\twidth+1,+1);
  \foreach \n in {0,1,...,\twidth} {
    \draw [timing/table/axis ticks]
        (\n,+1) -- +(0,-.2)
        node [below,inner sep=2pt] {\scalebox{.75}{\tiny\n}};
  }
  \draw [timing/table/axis] (0,-\rowdist*\nrows+1.5*\rowdist) -- (\twidth+1,-\rowdist*\nrows+1.5*\rowdist);
  \foreach \n in {0,1,...,\twidth} {
    \draw [timing/table/axis ticks]
        (\n,-\rowdist*\nrows+1.5*\rowdist) -- +(0,-.2)
        node [below,inner sep=2pt] {\scalebox{.75}{\tiny\n}};
  }
  \end{scope}
}
\tikzset{%
    timing/table/axis/.style={->,>=latex},
    timing/table/axis ticks/.style={},
}

\begin{document}

% Defining foreground (fg) and background (bg) colors
\definecolor{bgblue}{rgb}{0.41961,0.80784,0.80784}%
\definecolor{bgred}{rgb}{1,0.61569,0.61569}%
\definecolor{fgblue}{rgb}{0,0,0.6}%
\definecolor{fgred}{rgb}{0.6,0,0}%

\begin{figure}
    \centering
    \begin{tikztimingtable}[
        timing/coldist=4pt,     % column distance
        xscale=2.05,yscale=1.1, % scale diagrams
        semithick,               % set line width
        timing/e/background/.style={fill=gray},
      ]
      \\
      HCLK          & 4H 3{4C}  [[timing/slope=0]] H\\
      \\
      HADDR[31:0]   & 0.2D 0.4U {7.6D{A}} 0.4U {7.6D{B}} 0.4U 0.4D \\
      HWRITE        & 0.4H 0.4e 7.7L 0.2E 0H O{[yshift=-3.9]0D} 7.7D{} 0.4U 0.4D \\
      HDATA[31:0]   & 0.2D 0.4U 7.6D 5U {3D{Data (A)}} 0.4U 0.4D \\
      HREADY        & 0.4H 0.2e 7.8H 0.2e 8H 0.2E 0L O{[yshift=3.9]0D} 0.4D\\
      \\
    \begin{extracode}
      \begin{pgfonlayer}{background}
        \begin{scope}[semitransparent,semithick, loosely dotted]
          \vertlines[red]{0,2,4,...,16}
          \vertlines[blue]{1,3,5,...,16}
        \end{scope}
      \end{pgfonlayer}
        \timingaxis\relax
      \tablerules
      % \begin{pgfonlayer}{background}
      %   \foreach \n in {1,...,8}
      %     \draw [help lines] (A\n) -- (B\n);
      % \end{pgfonlayer}
    \end{extracode}
    \end{tikztimingtable}
    \caption{AHB-Lite Read transfer}
    \label{fig:ahbl1}
\end{figure}

\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .