0

Could someone explain to me how I could draw, using tikz, the following picture ? enter image description here

I would appreciate it if someone could show me an example of the connection between the Memory and the EES block,because I am struggling with this for many hours, without any progress. Thanks for your time.

  • 2
    Welcome to TeX.SX! Please help us help you and add a minimal working example (MWE) that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – Henri Menke Dec 11 '16 at 13:33
  • 3
    There are many similar questions, see http://tex.stackexchange.com/questions/127663 for example. In addition you see on the right side (browser view) automatically related questions like http://tex.stackexchange.com/questions/237061 or http://tex.stackexchange.com/questions/209355. – Dr. Manuel Kuehner Dec 11 '16 at 15:02

1 Answers1

1

The drawing itself may be simples but some details are tricky (like the line connecting mem_out to val_in). I won't provide the whole drawing, instead I'll leave a skeleton of it with the concept of how this tricky details can be done.

Since there's the need to connect specific parts of the big blocks, they should be drawn as nodes. To get the nodes aligned you can use a \matrix. A \matrix itself is a node, so node options like draw and anchor (or the positioning left=<dim> of <node>) works. And once you give the Matrix a <name>, the nodes inside of it are named automatically with (<name>-<row num>-<col num>), which makes them easy to be called upon.

For the crossing lines, I was working on an automated solution for this and have asked a question: Decorate path precisely on intersection(s) with TikZ - avoiding crossing lines, there's a working solution there, but it's very limited, there's also links to other solutions.

An MWE

\documentclass[tikz]{standalone}
\usetikzlibrary{matrix, positioning, intersections, decorations.pathreplacing, calc}
\tikzset{
    over path/.style={
        decoration={show path construction, lineto code={
          \path[name path=this path] (\tikzinputsegmentfirst) -- (\tikzinputsegmentlast);
          \path[name intersections={of=this path and #1, total=\t}, /utils/exec={\global\let\t=\t}]%
                                    let \n1={int(\t+1)} in%
                                    (\tikzinputsegmentfirst) coordinate (int-0)%
                                    foreach \i in {1,...,\n1}{%
                                      \ifnum \i<\n1%
                                          (intersection-\i) coordinate (int-\i)%
                                      \else
                                          (\tikzinputsegmentlast) coordinate (int-\n1)%
                                      \fi};
          \draw (\tikzinputsegmentfirst) foreach[remember=\i as \last (initially 0)] \i in {1,...,\t}{%
            let \p1=($(int-\last)-(int-\i)$), \n1={veclen(\x1,\y1)}, \n2={abs(4pt)}, \n3={\i+1}  in%
            [rounded corners=\n2/4] -- ($(int-\last)!\n1-\n2!(int-\i)$) to[bend left=90, looseness=1.7] ($(int-\last)!\n1+\n2!(int-\n3)$)} -- (\tikzinputsegmentlast);
                }
            },
            decorate
        }
    }
\begin{document}
\begin{tikzpicture}[>=latex]
\matrix (Memory) [matrix of nodes, draw, inner sep=0pt,
                  column 1/.style={anchor=west},
                  column 2/.style={anchor=east},
                  column sep=.5cm, row sep=.2cm,
                  nodes={font=\ttfamily, inner sep=4pt}]{%
rst & mem\_out \\
next\_val & \\};
\matrix (EES) [matrix of nodes, draw, inner sep=0pt,
               below right=0cm and 2cm of Memory.north east,
               column 1/.style={anchor=west},
               column 2/.style={anchor=east},
               column sep=1cm,
               nodes={font=\ttfamily, inner sep=4pt}]{%
val\_in & data\_out \\
clk & \\
rst & req\_val \\};
\foreach \block in {Memory, EES} \node[font=\sffamily\Large, above=0cm of \block]{\block};
\draw[name path=line] ([shift={(1cm,0.4cm)}]Memory.north east) -- ++(0,-2cm);
\draw[over path=line, ->] (Memory-1-2) -- (EES-1-1);
\end{tikzpicture}
\end{document}

enter image description here