`\documentclass[a4paper,10pt,twocolumn]{IEEEtran}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% COMANDI VARI PER LE IMMAGINI
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{xparse}
\usepackage{tikz}
\usetikzlibrary{calc,positioning}
\newcommand{\bigpicsize}[1]{\footnotesize{#1}}
\newcommand{\picsize}[1]{\scriptsize{#1}}
\newcommand{\picsizett}[1]{\scriptsize{\texttt{#1}}}
\newcommand{\smallpicsize}[1]{\tiny{#1}}
\pgfmathtruncatemacro{\classwidth}{3}
\pgfmathtruncatemacro{\classheight}{2}
\newcommand{\setclasswidth}[1]{\pgfmathtruncatemacro{\classwidth}{#1}}
\newcommand{\setclassheight}[1]{\pgfmathtruncatemacro{\classheight}{#1}}
\tikzset{class/.style args={#1 and #2}{
rectangle,draw,rounded corners,thick,minimum width=#1, minimum height=#2
}
}
\tikzset{classinside/.code n args={3}{%
\node at ($(#1.north)+(0,-0.30)$){\picsizett{#2}};
\draw($(#1.north west)+(0,-0.60)$)–($(#1.north east)+(0,-0.60)$);
\node[yshift=-\classheight,text width=\classwidth cm,align=center] at (#1){#3};
}
}
% DRAWCLASS
% #1 – Coordinate
% #2 – Label
% #3 – Nome Classe
% #4 – Contenuto
\NewDocumentCommand{\drawclass}{d() m m m}{
\IfNoValueTF{#1}{%true
\node[class=\classwidth cm and \classheight cm,name=#2]{};
}
{%false
\node[class=\classwidth cm and \classheight cm,name=#2]at(#1){};
}
\node[classinside={#2}{#3}{#4}]{};
}
\NewDocumentCommand{\classmark}{o m O{0.05}}{%
\IfNoValueTF{#1}{%true
\tikz[overlay,remember picture,baseline=-0.5ex,xshift=-0.3 cm] \node[draw,fill=black,circle,scale=#3] (#2) {};
}
{%false
\tikz[overlay,remember picture,baseline=-0.5ex,xshift=#1 cm] \node[draw,fill=black,circle,scale=#3] (#2) {};
}
}
\NewDocumentCommand{\invisiblemark}{o m}{%
\IfNoValueTF{#1}{%true
\tikz[overlay,remember picture,baseline=-0.5ex,xshift=-0.3 cm] \node[scale=0.05] (#2) {};
}
{%false
\tikz[overlay,remember picture,baseline=-0.5ex,xshift=#1 cm] \node[scale=0.05] (#2) {};
}
}
\NewDocumentCommand{\anchormark}{o m m}{%
\IfNoValueTF{#1}{%true
\tikz[overlay,remember picture,baseline=-0.5ex,xshift=-0.3 cm] \node[scale=0.05] (#2) at (#3){};
}
{%false
\tikz[overlay,remember picture,baseline=-0.5ex,xshift=#1 cm] \node[scale=0.05] (#2) at (#3) {};
}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\begin{figure*}[tb]
\centering
% \begin{tikzpicture}[scale=0.8,remember picture,overlay]
\begin{tikzpicture}[scale=0.8]
\draw[help lines,yshift=-13cm] (0,0) grid (20,13);
% SYSTEMC
\node
at (18,0.25) {\bigpicsize{SystemC design}};
\draw [dashed] (2,0) rectangle (18,-3);
% POWERSIM
\node
at (20,-13.25) {\bigpicsize{Powersim}};
\draw [dashed] (0,-1.5) rectangle (20,-13);
\drawclass(5,-1.5){m1}{sc\_module}{\vdots \\ \classmark{m1init} \picsizett{ps\_init()}}
\drawclass(10,-1.5){m2}{sc\_module}{\vdots \\ \classmark{m2init} \picsizett{ps\_init()}}
\drawclass(15,-1.5){m3}{sc\_module}{\vdots \\ \classmark{m3init} \picsizett{ps\_init()}}
\setclasswidth{5}
\setclassheight{3}
\drawclass(10,-5.5){pskernel}{ps\_kernel}{%
\invisiblemark[0]{addmodule} \picsizett{add\_module\_to\_powersim()} \\[2ex]
\begin{tabular}{|c|l|}
\hline
M1 & \picsizett{ps\_module} for M1 \\
\hline
M2 & \picsizett{ps\_module} for M2 \\
\hline
M3 & \picsizett{ps\_module} for M3 \classmark[0.2]{m3module}[0.03] \\
\hline
\end{tabular}
\\[2ex]
\hspace{0.5\classwidth em}\vdots
}
\setclasswidth{3}
\setclassheight{1}
\drawclass(4,-7){psconfigure}{ps\_configure}{}
\drawclass(6,-9){psenergy}{ps\_energy\_model}{}
\drawclass(2,-11){psconstant}{\invisiblemark[0]{constantsouth} ps\_constant\_model}{}
% \anchormark[0]{constantsouth}{psconstant.south}
\drawclass(6,-11){pshardware}{ps\_hardware\_model}{}
\drawclass(10,-11){psRTL}{ps\_RTL\_model}{}
\draw [->,>=latex] (psconfigure.east) — (pskernel.west|-psconfigure.east);
\setclasswidth{5}
\setclassheight{3}
\drawclass(15.5,-10){psmodule}{\invisiblemark[0]{psmoduleclass} ps\_module}{%
{}\\[2ex]
\begin{tabular}{|c|lc|}
\hline
\picsizett{sc\_bit \&} & \picsize{constant} & \classmark[0.2]{modconstant}[0.03] \\
\hline
\picsizett{sc\_bit |} & \picsize{hardware} & \classmark[0.2]{modhardware}[0.03] \\
\hline
\picsizett{sc\_int +} & \picsize{RTL} & \classmark[0.2]{modRTL}[0.03] \\
\hline
\end{tabular}
\\[2ex]
\hspace{0.5\classwidth em}\vdots
}
\end{tikzpicture}
\begin{tikzpicture}[scale=0.8,remember picture,overlay]
\draw (m1init.center) — ($(m1init)-(0,1.25)$)-|(m2init.center) — ($(m2init)-(0,1.25)$)-|(m3init.center);
\draw [<-,>=latex] (addmodule.center) |-($(m2init)-(0,1.25)$);
\draw [->,>=latex] (m3module.center) — (m3module.center|-psmoduleclass.center) — (psmoduleclass.center);
\draw [->,>=latex] (modconstant.center) — ($(modconstant.center)+(2.5,0)$) — ($(modconstant.center)+(2.5,-3.5)$) — ($(modconstant.center)+(2.5,-3.5)$)-|(constantsouth.center);
\draw [->,>=latex] (modhardware.center) — ($(modhardware.center)+(2.25,0)$) — ($(modhardware.center)+(2.25,-2.5)$);
\draw [->,>=latex] (modRTL.center) — ($(modRTL.center)+(2,0)$) — ($(modRTL.center)+(2,-1.5)$);
\end{tikzpicture}
\caption{Scheme of the interaction of Powersim with a SystemC design.}
\label{fig:powersim}
\end{figure*}
\end{document}`
Sono andato avanti, ed ovviamente ho incontrato nuovi problemi! 😳
Vi spiego quale è quello attuale: come nella figura postata all’inizio, cerco di collegare il mark dentro alla classe ps_module (constant, RTL, hardware) con la relativa classe.
Vorrei però che si collegasse al south del riquadro. Per questo ho definito il comando \anchormark in modo da potergli passare come cordinata ad esempio psconstant.south (è commentata nel codice) ma questo lo fa dare di matto e la freccia non si sa dove va a finire. cosa sbaglio? non lo posso fare?
Ciao e grazie di nuovo
Marco