Project

General

Profile

SPICE TEAM » History » Version 6

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

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