* OSDI codegen self-test -- PDK-free, generic made-up coefficients.
*
* A voltage-dependent resistor and a voltage-dependent capacitor, written as
* behavioral value expressions. The parse-time OSDI transform must compile them
* into native compiled-C OSDI devices (log shows "-> N C-OSDI model(s)"), and
* the analyses must run to completion. Contains NO foundry data.
*
* Expected: op current i(vr) = -V / [r0*(1+k*V^2)] = -1/(1000*1.1) = -9.0909e-4 A.

.param r0=1000 k=0.1 c0=1e-12 vc=0.05

* --- voltage-dependent resistor: R(v) = r0*(1 + k*v(a,0)^2) --------------------
vr a 0 dc 1
Rtest a 0 R='r0*(1 + k*v(a,0)*v(a,0))'

* --- voltage-dependent capacitor: C(v) = c0*(1 + vc*v(x,0)) --------------------
vx n 0 dc 0 pulse(0 1 1n 1n 1n 20n 40n)
Rin n x 1k
Ctest x 0 c='c0*(1 + vc*v(x,0))'

.control
op
print i(vr)
tran 0.5n 40n
print v(x)
.endc
.end
