i am using 32nm PTM model file with vthon=0.63 and vthop=-0.5808. I am assuming 30% threshold voltage variation for 3 sigma. i want to measure RSNM for 10 iteration. coding is given below
********************************************************************
.param
+delvtop1 =agauss(0,-0.1356,3)
+ delvton1=agauss(0,0.1503,3)
+delvtop ='(-0.5808 + delvtop1)'
+delvton='(0.63 + delvton1)'
.TEMP 25.0000
.protect
* Donnot print the contents of library
.include 'D:\Dissertation\coding\model file\32nm_NMOS_bulk6769.pm'
.include 'D:\Dissertation\coding\model file\32nm_PMOS_bulk22584.pm'
* Load the library
.unprotect
*Sets global values
.GLOBAL VDD!
*Parameterize input element
.PARAM VDD = 1V
.PARAM L = 32n
.PARAM WN = '1*L'
.PARAM WP = '1*L'
.PARAM LNA = '1*L'
.PARAM WNA = '1*L'
.PARAM U = 0
.PARAM UL = '-VDD/sqrt(2)'
.PARAM UH = ' VDD/sqrt(2)'
.PARAM BITCAP = 1E-12
*Requesting Graph Data Format in binary
.OPTION POST
CBL BLB 0 BITCAP
CBLB BL 0 BITCAP
*MOSFET (we can specify additional parameters, such as W= L=, in the parameter list)
* m
* one inverter
MPL QD QB VDD! VDD! PMOS L='L' W='WP' delvt0= delvtop
+AD='WP*2.5*L' AS='WP*2.5*L' PD='2*WP+5*L' PS='2*WP+5*L'
+M=1
MNL QD QB 0 0 NMOS L='L' W='WN' delvt0= delvton
+AD='WN*2.5*L' AS='WN*2.5*L' PD='2*WN+5*L' PS='2*WN+5*L'
+M=1
* one inverter
MPR QBD Q VDD! VDD! PMOS L='L' W='WP' delvt0= delvtop
+AD='WP*2.5*L' AS='WP*2.5*L' PD='2*WP+5*L' PS='2*WP+5*L'
+M=1
MNR QBD Q 0 0 NMOS L='L' W='WN' delvt0= delvton
+AD='WN*2.5*L' AS='WN*2.5*L' PD='2*WN+5*L' PS='2*WN+5*L'
+M=1
* access transistors
MNAL BLB WL QBD 0 NMOS L='LNA' W='WNA' delvt0= delvton
+AD='WNA*2.5*L' AS='WNA*2.5*L' PD='2*WNA+5*L' PS='2*WNA+5*L'
+M=1
MNAR BL WL QD 0 NMOS L='LNA' W='WNA' delvt0= delvton
+AD='WNA*2.5*L' AS='WNA*2.5*L' PD='2*WNA+5*L' PS='2*WNA+5*L'
+M=1
*Independent voltage source
*v
VVDD! VDD! 0 DC=VDD
* when reading, use VDD in hold mode use 0
VWL WL 0 DC=vdd
*Initial condition
.IC V(BL) = VDD
.IC V(BLB) = VDD
* use voltage controlled voltage sources (VCVS)
* changing the co-ordinates in 45 degree angle
EQ Q 0 VOL=' 1/sqrt(2)*U + 1/sqrt(2)*V(V1)'
EQB QB 0 VOL='-1/sqrt(2)*U + 1/sqrt(2)*V(V2)'
* inverter characteristics
EV1 V1 0 VOL=' U + sqrt(2)*V(QBD)'
EV2 V2 0 VOL='-U + sqrt(2)*V(QD)'
* take the absolute value for determination of SNM
EVD VD 0 VOL='(V(V1) - V(V2))'
.DC U UL UH 0.01 sweep monte=10
.PRINT DC V(QD) V(QBD) V(V1) V(V2)
*now we are getin1 exactaly same value as we geting from old method(graphical method)
.MEASURE DC MAXVD MAX V(VD) FROM=-500m to =500m
.MEASURE DC MINVD MIN V(VD) FROM=-500m to =500m
* measure SNM
*.MEASURE DC SNM param='1/sqrt(2)*MAXVD'
*CHANGE 0N 1 MAY 2015 MINVD VALUE ALWAYES BE -VE SO WE TAKE abs VALUE OF IT. NOW FIND MIN VALUE OF MAXVD AND MINVD.
.MEASURE DC SNM param='(1/sqrt(2)*MIN(MAXVD,ABS(minVD)))'
.END