(原创)Spice 网表范例

一、常规网表

Inverter 
.lib "D:libl0040ll_v1p4_1r.lib" TT

.param SUPPLY=1.1V
.param T=10ns
.param dt=0.02ns
.temp 25
.global VDD VSS
.option MEASDGT=3 post    *MEASDGT=3表示输出结果保留3位有效数字

VVDD VDD 0 'SUPPLY'

*********** 反相器 ****************
.subckt Inverter 
*Inputs
+ in 
*Supply
+ VDD GND 
*Outputs
+ out

XP1 out in VDD  VDD p11ll_ckt  W=200n  L=40n
XN1 out in GND  GND n11ll_ckt  W=120n  L=40n

.ends
********************************************

X_Inverter 
*Inputs
+ in 
*Supply
+ VDD GND 
*Outputs
+ out 
+ Inverter 

C_load out 0 1.5f

*Vin in 0 PWL(0n 0V,"T-dt" 0V , T SUPPLY , "2*T-dt" SUPPLY, "2*T" 0V , "3*T-dt" 0V)  *0-1-0
Vin in 0 PULSE(0 SUPPLY "T*0.5" 0n 0n "T*0.5" T)  _| ̄|_


*测量语句
.Measure tran V_in find V(in) when V(out)="0.1*SUPPLY" rise=1


.Measure tran pwr AVG P(VVDD) From=0ns To="3*T-dt"


.Measure tran Tr trig V(out) val='0.1*SUPPLY' rise=1
+                targ V(out) val='0.9*SUPPLY' rise=1 


*瞬态扫描语句
.tran 0.001n "6*T"  
*+ sweep monte=1
 + sweep SUPPLY 0.6V 1.1V 0.1V

*.print tran V(in) V(out)

.probe v(*)
.end

二、直流分析网表

HSPICE demo

.LIB ".cmos25_level49.lib" TT



.temp 25
.plot DC I(M0)


VVSS VSS 0 0
VVDS D VSS 0
VVGS G VSS 0.5

.dc VVDS 0 5 0.1 sweep VVGS 0.5 2.5 0.5
M0 D G VSS VSS nmos L=0.5u W=4.8u

.end

  打开生成的.sw0文件可以看到如下的波形:

Ids:

Vd:

Vg:

原文地址:https://www.cnblogs.com/wt-seu/p/7571728.html