-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathinv_sim.il
98 lines (81 loc) · 4.79 KB
/
inv_sim.il
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
;; source /pbs/throng/omme/bin/tsmc65n_grid
;load("inv_sim.il")
; ineed('inv_sim t)
ineed('(geOpenOrRaisecv rexFindCell terminalGen createInstPinsch getInstTermPoint getPropList))
;unless(rexFindCell("nmos_sim" '("TSMC65_ebecheto" )) )
;;unless(dbOpenCellViewByType( "TSMC65_ebecheto" "nmos_sim" "schematic" "" "r")
;; NOT FINISHED AT ALL
;; TODO pmos above and vpulse to inject signal
;; CREATE FIRST _schematic & symbol instead of inv_sim
;(setq npmoslib '(("nch" "pch") "tsmcN65"));=> (("nch" "pch") "tsmcN65")
;(setq npmoslib '(("nmos" "pmos") "SG13_dev"));=> (("nch" "pch") "tsmcN65")
;(setq npmoslib '(("nmos1v" "pmos1v") "tsmc13rf"));=> (("nmos1v" "pmos1v") "tsmc13rf")
defun(inv_sim (@optional (cv nil) (npmoslib '(("nch" "pch") "tsmcN65")))
let( (XY v1 param itp Pxy win v2 Sxy Bxy Gxy Dxy win libname nmos pmos nplib)
nmos=caar(npmoslib);=> "nch";=> "nmos"
pmos=cadar(npmoslib);=> "pch";=> "pmos"
nplib=cadr(npmoslib);=> "tsmcN65";=> "SG13_dev"
unless(cv
libName=strcat(env("PRJ_NAME")||"design" "_" env("USER"));=> "ihp130_ebecheto"
if(
car(setof(lib ddGetLibList() lib~>name==libname))
then
cv=dbOpenCellViewByType(strcat(env("PRJ_NAME")||"design" "_" env("USER")) strcat("inv" "_sim") "schematic" "schematic" "w")
else
cv=geGetWindowCellView()
))
;cv=dbOpenCellViewByType( "TSMC65_ebecheto" "nmos_sim" "schematic" "schematic" "w");<= modifiable
XY=0:0
pp='(("v2" "string" "1.8") ("tf" "string" "100.0f") ("tr" "string" "100.0f") ("per" "string" "1n"))
;v1=dbCreateInstByMasterName(cv "analogLib" "vpulse" "symbol" "V1" rodAddPoints(XY 0:0) "R0")
v1=dbCreateParamInstByMasterName(cv "analogLib" "vpulse" "symbol" "V1" rodAddPoints(XY 0:0) "R0" 1 pp)
param=cdfFindParamByName(cdfGetInstCDF(v1) "vdc") param~>value="vgs"
dbCreateInstByMasterName(cv "analogLib" "gnd" "symbol" nil rodAddPoints(XY 0:-0.375) "R0")
itp=getInstTermPoint(v1)
Pxy=cadr(assoc("PLUS" itp));=> (0.0 0.0)
wid=schCreateWire( cv "draw" "direct" list(Pxy rodAddPoints(Pxy 0:0.25)) 0.0625 0.0625 0.0125)
schCreateWireLabel(cv car(wid) rodAddPoints(Pxy -0.05:0.125) "vgs" "centerCenter" "R90" "euroStyle" 0.0625 nil)
XY=2:0
v2=dbCreateInstByMasterName(cv "analogLib" "vdc" "symbol" "V2" rodAddPoints(XY 0:0) "R0")
param=cdfFindParamByName( cdfGetInstCDF(v2) "vdc") param~>value="vds"
dbCreateInstByMasterName(cv "analogLib" "gnd" "symbol" nil rodAddPoints(XY 0:-0.375) "R0")
itp=getInstTermPoint(v2)
Pxy=cadr(assoc("PLUS" itp));=> (2.0 0.0)
wid=dbCreateLine( cv '("wire" "drawing") list(Pxy rodAddPoints(Pxy 0:.25)))
label=dbCreateLabel(cv '("wire" "label") rodAddPoints(Pxy -0.125:0.125) "vds" "centerCenter" "R0" "euroStyle" 0.0625 )
label~>parent=wid
XY=1:0
inst= dbCreateInstByMasterName(cv nplib nmos "symbol" "M1" rodAddPoints(XY 0:0) "R0")
; getPropList(inst)
pp='(("l" "string" "1u") ("w" "string" "400n"))
;;BUG _vv_ to comment ? _vv_
;;foreach(mapcar p pp param=cdfFindParamByName(cdfGetInstCDF(inst) car(p)) param~>value=nth(2 p))
itp=getInstTermPoint(inst) ;=> (("S" (1.25 -0.1875) ("pin" "drawing") ((1.225 -0.2125) (1.275 -0.1625))) ("G" (1.0 0.0) ("pin" "drawing") ((0.975 -0.025) (1.025 0.025))) ("B" (1.25 0.0) ("pin" "drawing") ((1.225 -0.025) (1.275 0.025))) ("D" (1.25 0.1875) ("pin" "drawing") ((1.225 0.1625) (1.275 0.2125))))
dbCreateInstByMasterName(cv "analogLib" "gnd" "symbol" nil rodAddPoints(XY 0.25:-0.1875) "R0")
aitp=assoc("S" itp);=> ("S" (1.25 -0.1875) ("pin" "drawing") ((1.225 -0.2125) (1.275 -0.1625)))
Sxy=cadr(aitp);=> (1.25 -0.1875)
Bxy=cadr(assoc("B" itp));=> (1.25 0.0)
Gxy=cadr(assoc("G" itp));=> (1.0 0.0)
Dxy=cadr(assoc("D" itp));=> (1.25 0.1875)
wid=schCreateWire( cv "draw" "direct" list(Sxy Bxy) 0.0625 0.0625 0)
wid=schCreateWire( cv "draw" "direct" list(Gxy rodAddPoints(Gxy -0.25:0)) 0.0625 0.0625 0)
schCreateWireLabel(cv car(wid) rodAddPoints(Gxy -0.125:0.05) "vgs" "centerCenter" "R0" "euroStyle" 0.0625 nil)
wid=schCreateWire( cv "draw" "direct" list(Dxy rodAddPoints(Dxy 0:.25)) 0.0625 0.0625 0)
schCreateWireLabel(cv car(wid) rodAddPoints(Dxy -0.125:0.125) "vds" "centerCenter" "R0" "euroStyle" 0.0625 nil)
;; TO BE CONTINUED
win=geOpenOrRaisecv(cv)
);let
);defun
;libmos=nth(1 rexFindCell("nmos4"))
;libmos=car(rexFindCell("nmos4"))
;libmos=nth(2 rexFindCell("nmos"));=> ("techno_blabla" "nmos")
;;libmos=car(rexFindCell("nch"))
;libmos=car(rexFindCell("MOS_N3"))
;nmos_sim(nil nth(1 libmos) nth(0 libmos) )
printf("USAGE : identify the transistor you want : nmos nmos4 nch nfet MOS_N3\n")
printf("USAGE : check correct library you want rexFindCell(\"nmos4\")\n")
printf("USAGE : if second Find is OK, define libmos=nth(1 rexFindCell(\"nmos4\"))\n")
printf("USAGE : if second Find is OK, define libmos=nth(0 rexFindCell(\"^nch$\"))\n")
printf("USAGE : inv_sim(nil '((\"nch\" \"pch\") \"tsmcN65\"))\n")
printf("USAGE : inv_sim(nil '((\"nmos1v\" \"pmos1v\") \"tsmc13rf\"))\n")
printf("USAGE : inv_sim(nil '((\"nmos_18\" \"pmos_18\") \"ts018_prim\"))\n")