VLSIR#

Thanks to VLSIR you can parse for KLayout’s gds-extracted netlist’s and convert it to Spectre, Spice and Xyce simulator schematic file formats

Simulator and Analysis Support#

Each spice-class simulator includes its own netlist syntax and opinions about the specification for analyses. See

Analysis

Spectre

Xyce

NgSpice

Op

Dc

Tran

Ac

Noise

Sweep

Monte Carlo

Custom

from io import StringIO

from gdsfactory.samples.demo.lvs import pads_correct

import gplugins.vlsir as gs
from gplugins.klayout.get_netlist import get_netlist
c = pads_correct()
c.plot()
../_images/c3b5f5c7a743ffaa876b2fa9793010810170af5201f5a6d2efdad7cb69ada2e5.png
gdspath = c.write_gds()

# get the netlist
kdbnetlist = get_netlist(gdspath)

# convert it to a VLSIR Package
pkg = gs.kdb_vlsir(kdbnetlist, domain="gplugins.klayout.example")
2024-05-10 10:34:40.454 | INFO     | gdsfactory.component:_write_library:2003 - Wrote to '/tmp/gdsfactory/pads_correct.gds'
Wrote '/home/runner/work/gplugins/gplugins/gplugins/klayout/layers.lyp'
Wrote '/home/runner/work/gplugins/gplugins/gplugins/klayout/d25/generic.lyd25'
Wrote '/home/runner/work/gplugins/gplugins/gplugins/klayout/tech.lyt'

Spectre RF#

out = StringIO()
gs.export_netlist(pkg, dest=out, fmt="spectre")
print(out.getvalue())
// `circuit.Package` `gplugins.klayout.example`
// Generated by `vlsirtools.SpectreNetlister`
// 

subckt straight_41ebfd0f 
  + 1 
  + // No parameters 
  
  
ends 

subckt straight_5ac9171b 
  + 1 
  + // No parameters 
  
  
ends 

subckt straight_96ebe305 
  + 1 
  + // No parameters 
  
  
ends 

subckt bend_euler_d6b78123 
  + 1 
  + // No parameters 
  
  
ends 

subckt straight_eeb28574 
  + 1 
  + // No parameters 
  
  
ends 

subckt pad 
  + 1 2 
  + // No parameters 
  
  
ends 

subckt pads_correct 
  + // No ports 
  + // No parameters 
  
  1
  + // Ports: 
  + ( tl,tr tl )
  +  pad 
  + // No parameters 
  
  2
  + // Ports: 
  + ( tl,tr tr )
  +  pad 
  + // No parameters 
  
  3
  + // Ports: 
  + ( bl,br br )
  +  pad 
  + // No parameters 
  
  4
  + // Ports: 
  + ( bl,br bl )
  +  pad 
  + // No parameters 
  
  5
  + // Ports: 
  + ( tl,tr )
  +  straight_96ebe305 
  + // No parameters 
  
  6
  + // Ports: 
  + ( tl,tr )
  +  bend_euler_d6b78123 
  + // No parameters 
  
  7
  + // Ports: 
  + ( tl,tr )
  +  straight_5ac9171b 
  + // No parameters 
  
  8
  + // Ports: 
  + ( tl,tr )
  +  bend_euler_d6b78123 
  + // No parameters 
  
  9
  + // Ports: 
  + ( tl,tr )
  +  straight_41ebfd0f 
  + // No parameters 
  
  10
  + // Ports: 
  + ( bl,br )
  +  straight_eeb28574 
  + // No parameters 
  
  
ends 

Xyce#

out = StringIO()
gs.export_netlist(pkg, dest=out, fmt="xyce")
print(out.getvalue())
; `circuit.Package` `gplugins.klayout.example`
; Generated by `vlsirtools.XyceNetlister`
; 

.SUBCKT straight_41ebfd0f
+ 1 
; No parameters

.ENDS

.SUBCKT straight_5ac9171b
+ 1 
; No parameters

.ENDS

.SUBCKT straight_96ebe305
+ 1 
; No parameters

.ENDS

.SUBCKT bend_euler_d6b78123
+ 1 
; No parameters

.ENDS

.SUBCKT straight_eeb28574
+ 1 
; No parameters

.ENDS

.SUBCKT pad
+ 1 2 
; No parameters

.ENDS

.SUBCKT pads_correct
; No ports
; No parameters

x1
+ tl,tr tl 
+ pad
+ ; No parameters

x2
+ tl,tr tr 
+ pad
+ ; No parameters

x3
+ bl,br br 
+ pad
+ ; No parameters

x4
+ bl,br bl 
+ pad
+ ; No parameters

x5
+ tl,tr 
+ straight_96ebe305
+ ; No parameters

x6
+ tl,tr 
+ bend_euler_d6b78123
+ ; No parameters

x7
+ tl,tr 
+ straight_5ac9171b
+ ; No parameters

x8
+ tl,tr 
+ bend_euler_d6b78123
+ ; No parameters

x9
+ tl,tr 
+ straight_41ebfd0f
+ ; No parameters

x10
+ bl,br 
+ straight_eeb28574
+ ; No parameters

.ENDS

ngspice#

out = StringIO()
gs.export_netlist(pkg, dest=out, fmt="spice")
print(out.getvalue())
* `circuit.Package` `gplugins.klayout.example`
* Generated by `vlsirtools.SpiceNetlister`
* 

.SUBCKT straight_41ebfd0f
+ 1 
* No parameters

.ENDS

.SUBCKT straight_5ac9171b
+ 1 
* No parameters

.ENDS

.SUBCKT straight_96ebe305
+ 1 
* No parameters

.ENDS

.SUBCKT bend_euler_d6b78123
+ 1 
* No parameters

.ENDS

.SUBCKT straight_eeb28574
+ 1 
* No parameters

.ENDS

.SUBCKT pad
+ 1 2 
* No parameters

.ENDS

.SUBCKT pads_correct
* No ports
* No parameters

x1
+ tl,tr tl 
+ pad
* No parameters


x2
+ tl,tr tr 
+ pad
* No parameters


x3
+ bl,br br 
+ pad
* No parameters


x4
+ bl,br bl 
+ pad
* No parameters


x5
+ tl,tr 
+ straight_96ebe305
* No parameters


x6
+ tl,tr 
+ bend_euler_d6b78123
* No parameters


x7
+ tl,tr 
+ straight_5ac9171b
* No parameters


x8
+ tl,tr 
+ bend_euler_d6b78123
* No parameters


x9
+ tl,tr 
+ straight_41ebfd0f
* No parameters


x10
+ bl,br 
+ straight_eeb28574
* No parameters


.ENDS