Skip to content

Instantly share code, notes, and snippets.

@anishathalye
Created December 11, 2019 02:10
Show Gist options
  • Save anishathalye/567debae73e50016741edb329c0da80b to your computer and use it in GitHub Desktop.
Save anishathalye/567debae73e50016741edb329c0da80b to your computer and use it in GitHub Desktop.
\begin{tikzpicture}[>=latex]
\tikzset{
pics/cpu/.style n args={3}{
code = {
\draw node (#2) [draw,thick,rectangle,minimum height=1cm,
minimum width=2cm,#3] at (0.5,1) {#1};
\draw (0,0) node [draw,thick,rectangle,minimum height=1cm,minimum width=1cm] {ROM};
\draw (1,0) node [draw,thick,rectangle,minimum height=1cm,minimum width=1cm] {RAM};
}
}
}
\tikzstyle{dev}=[rounded rectangle,thick, draw, minimum width=2.5cm,
minimum height=1cm, align=left];
\tikzstyle{edge}=[thick,->];
\tikzstyle{dedge}=[thick,<->];
\tikzstyle{border}=[dotted,thick]
\tikzstyle{boxed}=[draw,thick]
\pic at (0,0) {cpu={CPU 2}{C2}{fill=red!10}};
\pic at (5,0) {cpu={CPU 1}{C1}{fill=blue!10}};
\pic at (11,0) {cpu={CPU 0}{C0}{fill=green!10}};
\draw [border] (2.5,-2.5) -- (2.5,4);
\draw [border] (8.5,-2.5) -- (8.5,4);
\draw node (button) [dev] at (4,2.5) {Yes/No \\ button};
\draw node (display) [dev] at (7,2.5) {Display};
\draw [edge] ($(C1.north east)+(-0.25,0)$) -- (display.south);
\draw [edge] (button.south) -- ($(C1.north west)+(0.25,0)$);
\draw node (reset) [dev] at (10,2.5) {Reset\\button};
\draw node (led) [dev] at (13,2.5) {User/SYS\\indicator};
\draw [edge] (reset.south) -- ($(C0.north west)+(0.25,0)$);
\draw [edge] ($(C0.north east)+(-0.25,0)$) -- (led.south);
\draw node (flash) [dev] at (15,1) {Flash};
\draw [dedge] (C0.east) -- (flash.west);
\draw [dedge] ($(C0.north west)+(0.0,-0.25)$) -- node[above] {UART} ($(C1.north east)+(0.0,-0.25)$);
\draw [dedge] ($(C1.north west)+(0.0,-0.25)$) -- node[above] {UART} ($(C2.north east)+(0.0,-0.25)$);
\draw [dedge] (C2.west) -- node[above] {USB} ($(C2.west)+(-2,0)$);
\draw [edge] (C0.west) to [bend left] node[below] {Reset} (C1.east);
\draw [edge] (C0.west) to [bend left=50] node[above] {Reset} (C2.east);
\draw [edge] (C0.south west) to [bend left=50] node[below] {UART
(One-way)} (C2.south east);
\draw [boxed] (-1,-2.5) rectangle (16.5,4);
\draw node at (1, 3.5) {\textbf{Comm domain}};
\draw node at (6, 3.5) {\textbf{Agent domain}};
\draw node at (12, 3.5) {\textbf{Kernel domain}};
\end{tikzpicture}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment