Continue to Site

# Implementing a switch in HSPICE

Status
Not open for further replies.

#### sharas

##### Member level 4
Hi,

Does anybody know how to implement a switch that switches as a function of time in HSPICE?

I would be gratefull,

Thanks,

Sharas

use E element. check hspice reference manual for syntax.

You can used a voltage controlled resistor.
in the syntax below, phi1 is the control signal
and the switch connects 2 nodes, vin and vout.
the resistance between the 2 nodes is 100G ohms when phi1 is 0 volts.
When phi1 reaches 5 volts, the resistance is 1 mOhm = 0.001 ohm.

G1 vin vout VCR PWL(1) phi1 0 0,100G 5,1m

you can also refer here:
https://www.seas.upenn.edu/~jan/spice/spice.overview.html#Switches

Good luck.

elec_hi

Points: 2

### elec_hi

Points: 2
eecs4ever is correct E element is different as i suggested previously. its G element.

### sharas

Points: 2
eecs4ever said:
You can used a voltage controlled resistor.
in the syntax below, phi1 is the control signal
and the switch connects 2 nodes, vin and vout.
the resistance between the 2 nodes is 100G ohms when phi1 is 0 volts.
When phi1 reaches 5 volts, the resistance is 1 mOhm = 0.001 ohm.

G1 vin vout VCR PWL(1) phi1 0 0,100G 5,1m

you can also refer here:
h**p://www.seas.upenn.edu/~jan/spice/spice.overview.html#Switches

Good luck.
Thanks,

but Isn't there a way to do a time controlled resistor?

You can make a voltage waveform that depends on time. Call this signal phi1, and use this voltage to control the value of the resistor.

now you have a time dependent resistance.

To make a voltage waveform that depends on time,
you have multiple options.

1. the PWL function :
https://www.seas.upenn.edu/~jan/spice/spice.overview.html#Piecewise
2. the Pulse Function:
https://www.seas.upenn.edu/~jan/spice/spice.overview.html#Pulse

If the behavior is periodic, then its probably easier to use the Pulse function.

good luck!

Points: 2