68 lines
2.3 KiB
TeX
68 lines
2.3 KiB
TeX
\begin{itemize}
|
|
\item \textbf{Name} : DpgenNmux2 -- Multiplexer Macro-Generator
|
|
\item \textbf{Synopsys} :
|
|
\begin{verbatim}
|
|
Generate ( 'DpgenNmux2', modelname
|
|
, param = { 'nbit' : n
|
|
, 'physical' : True
|
|
, 'behavioral' : True
|
|
}
|
|
)
|
|
\end{verbatim}
|
|
\item \textbf{Description} : Generates a \verb-n- bits two inputs multiplexer named \verb-modelname-.
|
|
\item \textbf{Terminal Names} :
|
|
\begin{itemize}
|
|
\item \textbf{cmd} : select ( 1 bit )
|
|
\item \textbf{i0} : input ( \verb-n- bits )
|
|
\item \textbf{i1} : input ( \verb-n- bits )
|
|
\item \textbf{nq} : output ( \verb-n- bits )
|
|
\item \textbf{vdd} : power
|
|
\item \textbf{vss} : ground
|
|
\end{itemize}
|
|
\item \textbf{Parameters} : Parameters are given in the map \verb-param-.
|
|
\begin{itemize}
|
|
\item \textbf{nbit} (mandatory) : Defines the size of the generator
|
|
\item \textbf{physical} (optional, default value : False) : In order to generate a layout
|
|
\item \textbf{behavioral} (optional, default value : False) : In order to generate a behavior
|
|
\end{itemize}
|
|
\item \textbf{Behavior} :
|
|
\begin{verbatim}
|
|
nq <= WITH cmd SELECT not i0 WHEN '0',
|
|
not i1 WHEN '1';
|
|
\end{verbatim}
|
|
\item \textbf{Example} :
|
|
\begin{verbatim}
|
|
from stratus import *
|
|
|
|
class inst_nmux2 ( Model ) :
|
|
|
|
def Interface ( self ) :
|
|
self.in1 = SignalIn ( "in1", 5 )
|
|
self.in2 = SignalIn ( "in2", 5 )
|
|
self.cmd = SignalIn ( "cmd", 1 )
|
|
self.o = SignalOut ( "o", 5 )
|
|
|
|
self.vdd = VddIn ( "vdd" )
|
|
self.vss = VssIn ( "vss" )
|
|
|
|
def Netlist ( self ) :
|
|
Generate ( 'DpgenNmux2', 'nmux2_5'
|
|
, param = { 'nbit' : 5
|
|
, 'physical' : True
|
|
}
|
|
)
|
|
self.I = Inst ( 'nmux2_5', 'inst'
|
|
, map = { 'i0' : self.in1
|
|
, 'i1' : self.in2
|
|
, 'cmd' : self.cmd
|
|
, 'nq' : self.o
|
|
, 'vdd' : self.vdd
|
|
, 'vss' : self.vss
|
|
}
|
|
)
|
|
|
|
def Layout ( self ) :
|
|
Place ( self.I, NOSYM, Ref(0, 0) )
|
|
\end{verbatim}
|
|
\end{itemize}
|