I have justed started using TikZ and this block diagram was my first piece of art. Why art? Because it took me ages and I have had the feeling that drawing this kind of diagram could be simplified greatly if I had a deeper understanding of TikZ. Could you help me out to find a way to simplify this diagram or to find a suitable library?
Basically, it is a block diagram of a digital circuit, which describes the basic building blocks of that circuit. (If you are wondering what this circuit is used for, please refer to: https://github.com/Xilinx/XilinxVirtualCable, which is a project with a similiar goal).
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows,positioning, calc}
\begin{document}
\begin{figure}
\centering
\begin{tikzpicture}
\def\frow{2.5}
\def\rrow{2.7}
\def\srow{5}
\def\brow{6.5}
\def\trow{8}
\tiny
\tikzset{
bignode/.style={rectangle,draw=black, top color=white, inner sep=1em,minimum width=1.75cm, minimum height=4.0cm, text centered},
mynode/.style={rectangle,draw=black, top color=white, inner sep=1em,minimum width=1.5cm, minimum height=1cm, text centered},
ifnode/.style={rectangle,dashed,draw=black, top color=white, inner sep=1em,minimum width=1.5cm, minimum height=1cm, text centered, fill=yellow},
fifonode/.style={rectangle,draw=black, top color=white, inner sep=1pt,minimum width=0.9cm, minimum height=0.4cm, text centered},
regnode/.style={rectangle,draw=black, top color=white, inner sep=1pt,minimum width=1.2cm, minimum height=0.4cm, text centered},
sarrow/.style={->, >=latex'},
carrow/.style={<->, >=latex', dashed},
branch/.style={fill,circle,minimum size=2pt,inner sep=0pt},
acaption/.style={below, midway, text width=1cm, align=center}
}
%\draw[help lines] (0,0) grid (10,6);
\node (axi) at (0.5,4.25) {AXI Bus};
\node[bignode, label=above:AXI IF] (axiif) at (\frow,2.5) {};
\node[regnode] (datareg) at (\rrow,4.25) {Data};
\node[regnode] (statusreg) at (\rrow,3.8) {Status};
\node[regnode] (controlreg) at (\rrow,3.35) {Control};
\node[ifnode, label=above:IF IN] (ifin) at (\srow,1) {};
\node[fifonode] (tdofifo) at (\srow+0.25,1.25) {FIFO};
\node[mynode, label=above:IF TIMER] (iftimer) at (\srow,2.5) {};
\node[ifnode, label=above:IF OUT] (ifout) at (\srow,4) {};
\node[fifonode] (tmsfifo) at (\srow+0.25,4.25) {FIFO};
\node[fifonode] (tdififo) at (\srow+0.25,3.75) {FIFO};
\node[mynode, label=above:TMS Serializer] (tmsser) at (\trow,4.75) {};
\node[mynode, label=above:TDI Serializer] (tdiser) at (\trow,3.25) {};
\node[mynode, label=above:TDO Deserializer] (tdodeser) at (\trow,1) {};
\draw [sarrow] (tmsfifo.east) |- ++(right:0.5) |- node[above] {Data} ($ (tmsser.west)+(0,0.25) $);
\draw [sarrow] ($(tmsser.east)+(0,0.25)$) -- ++(right:1.25) node [right]{TMS};
\draw [sarrow] (tdififo.east) |- ++(right:0.5) |- node[below] {Data} ($ (tdiser.west)+(0,0.25) $);
\draw [sarrow] ($(tdiser.east)+(0,0.25)$) -- ++(right:1.25) node [right]{TDI};
\draw [sarrow, <-] (tdofifo.east) -| ++(right:0.5) |- node[below] {Data} ($ (tdodeser.west)+(0,0.25) $);
\draw [sarrow, <-] ($(tdodeser.east)+(0,0.25)$) -- ++(right:1.25) node [right]{TDO};
\draw [sarrow] ($(iftimer.east)+(0,-0.25)$) -- ++(right:4.25) node [right]{TCK};
\draw[sarrow] (iftimer.east) -- ++(right:0.5) node[above] {Timing} -- ++(right:0.5) node [branch](timer_branch){} -- ++(up:0.75) node [branch](timer_branch2){} -- (tdiser.west);
\draw[sarrow] (timer_branch) |- (tdodeser.west);
\draw[sarrow] (timer_branch2) |- (tmsser.west);
\draw[sarrow, <->] (datareg.east) -- ++(right:0.5) node [branch](datab){} -- ++(right:0.7) node [branch](datab2){} -- (tmsfifo.west);
\draw[sarrow] (datab2) |- (tdififo.west);
\draw[sarrow] (datab) |- (tdofifo.west);
\draw[sarrow] (axi) -- ++(right:1.25) node [branch] (axib) {} -- ++(down:0.45) node [branch] (axib2) {} -- (statusreg.west);
\draw[sarrow] (axib) -- (datareg.west);
\draw[sarrow] (axib2) |- (controlreg.west);
\draw[carrow] (iftimer.west) -- (axiif.east) node [acaption] {Control/ Status};
\draw[carrow] (ifin.west) -- ($(axiif.east)+(0,-1.5)$) node [acaption] {Control/ Status};
\draw[carrow] (ifout.west) -- ($(axiif.east)+(0,1.5)$) node [acaption] {Control/ Status};
\end{tikzpicture}
\medskip
\caption{AXI-JTAG Peripheral}
\end{figure}
\end{document}