let( (library cell pcellId) library="" cell="flash_nbit_pre_amp" unless(ddGetObj(library) error("Couldn't open library %L" library) ) ;-------------------------------------------------------------------- ; Now the symbol ;-------------------------------------------------------------------- pcellId=pcDefinePCell( list(ddGetObj(library) cell "symbol" "schematicSymbol") ;---------------------------------------------------------------- ; Formal parameters ;---------------------------------------------------------------- ( (FS 2) (nlevel 7) (gain 1) ) ;---------------------------------------------------------------- ; Code itself ;---------------------------------------------------------------- let(( cv netINP netINN netCLK netOUT figINP figINN figINN figCLK netOUT hp ps pl bw lh pxc label) cv = pcCellView ;---------------------------------------------------------------- ; Various dimensions ;---------------------------------------------------------------- ; half pin size hp=0.025 ; pin spacing ps=0.125 ; pin length pl=0.250 ; box width bw=1.4375 ; label height lh=0.0625 ; param label x coord pxc=0.5 ;---------------------------------------------------------------- ; create the shapes - first the pins ;---------------------------------------------------------------- figINP = dbCreateRect(cv list("pin" "drawing") list(-hp:-hp hp:hp)) dbCreateLine(cv list("device" "drawing") list(0:0 pl:0)) figINN = dbCreateRect(cv list("pin" "drawing") list(-hp:-ps-hp hp:-ps+hp)) dbCreateLine(cv list("device" "drawing") list(0:-ps pl:-ps)) figCLK = dbCreateRect(cv list("pin" "drawing") list(-hp:-3*ps-hp hp:-3*ps+hp)) dbCreateLine(cv list("device" "drawing") list(0:-3*ps pl:-3*ps)) figOUT = dbCreateRect(cv list("pin" "drawing") list(2*pl+bw-hp:-hp 2*pl+bw+hp:hp)) dbCreateLine(cv list("device" "drawing") list(pl+bw:0 2*pl+bw:0)) ;---------------------------------------------------------------- ; Then the boxes ;---------------------------------------------------------------- dbCreateRect(cv list("device" "drawing") list(pl:-4*ps pl+bw:ps)) dbCreateRect(cv list("instance" "drawing") list(0:-4*ps 2*pl+bw:ps)) ;---------------------------------------------------------------- ; create the nets ;---------------------------------------------------------------- netINP=dbMakeNet(cv "inp") netINN=dbMakeNet(cv "inn") netCLK=dbMakeNet(cv "clk") netOUT=dbMakeNet(cv sprintf(nil "out<%d:0>" nlevel)) ;---------------------------------------------------------------- ; create the terminals ;---------------------------------------------------------------- dbCreateTerm(netINP netINP~>name "input") dbCreateTerm(netINN netINN~>name "input") dbCreateTerm(netCLK netCLK~>name "input") dbCreateTerm(netOUT netOUT~>name "output") ;---------------------------------------------------------------- ; create the pins ;---------------------------------------------------------------- dbCreatePin(netINP figINP) dbCreatePin(netINN figINN) dbCreatePin(netCLK figCLK) dbCreatePin(netOUT figOUT) ;---------------------------------------------------------------- ; Put some labels for the pins ;---------------------------------------------------------------- dbCreateLabel(cv list("pin" "drawing") pl+ps/2:0 netINP~>name "centerLeft" "R0" "stick" lh) dbCreateLabel(cv list("pin" "drawing") pl+ps/2:-ps netINN~>name "centerLeft" "R0" "stick" lh) dbCreateLabel(cv list("pin" "drawing") pl+ps/2:-3*ps netCLK~>name "centerLeft" "R0" "stick" lh) dbCreateLabel(cv list("pin" "drawing") bw+pl-ps/2:0 netOUT~>name "centerRight" "R0" "stick" lh) ;---------------------------------------------------------------- ; And other symbol labels ;---------------------------------------------------------------- label=dbCreateLabel(cv list("annotate" "drawing7") bw+pl-ps/2:ps*1.5 "cdsName()" "centerRight" "R0" "stick" lh) label~>labelType="ILLabel" label=dbCreateLabel(cv list("annotate" "drawing") pxc:0 "cdsParam(1)" "centerLeft" "R0" "stick" lh) label~>labelType="ILLabel" label=dbCreateLabel(cv list("annotate" "drawing") pxc:-ps "cdsParam(2)" "centerLeft" "R0" "stick" lh) label~>labelType="ILLabel" label=dbCreateLabel(cv list("annotate" "drawing") pxc:-2*ps "cdsParam(3)" "centerLeft" "R0" "stick" lh) label~>labelType="ILLabel" t ) ; let ) dbSave(pcellId) dbClose(pcellId) ;------------------------------------------------------------------------ ; Now create the CDF ;------------------------------------------------------------------------ let( (cellId cdfId ) unless( cellId = ddGetObj( library cell ) error( "Could not get cell %s." cell ) ) when( cdfId = cdfGetBaseCellCDF( cellId ) cdfDeleteCDF( cdfId ) ) cdfId = cdfCreateBaseCellCDF( cellId ) ;;; Parameters cdfCreateParam( cdfId ?name "FS" ?prompt "Full Scale" ?defValue "2" ?type "string" ?display "t" ) cdfCreateParam( cdfId ?name "nlevel" ?prompt "nlevel" ?defValue " 7" ?type "string" ?display "t" ) cdfCreateParam( cdfId ?name "gain" ?prompt "Pre_amp Gain" ?defValue " 1" ?type "string" ?display "t" ) ;;; Simulator Information cdfId->simInfo = list( nil ) cdfId->simInfo->UltraSim = '( nil ) cdfId->simInfo->ams = '( nil ) cdfId->simInfo->auCdl = '( nil ) cdfId->simInfo->auLvs = '( nil ) cdfId->simInfo->cdsSpice = '( nil ) cdfId->simInfo->hspiceD = '( nil ) cdfId->simInfo->hspiceS = '( nil ) cdfId->simInfo->spectre = '( nil ) cdfId->simInfo->spectreS = '( nil ) ;;; Properties cdfId->formInitProc = "" cdfId->doneProc = "" cdfId->buttonFieldWidth = 340 cdfId->fieldHeight = 35 cdfId->fieldWidth = 350 cdfId->promptWidth = 175 cdfId->paramLabelSet = "FS nlevel gain" cdfId->paramDisplayMode = "parameter" cdfId->paramEvaluate = "t nil nil nil nil" cdfSaveCDF( cdfId ) ) ; let ) ; let