77 lines
2.9 KiB
TeX
77 lines
2.9 KiB
TeX
|
\begin{itemize}
|
||
|
\item \textbf{Name} : DpgenRom4 -- 4 words ROM Macro-Generator
|
||
|
\item \textbf{Synopsys} :
|
||
|
\begin{verbatim}
|
||
|
Generate ( 'DpgenRom4', modelname
|
||
|
, param = { 'nbit' : n
|
||
|
, 'val0' : constVal0
|
||
|
, 'val1' : constVal1
|
||
|
, 'val2' : constVal2
|
||
|
, 'val3' : constVal3
|
||
|
, 'physical' : True
|
||
|
}
|
||
|
)
|
||
|
\end{verbatim}
|
||
|
\item \textbf{Description} : Generates a \verb-n- bits 4 words optimized ROM named \verb-modelname-.
|
||
|
\item \textbf{Terminal Names} :
|
||
|
\begin{itemize}
|
||
|
\item \textbf{sel1} : upper bit of the address of the value (input, 1 bit)
|
||
|
\item \textbf{sel0} : lower bit of the address of the value (input, 1 bit)
|
||
|
\item \textbf{q} : the selected word (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{val0} (mandatory) : Defines the first word
|
||
|
\item \textbf{val1} (mandatory) : Defines the second word
|
||
|
\item \textbf{val2} (mandatory) : Defines the third word
|
||
|
\item \textbf{val3} (mandatory) : Defines the fourth word
|
||
|
\item \textbf{physical} (optional, default value : False) : In order to generate a layout
|
||
|
\end{itemize}
|
||
|
\item \textbf{Behavior} :
|
||
|
\begin{verbatim}
|
||
|
q <= WITH sel1 & sel0 SELECT constVal0 WHEN B"00",
|
||
|
constVal1 WHEN B"01",
|
||
|
constVal2 WHEN B"10",
|
||
|
constVal3 WHEN B"11";
|
||
|
\end{verbatim}
|
||
|
\item \textbf{Example} :
|
||
|
\begin{verbatim}
|
||
|
from stratus import *
|
||
|
|
||
|
class inst_rom4 ( Model ) :
|
||
|
|
||
|
def Interface ( self ) :
|
||
|
self.sel0 = SignalIn ( "sel0", 1 )
|
||
|
self.sel1 = SignalIn ( "sel1", 1 )
|
||
|
self.q = SignalOut ( "dataout", 4 )
|
||
|
|
||
|
self.vdd = VddIn ( "vdd" )
|
||
|
self.vss = VssIn ( "vss" )
|
||
|
|
||
|
def Netlist ( self ) :
|
||
|
Generate ( 'DpgenRom4', 'rom4_0b1010_0b1100_0b1111_0b0001'
|
||
|
, param = { 'nbit' : 4
|
||
|
, 'val0' : "0b1010"
|
||
|
, 'val1' : "0b1100"
|
||
|
, 'val2' : "0b1111"
|
||
|
, 'val3' : "0b0001"
|
||
|
, 'physical' : True
|
||
|
}
|
||
|
)
|
||
|
self.I = Inst ( 'rom4_0b1010_0b1100_0b1111_0b0001', 'inst'
|
||
|
, map = { 'sel0' : self.sel0
|
||
|
, 'sel1' : self.sel1
|
||
|
, 'q' : self.q
|
||
|
, 'vdd' : self.vdd
|
||
|
, 'vss' : self.vss
|
||
|
}
|
||
|
)
|
||
|
|
||
|
def Layout ( self ) :
|
||
|
Place ( self.I, NOSYM, Ref(0, 0) )
|
||
|
\end{verbatim}
|
||
|
\end{itemize}
|