errata
[phd-thesis.git] / top / memorylayout.tex
1 \documentclass[tikz]{standalone}
2 \usetikzlibrary{arrows.meta,shapes.symbols,matrix,positioning}
3 \begin{document}
4 \begin{tikzpicture}[%
5 memory/.style={
6 matrix of nodes,
7 every node/.append style={
8 font=\footnotesize\tt, outer xsep=.4ex,
9 anchor=base},
10 column 2/.append style={
11 every node/.append style=
12 {draw,fill=white,
13 minimum width=#1,
14 minimum height=1.3em}
15 },
16 row sep=-.4pt,
17 },
18 memory/.default=4em,
19 descr/.style={draw=none,fill=none},
20 break above/.style={shape=tape, tape bend top=in and out, tape bend bottom=none},
21 break below/.style={shape=tape, tape bend top=none, tape bend bottom=in and out},
22 !!/.style={fill=green!20}, % chktex 26
23 pointer/.style = {font=\tt, anchor=base, inner sep=2pt},
24 ]
25 \matrix (main) [memory] {
26 & |[descr]| {\rm high addresses} \\
27 & || heap\\
28 & || {\normalsize $\downarrow$}\\
29 & || \ldots\\
30 & || {\normalsize $\uparrow$}\\
31 & || stack\\
32 & || {\normalsize $\uparrow$}\\
33 & || tasks \\
34 & |[descr]| {\rm low addresses}\\
35 };
36 \matrix (heap) [right=of main,memory,yshift=2em] {
37 & || tree\textsubscript{0}\\
38 & || tree\textsubscript{1}\\
39 & || tree\textsubscript{\ldots}\\
40 & || tree\textsubscript{n}\\
41 };
42 \matrix (global) [left=of main,memory,yshift=2em] {
43 & || task\textsubscript{n}\\
44 & || task\textsubscript{\ldots}\\
45 & || task\textsubscript{1}\\
46 & || task\textsubscript{0}\\
47 };
48 \draw[dashed] (main-2-2.north east) -- (heap-1-2.north west);
49 \draw[dashed] (main-3-2.south east) -- (heap-4-2.south west);
50
51 \draw[dashed] (main-7-2.north west) -- (global-1-2.north east);
52 \draw[dashed] (main-8-2.south west) -- (global-4-2.south east);
53
54 % \node (tree) [right=of heap] {
55 %\begin{lstlisting}
56 %struct TaskTree {
57 % enum BCTaskType_c task_type;
58 % bool trash;
59 % uint16_t refresh_min;
60 % uint16_t refresh_max;
61 % struct TaskTree *parent;
62 % union {
63 % ...
64 % uint16_t readd;
65 % ...
66 % struct {
67 % struct TaskTree *lhs;
68 % struct TaskTree *rhs;
69 % } tand;
70 % ...
71 % } data;\end{lstlisting}
72 % };
73 %
74 % \draw[dashed] (tree.north west) -- (heap-1-2.north east);
75 % \draw[dashed] (tree.south west) -- (heap-1-2.south east);
76 \end{tikzpicture}
77 \end{document}