Generate ( 'DpgenNor2mask', modelname
, param = { 'nbit' : n
, 'const' : constVal
, 'physical' : True
, 'behavioral' : True
}
)
n bits conditionnal NOR mask named modelname.
n bits )
n bits )
param.
cmd signal is set to zero, the mask is NOT applied, so the whole operator behaves like an inverter.
cmd signal is set to one, the mask is applied, the output is the complemented result of the input value ORed with the mask (suplied by constVal).
constVal is given to the macro-generator call, therefore the value cannot be changed afterward : it's hard wired in the operator.
constVal argument. Be aware that it is a character string.
nq <= WITH cmd SELECT not(i0) WHEN '0',
not(i0 or constVal) WHEN '1';
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) )