\begin{itemize}
    \item \textbf{Name} : DpgenNor2mask -- Programmable Mask Macro-Generator
    \item \textbf{Synopsys} :
\begin{verbatim}
Generate ( 'DpgenNor2mask', modelname
         , param = { 'nbit'       : n
                   , 'const'      : constVal 
                   , 'physical'   : True
                   , 'behavioral' : True                   
                   }
         )
\end{verbatim}
    \item \textbf{Description} : Generates a \verb-n- bits conditionnal NOR mask named \verb-modelname-.
    \item \textbf{Terminal Names} :
    \begin{itemize}
        \item \textbf{cmd} : mask control ( 1 bit )
        \item \textbf{i0} : 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{const} (mandatory) : Defines the constant (string beginning with 0b, 0x or 0o functions of the basis)
        \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{How it works} :
    \begin{itemize}
        \item If the \verb-cmd- signal is set to \verb-zero-, the mask is NOT applied, so the whole operator behaves like an inverter.
        \item If the \verb-cmd- signal is set to \verb-one-, the mask is applied, the output is the \emph{complemented} result of the input value \emph{ORed} with the mask (suplied by \verb-constVal-).
        \item The constant \verb-constVal- is given to the macro-generator call, therefore the value cannot be changed afterward : it's hard wired in the operator.
        \item A common error is to give a real constant for the \verb-constVal- argument. Be aware that it is a character string.
    \end{itemize}
    \item \textbf{Behavior} :
\begin{verbatim}
nq <= WITH cmd SELECT not(i0)             WHEN '0',
                      not(i0 or constVal) WHEN '1';
\end{verbatim}
    \item \textbf{Example} :
\begin{verbatim}
from stratus import *

class inst_nor2mask ( Model ) :

  def Interface ( self ) :
    self.i   = SignalIn  (   "i", 8 )
    self.cmd = SignalIn  ( "cmd", 1 )
    self.o   = SignalOut (   "o", 8 )

    self.vdd = VddIn ( "vdd" )
    self.vss = VssIn ( "vss" )
    
  def Netlist ( self ) :
    Generate ( 'DpgenNor2mask', 'nor2mask_000111'
             , param = { 'nbit'     : 8
                       , 'const'    : "0b000111"
                       , 'physical' : True
                       }
             )
    self.I = Inst ( 'nor2mask_000111', 'inst'
                  , map = { 'i0'  : self.i
                          , '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}
