updates
[phd-thesis.git] / top / memorylayout.tex
1 \documentclass[tikz]{standalone}
2 %\usepackage{listings}
3 %\lstset{%
4 % basewidth=0.5em,
5 % basicstyle=\tt\scriptsize,
6 % breakatwhitespace=false,
7 % breaklines=true,
8 % captionpos=b,
9 % columns=[c]fixed,
10 % commentstyle=\sl,
11 % escapeinside={[+}{+]}, % chktex 9
12 % frame=,
13 % keepspaces=true,
14 % keywordstyle=\bf,
15 % showspaces=false,
16 % showstringspaces=false,
17 % showtabs=false,
18 % stringstyle=\it,
19 % tabsize=4,
20 % numberstyle=\tiny,
21 % language=C,
22 %}
23 \usetikzlibrary{arrows.meta,shapes.symbols,matrix,positioning}
24 \begin{document}
25 \begin{tikzpicture}[%
26 memory/.style={
27 matrix of nodes,
28 every node/.append style={
29 font=\footnotesize\tt, outer xsep=.4ex,
30 anchor=base},
31 column 2/.append style={
32 every node/.append style=
33 {draw,fill=white,
34 minimum width=#1,
35 minimum height=1.3em}
36 },
37 row sep=-.4pt,
38 },
39 memory/.default=4em,
40 descr/.style={draw=none,fill=none},
41 break above/.style={shape=tape, tape bend top=in and out, tape bend bottom=none},
42 break below/.style={shape=tape, tape bend top=none, tape bend bottom=in and out},
43 !!/.style={fill=green!20}, % chktex 26
44 pointer/.style = {font=\tt, anchor=base, inner sep=2pt},
45 ]
46 \matrix (main) [memory] {
47 & |[descr]| {\rm high addresses} \\
48 & || heap\\
49 & || $\downarrow$\\
50 & || \ldots\\
51 & || $\uparrow$\\
52 & || stack\\
53 & || $\uparrow$ \\
54 & || tasks \\
55 & |[descr]| {\rm low addresses}\\
56 };
57 \matrix (heap) [right=of main,memory,yshift=2em] {
58 & || tree\textsubscript{0}\\
59 & || tree\textsubscript{1}\\
60 & || tree\textsubscript{\ldots}\\
61 & || tree\textsubscript{n}\\
62 };
63 \matrix (global) [left=of main,memory,yshift=2em] {
64 & || task\textsubscript{n}\\
65 & || task\textsubscript{\ldots}\\
66 & || task\textsubscript{1}\\
67 & || task\textsubscript{0}\\
68 };
69 \draw[dashed] (main-2-2.north east) -- (heap-1-2.north west);
70 \draw[dashed] (main-3-2.south east) -- (heap-4-2.south west);
71
72 \draw[dashed] (main-7-2.north west) -- (global-1-2.north east);
73 \draw[dashed] (main-8-2.south west) -- (global-4-2.south east);
74
75 % \node (tree) [right=of heap] {
76 %\begin{lstlisting}
77 %struct TaskTree {
78 % enum BCTaskType_c task_type;
79 % bool trash;
80 % uint16_t refresh_min;
81 % uint16_t refresh_max;
82 % struct TaskTree *parent;
83 % union {
84 % ...
85 % uint16_t readd;
86 % ...
87 % struct {
88 % struct TaskTree *lhs;
89 % struct TaskTree *rhs;
90 % } tand;
91 % ...
92 % } data;\end{lstlisting}
93 % };
94 %
95 % \draw[dashed] (tree.north west) -- (heap-1-2.north east);
96 % \draw[dashed] (tree.south west) -- (heap-1-2.south east);
97 \end{tikzpicture}
98 \end{document}