How to simulate an ideal op-amp, delay and switch in HSPICE?

Status
Not open for further replies.

yen

Member level 5
Joined
Apr 21, 2005
Messages
85
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
2,230
How do i simulation ideal op amp, ideal delay and ideal switch?
Thank you.
 

hspice ideal switch

refer to hspice manual--> performing Behavioral simulation.
 

hspice vcr

Hi.
I think for using ideal opamp you can refer to Exxx instruction (or whatever it is called). in someway which I can't remember exactly, you could change it to an opamp. ideal switch is implemented by using Gxxx instruction. but for ideal delay, I have no idea.

Regards,
EZT
 

hspice vcr pwl

This is my code.

G11 1 2 VCR PWL(l) s1 0 0V ,10meg 2.5V,1m
G12 3 0 VCR PWL(l) s1 0 0V ,10meg 2.5V,1m
G13 5 0 VCR PWL(l) s1 0 0V ,10meg 2.5V,1m
G14 4 6 VCR PWL(l) s1 0 0V ,10meg 2.5V,1m
G15 7 0 VCR PWL(l) s1 0 0V ,10meg 2.5V,1m
G16 10 0 VCR PWL(l) s1 0 0V ,10meg 2.5V,1m

G21 2 0 VCR PWL(2) s2 0 0V ,10meg 2.5V,1m
G22 5 4 VCR PWL(2) s2 0 0V ,10meg 2.5V,1m
G23 6 0 VCR PWL(2) s2 0 0V ,10meg 2.5V,1m
G24 7 8 VCR PWL(2) s2 0 0V ,10meg 2.5V,1m
G25 10 9 VCR PWL(2) s2 0 0V ,10meg 2.5V,1m

C1 2 3 1p
C2 3 5 1p
C3 3 4 22.523p
C4 6 7 1p
C5 7 10 1p
C6 8 9 22.523p
C7 3 10 1p

E1 0 3 opamp 4 0
E2 0 8 opamp 9 0



vin vi 1 0
vout vo 9 0

vs1 s1 0 pulse (0 2.5 0u 5u 5u 7u 20u)
vs2 s2 0 pulse (0 2.5 10u 5u 5u 7u 20u)

.option acct
.op
.tran 0.1n 20u

.temp 25
.end

This is error.
g11 1 2 vcr pwl(l) s1 0 0v ,10meg 2.5v,1m

**error**: value is missing or is nonpositive
tokin number= 6
g12 3 0 vcr pwl(l) s1 0 0v ,10meg 2.5v,1m

**error**: value is missing or is nonpositive
tokin number= 6
g13 5 0 vcr pwl(l) s1 0 0v ,10meg 2.5v,1m

**error**: value is missing or is nonpositive
tokin number= 6
g14 4 6 vcr pwl(l) s1 0 0v ,10meg 2.5v,1m

**error**: value is missing or is nonpositive
tokin number= 6
g15 7 0 vcr pwl(l) s1 0 0v ,10meg 2.5v,1m

**error**: value is missing or is nonpositive
tokin number= 6
g16 10 0 vcr pwl(l) s1 0 0v ,10meg 2.5v,1m


**error**: value is missing or is nonpositive
tokin number= 6
g21 2 0 vcr pwl(2) s2 0 0v ,10meg 2.5v,1m

**error**: dimension of piecewise linear function must be one
g22 5 4 vcr pwl(2) s2 0 0v ,10meg 2.5v,1m

**error**: dimension of piecewise linear function must be one
g23 6 0 vcr pwl(2) s2 0 0v ,10meg 2.5v,1m

**error**: dimension of piecewise linear function must be one
g24 7 8 vcr pwl(2) s2 0 0v ,10meg 2.5v,1m

**error**: dimension of piecewise linear function must be one
g25 10 9 vcr pwl(2) s2 0 0v ,10meg 2.5v,1m

I don't know what is wrong.
I want to simulation switch capacitor filter by hspice.
how do i do?
thank you
 

pwl(1) hspice

G11 1 2 VCR PWL(l) s1 0 0V ,10meg 2.5V,1m
G21 2 0 VCR PWL(2) s2 0 0V ,10meg 2.5V,1m
using G as a switch , PWL(1) should be used, not PWL(l) or PWL(2)
 

pwl(1) spice

Can you tell detail?
How to use pwl(1)?
I have two switch Φ1 and Φ2.
I simulate sc filter.
How do i do?
Thank you.


This is my code.
But it's wrong.Can you tell me where is wrong?
please tell me detail.
.global vdd vss
v vdd gnd 2.5V
v1 vss gnd -2.5V

Gs11 1 2 VCR s1 0 0v,100meg 2.5v,1m
Vp1 s1 0 pulse (0 2.5 0u 5u 5u 7u 20u)
Gs12 3 0 VCR s2 0 0v,100meg 2.5v,1m
Vp2 s2 0 pulse (0 2.5 0u 5u 5u 7u 20u)
Gs13 5 0 VCR s3 0 0v,100meg 2.5v,1m
Vp3 s3 0 pulse (0 2.5 0u 5u 5u 7u 20u)
Gs14 4 6 VCR s4 0 0v,100meg 2.5v,1m
Vp4 s4 0 pulse (0 2.5 0u 5u 5u 7u 20u)
Gs15 7 0 VCR s5 0 0v,100meg 2.5v,1m
Vp5 s5 0 pulse (0 2.5 0u 5u 5u 7u 20u)
Gs16 10 0 VCR s6 0 0v,100meg 2.5v,1m
Vp6 s6 0 pulse (0 2.5 0u 5u 5u 7u 20u)

