coriolis/stratus1/doc/dpgen/man_dpgenshrot.tex

71 lines
2.8 KiB
TeX

\begin{itemize}
\item \textbf{Name} : DpgenShrot -- Shift/Rotation Macro-Generator
\item \textbf{Synopsys} :
\begin{verbatim}
Generate ( 'DpgenShrot', modelname
, param = { 'nbit' : n
, 'physical' : True
}
)
\end{verbatim}
\item \textbf{Description} : Generates a \verb-n- bits shift/rotation operator named \verb-modelname-.
\item \textbf{Terminal Names} :
\begin{itemize}
\item \textbf{op} : select the kind of shift/rotation (input, 3 bits)
\item \textbf{shamt} : the shift amount (input, \verb-Y- bits)
\item \textbf{i} : value to shift (input, \verb-n- bits)
\item \textbf{o} : 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
\end{itemize}
\item \textbf{How it works} :
\begin{itemize}
\item If the \verb-op[0]- signal is set to \verb-one-, performs a right shift/rotation , otherwise left shift/rotation occurs.
\item If the \verb-op[1]- signal is set to \verb-one-, performs an arithmetic shift (only meaningful in case of a right shift).
\item If the \verb-op[2]- signal is set to \verb-one-, performs a rotation, otherwise performs a shift..
\item \verb-shamt- specifies the shift amount. The width of this signal (\verb-Y-) is computed from the operator's width : \verb-Y = ceil(log2(n))- - 1
\end{itemize}
% \item \textbf{Behavior} :
%\begin{verbatim}
%\end{verbatim}
\item \textbf{Example} :
\begin{verbatim}
from stratus import *
class inst_shrot ( Model ) :
def Interface ( self ) :
self.rotop = SignalIn ( "rotop", 3 )
self.instshamt = SignalIn ( "instshamt", 2 )
self.insti = SignalIn ( "insti", 4 )
self.insto = SignalOut ( "insto", 4 )
self.vdd = VddIn ( "vdd" )
self.vss = VssIn ( "vss" )
def Netlist ( self ) :
Generate ( 'DpgenShrot', 'shrot_4'
, param = { 'nbit' : 4
, 'physical' : True
}
)
self.I = Inst ( 'shrot_4', 'inst'
, map = { 'op' : self.rotop
, 'shamt' : self.instshamt
, 'i' : self.insti
, 'o' : self.insto
, 'vdd' : self.vdd
, 'vss' : self.vss
}
)
def Layout ( self ) :
Place ( self.I, NOSYM, Ref(0, 0) )
\end{verbatim}
\end{itemize}