coriolis/stratus1/doc/stratus/man_const.tex

86 lines
2.5 KiB
TeX

\subsubsection{Name}
Constant -- Easy way to instantiate constants
\subsubsection{Synopsys}
\begin{verbatim}
netOne <= One ( 2 )
net8 <= "8"
\end{verbatim}
\subsubsection{Description}
These functions simplify the way to instanciate constants.
\begin{itemize}
\item The functions \verb-One- and\verb-Zero- permits to initialise all the bits of a net to 'one' or 'zero'.
\item The instanciation of a constant thanks to a string can be done in decimal, hecadecimal or binary.
\end{itemize}
\subsubsection{Parameters}
\begin{itemize}
\item For \verb-One- and \verb-Zero- :
\begin{itemize}
\item \verb-n- : the arity of the net
\end{itemize}
\item For the instanciation of a constant :
\begin{itemize}
\item the constant given must be a string representing :
\begin{itemize}
\item A decimal number
\item A binary number : the string must begin with "0b"
\item An hexadecimal number : the string must begin with "0x"
\end{itemize}
\end{itemize}
\end{itemize}
\subsubsection{Example}
\begin{verbatim}
class essai ( Model ) :
def Interface ( self ) :
self.Ones = SignalOut ( "ones", 2 )
self.Zeros = SignalOut ( "zeros", 4 )
self.Eight = SignalOut ( "eight", 4 )
self.Twentu = SignalOut ( "twenty", 5 )
self.Two = SignalOut ( "two", 5 )
self.Vdd = VddIn ( "vdd" )
self.Vss = VssIn ( "vss" )
def Netlist ( self ) :
self.Ones <= One ( 2 )
self.Zero <= Zero ( 4 )
self.Eight <= "8"
self.Twenty <= "0x14"
self.Two <= "0b10"
\end{verbatim}
\subsubsection{Errors}
Some errors may occur :
\begin{itemize}
\item \verb-[Stratus ERROR] Const :-\\\verb-the argument must be a string representing a number in decimal,-\\\verb-binary (0b) or hexa (0x).-\\The string given as argument does not have the right form.
\end{itemize}
\begin{htmlonly}
\subsubsection{See Also}
\hyperref[ref]{\emph{Introduction}}{}{Introduction}{secintroduction}
\hyperref[ref]{\emph{Netlist}}{}{Netlist}{secnetlist}
\hyperref[ref]{\emph{Instanciation of a multiplexor}}{}{Multiplexor}{secmux}
\hyperref[ref]{\emph{Instanciation of a shifter}}{}{Shifter}{secshift}
\hyperref[ref]{\emph{Instanciation of a register}}{}{Reg}{secreg}
\hyperref[ref]{\emph{Boolean operations}}{}{Boolean}{secbool}
\hyperref[ref]{\emph{Arithmetical operations}}{}{Arithmetic}{secarithmetic}
\hyperref[ref]{\emph{Comparison operations}}{}{Comparison}{seccomp}
\end{htmlonly}