Gs21 2 0 VCR s7 0 0V ,100meg 2.5V,1m
Vp7 s7 0 pulse (0 -2.5 0u 5u 5u 7u 20u)
Gs22 5 4 VCR s8 0 0V ,100meg 2.5V,1m
Vp8 s8 0 pulse (0 -2.5 0u 5u 5u 7u 20u)
Gs23 6 0 VCR s9 0 0V ,100meg 2.5V,1m
Vp9 0 s9 pulse (0 -2.5 0u 5u 5u 7u 20u)
Gs24 7 8 VCR s10 0 0V ,100meg 2.5V,1m
Vp10 0 s10 pulse (0 -2.5 0u 5u 5u 7u 20u)
Gs25 10 9 VCR s11 0 0V ,100meg 2.5V,1m
Vp11 0 s11 pulse (0 -2.5 0u 5u 5u 7u 20u)

C1 2 3 1p
C2 3 5 1p
C3 3 4 22.523p
C4 6 7 1p
C5 7 10 1p
C6 8 9 22.523p
C7 3 10 1p

E1 0 3 opamp 4 0
*E2 9 0 0 8
E2 0 8 opamp 9 0

vin 1 0 ac 1V
vout 9 0 0

*vphi s0 0 pulse (-2.5 2.5 0u 5u 5u 7u 20u)
*Vp1 s1 0 pulse (-2.5 2.5 0u 5u 5u 7u 20u)
*Vp2 0 s2 pulse (-2.5 2.5 0u 5u 5u 7u 20u)

.option acct
.op
.ac dec 10 1 1MEG
*.tran 0.1n 20u
.temp 25
.end
 

spice pwl error -- missing value

u can check the manual of hspice
the attachment is from hspice manual.
 
hspice tokin

Sorry ,I simulate sc filter so i have many questions.
This is problem. How do i correct?
How do I measure frquency response?


**warning**: the following singular supplies were terminated to 1 meg resistor
supply node1 node2
v 0:vdd defined in subckt 0 0:0 defined in subckt 0
v1 0:vss defined in subckt 0 0:0 defined in subckt 0



*error*: maximum conductance on node 0:vout =( 1.0000D-25)
is less than pivtol. check hookup for this node. set option nopiv and rerun.

node = vout defn=main_ckt
no convergence with standard algorithm, trying damped pseudo-transient


*error*: maximum conductance on node 0:vout =( 1.0000D-25)
is less than pivtol. check hookup for this node. set option nopiv and rerun.

node = vout defn=main_ckt
 

missing probe

as I know, the AC response of SC ckt can only be simulated by behavior simulator such as SWITCAP. but I don't know where to get it.
if u want hspice to run the AC response , u should first model ur switch and "non-overlapped clock" , especially the clock, it is definitely in time domain but used in frequency domain analysis. which will be wrong in AC analysis.
if u want do that, u should first do some transfom on ur clock ,
such as clock ==> (1-exp(-jwT))/(jw), but it is still difficult.
 

tokin number

*.global vdd *vss
*v vdd gnd 2.5V
*v1 vss gnd -2.5V

.OPTIONS POST PROBE
.GLOBAL s1 s2

.tran 0.1u 4m

.ac lin 10 1 4000

.probe ac vdb(4) vdb(out) vp(4) vp(out) v(s1) v(s2) v(in) vp(s1) vp(s2) vp(in)
.probe tran v(in) v(s1) v(4) v(s2) v(out)

vin in 0 dc 0 ac 1
*Vin in 0 dc 0 ac 1 1Meg
*vin in 0 dc 0 ac 1

Vphi1 s1 0 pulse(-2.5,2.5 0u,0.1n,0.1n,5u,10u)
Vphi2 s2 0 pulse(2.5,-2.5 0u,0.1n,0.1n,5u,10u)

Vphi1 s1 0 sin(0 2.5 100k 5u)
Vphi2 s2 0 sin(0 2.5 100k)

*.SUBCKT sc in out

Gs11 in 2 VCR PWL(1) s1 0 -1v,10000meg 1v,0.1m
Gs12 3 0 VCR PWL(1) s1 0 -1v,10000meg 1v,0.1m
Gs13 5 0 VCR PWL(1) s1 0 -1v,10000meg 1v,0.1m
Gs14 4 6 VCR PWL(1) s1 0 -1v,10000meg 1v,0.1m
Gs15 7 0 VCR PWL(1) s1 0 -1v,10000meg 1v,0.1m
Gs16 10 0 VCR PWL(1) s1 0 -1v,10000meg 1v,0.1m

Gs21 2 0 VCR PWL(1) s2 0 -1V,10000meg 1V,0.1m
Gs22 5 4 VCR PWL(1) s2 0 -1V,10000meg 1V,0.1m
Gs23 6 0 VCR PWL(1) s2 0 -1V,10000meg 1V,0.1m
Gs24 7 8 VCR PWL(1) s2 0 -1V,10000meg 1V,0.1m
Gs25 10 out VCR PWL(1) s2 0 -1V,10000meg 1V,0.1m

C1 2 3 1m
C2 3 5 1m
C3 3 4 22.523m
C4 6 7 1m
C5 7 10 1m
C6 8 out 22.523m
C7 3 10 1m

E1 4 0 opamp 0 3
E2 out 0 opamp 0 8

*.ENDS

*vphi s0 0 pulse (-2.5 2.5 0u 5u 5u 7u 20u)
*Vp1 s1 0 pulse (-2.5 2.5 0u 5u 5u 7u 20u)
*Vp2 s2 0 pulse (-2.5 2.5 0u 5u 5u 7u 20u)
*.option acct
*.op
*.ac dec 10 1 1MEG
*.tran 0.1n 20u
*.temp 25

.end

This is my code.
But i want to see frquency response(output's phase and magnitude)
how do i do ?
thank you.
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…