83 lines
2.1 KiB
TeX
83 lines
2.1 KiB
TeX
\subsubsection{Description}
|
|
|
|
One can create a generator and instantiate it in another generator.\\
|
|
\indent To do that, the name given when instantiating the generator must have the form : "file\_name.class\_name".\\
|
|
|
|
\indent Note that if the two generators are not in the same directory, the directory of the generator to be instantiated has to be added in the CRL\_CATA\_LIB environment variable.
|
|
|
|
\subsubsection{Example}
|
|
|
|
\begin{itemize}
|
|
\item File describing the generator which is going to instanciated later :
|
|
\end{itemize}
|
|
|
|
\begin{verbatim}
|
|
#!/usr/bin/python
|
|
|
|
from stratus import *
|
|
|
|
class class_function ( Model ) :
|
|
|
|
def Interface ( self ) :
|
|
self.n = self._param['nbit']
|
|
|
|
self._A = LogicIn ( "a", self.n )
|
|
self._B = LogicIn ( "b", self.n )
|
|
self._C = LogicIn ( "c", self.n )
|
|
|
|
self._S = LogicOut ( "s", self.n )
|
|
|
|
self._vdd = VddIn ( "vdd" )
|
|
self._vss = VssIn ( "vss" )
|
|
|
|
def Netlist ( self ) :
|
|
self._S <= ( self._A | self._B ) & self._C
|
|
\end{verbatim}
|
|
|
|
\begin{itemize}
|
|
\item File instanciating the generator :
|
|
\end{itemize}
|
|
|
|
\begin{verbatim}
|
|
#!/usr/bin/python
|
|
|
|
from stratus import *
|
|
|
|
class mycell ( Model ) :
|
|
|
|
def Interface ( self ) :
|
|
self._in1 = LogicIn ( "in1", 4 )
|
|
self._in2 = LogicIn ( "in2", 4 )
|
|
self._in3 = LogicIn ( "in3", 4 )
|
|
|
|
self._out = LogicOut ( "out", 4 )
|
|
|
|
self._vdd = VddIn ( "vdd" )
|
|
self._vss = VssIn ( "vss" )
|
|
|
|
def Netlist ( self ) :
|
|
temp = Signal ( "temp", 4 )
|
|
|
|
Inst ( "myfunc.class_function"
|
|
, param = { 'nbit' : 4 }
|
|
, map = { 'a' : self._in1
|
|
, 'b' : self._in2
|
|
, 'c' : self._in3
|
|
, 's' : temp
|
|
, 'vdd' : self._vdd
|
|
, 'vss' : self._vss
|
|
}
|
|
)
|
|
|
|
self._out <= ~temp
|
|
\end{verbatim}
|
|
|
|
\subsubsection{Errors}
|
|
|
|
Some errors may occur :
|
|
\begin{itemize}
|
|
\item \verb-[Stratus ERROR] Inst : the model ... does not exist.-\\\verb-Check CRL_CATA_LIB.-\\One has to check the environment variable because the model is not found.
|
|
\end{itemize}
|
|
|
|
\input{see_also}
|