Vado avanti per piccoli passi:
`\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};
}
}
\tikzset{file/.code n args={2}{%
\draw (0,0) — (0,#2) — (#1,#2);
}
}
% 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) {};
}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\begin{figure*}[tb]
\centering
% \begin{tikzpicture}[scale=0.8,remember picture,overlay]
\begin{tikzpicture}[scale=0.8,remember picture]
\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.5,-5.5){psconfigure}{ps\_configure}{}
\drawclass(15.5,-4.5){psresults}{ps\_results}{}
\drawclass(15.5,-6.5){pstrace}{ps\_trace}{}
%%%%%%%%%%%%% FILE
\node[file={0.9}{1.5}] at (17,-4.5) {};
%%%%%%%%%%%%%
\drawclass(6,-9){psenergy}{ps\_energy\_model}{}
\drawclass(2,-11){psconstant}{ps\_constant\_model}{}
\drawclass(6,-11){pshardware}{ps\_hardware\_model}{}
\drawclass(10,-11){psRTL}{ps\_RTL\_model}{}
\draw [->,>=latex] (psconfigure.east) — (pskernel.west|-psconfigure.east);
\draw [<-,>=latex] (psresults.west) — (pskernel.east|-psresults.west);
\draw [<-,>=latex] (pstrace.west) — (pskernel.east|-pstrace.west);
\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.7)$) — ($(modconstant.center)+(2.5,-3.7)$)-|(psconstant.south);
\draw [->,>=latex] (modhardware.center) — ($(modhardware.center)+(2.25,0)$) — ($(modhardware.center)+(2.25,-2.7)$) — ($(modhardware.center)+(2.25,-2.7)$)-|(pshardware.south);
\draw [->,>=latex] (modRTL.center) — ($(modRTL.center)+(2,0)$) — ($(modRTL.center)+(2,-1.7)$) — ($(modRTL.center)+(2,-1.7)$)-|(psRTL.south);;
\end{tikzpicture}
\caption{Scheme of the interaction of Powersim with a SystemC design.}
\label{fig:powersim}
\end{figure*}
\end{document}`
Partendo dal disegno iniziale ho cercato ora di aggiungere i disegnini che rappresentano i file. Ho creato il tikzset file con dentro delle righe di prova, poi l’ho inserito all’interno del disegno dandogli delle coordinate. Purtroppo il simbolino del file viene stampato nella coordinata (0,0)… questo perché all’interno del tikzset ho fatto partire le linee da 0? ma le coordinate inserite all’interno del tikzset non sono relative rispetto a dove dopo viene posizionato il nodo?
Ciao
Marco