Project

General

Profile

SPICE TEAM » History » Version 7

jun chen, 03/07/2025 12:20 AM

1 1 jun chen
# SPICE TEAM
2 6 jun chen
-------------------------------------------------------------------
3 7 jun chen
4 6 jun chen
## Some tips for piece(Ngspice) user (by Kramer)
5 1 jun chen
6 6 jun chen
For the hspice or other spice user, in-house spice simulator piece has many triky usags and I list some of them here.
7
8
1. About easurement
9
10
Both meas line at control block and outside of control block are supported, but both cannot support any complex expression as below
11
12
```
13
.meas tran vtest find par('v(n1)-v(n0)') at=40n
14
.meas tran ttest when v(n1) = 'v(0)+vdd'
15
```
16
The right way is
17
```
18
.control
19
let vdiff = v(n1)-v(n0)
20
let vtest = v(0)+vdd
21
meas tran vtest find vdiff at=40n
22
meas tran ttest when v(n1) = vtest
23
.endc
24
```
25
There are more useful measurement statements for example.
26
27
```
28
.control
29
* rhs of let statement cannot use the golbal parameter outside of control block while vdd is a special case!
30
let halfvdd = 'vdd/2'
31
let trans = {v(q)*v(cp)/vdd}
32
meas tran tran01 when tranx = 'halfvdd' rise=1
33
meas tran delay1 trig v(in) val='halfvdd' fall=1 targ v(zn) val = 'halfvdd' rise=1
34
print tran01 delay 1 > trans.txt
35
.endc
36
```
37
2. some useful options
38
```
39
.opt noopac  ; skip op when do ac analysis
40
.opt numdgt=9 ; set the output data's digital number to 9 (must set in control block, as *.control numdgt=9 .endc*)
41
*#set nobreak ; set output data file without page break
42
.opt maxord=1 method=trap trtol=1  ; options to get stable waveform without some ring (more accuracy)
43
```
44
45
The following lines to set autostop when v(zn) cloase to zero
46
```
47
.opt autostop
48
.meas tran tend when v(zn)='vss+1e-5' fall=1
49
```
50
51
3. about output file format
52
53
In control block, we can use print or wrdata to dump data to file.
54
```
55
print i(vp) i(cl_t) v(q) > dat1.txt
56
wrdata dat2.txt i(vp) i(cl_t) v(q)
57
```
58
59
The dat1.txt(left) and dat2.txt(right) as below:
60
61
![](clipboard-202503070017-nfx2n.png)
62
63 7 jun chen
4. alter usage
64
65
Wrong usage for altering C1's capacitance:
66
67
```
68
C1 1 0 'cload'
69
.control
70
alter C1=1p
71
tran 1p 10n
72
alter C1=1.2p
73
tran 1p 10n
74
.endc
75
```
76
77
The right way as below, in the above case, the latter simulation will be impacted by the former.
78
```
79
c1 1 0 'cload'
80
.control
81
alterparam cload = 1p
82
reset
83
tran 1p 10n
84
alterparam cload = 1.2p
85
reset
86
tran 1p 10n
87
.endc
88
```
89
90 6 jun chen
-----------------------------------------------------------------
91 7 jun chen
92 1 jun chen
## Reference SPICE center (Repository in 10.30.100.22/spice)
93
94 3 jun chen
## **ngSPICE**
95 4 jun chen
> Reference:  http://ngspice.sourceforce.net/docs.html
96
> User manual:  attachment:"ngspice-34-manual.pdf"
97
> Binary and library install guidance:  attachment:"ngspice_install.pptx"
98
> ngspice git clone: `git clone ssh://git@10.30.100.22:222/analog/spice.git`
99
> Local build binary with ngSpice 34: `/rnd1/jchen/ngspice34/agigaspice/release/bin/bin/ngspice`
100
> Example spice file: `/rnd1/jchen/ngspice34/agigaspice/examples`
101 3 jun chen
102 4 jun chen
## **spice3f5 元祖SPICE**
103
> attachment:"spice3f5.tar.gz"
104 1 jun chen
105 4 jun chen
## **cuSPICE, (CUDA ver. ngSPICE)**
106
> attachment:"CuSPICE.pdf"
107 5 jun chen
> Reference: SPICE on GPU:  http://ngspice.sourceforge.net/cuspice.html
108 1 jun chen
109
## **xyce** 
110 3 jun chen
> Xyce install method (Langyun):   attachment:"基于WSL的Ubuntu系统Serial Xyce编译整理.docx"
111 2 jun chen
> Reference: https://xyce.sandia.gov/
112
113 4 jun chen
##  **SPICE 历史** 
114
> attachment:"SPICE_history.docx"