piel.integration.gdsfactory_hdl21.conversion#
sax has very good GDSFactory integration functions, so there is a question on whether implementing our own circuit construction, and SPICE netlist parser from it, accordingly. We need in some form to connect electrical measurement to our parsed netlist, in order to apply SPICE passive values, and create connectivity for each particular device. Ideally, this would be done from the component instance as that way the component model can be integrated with its geometrical parameters, but does not have to be done necessarily. This comes down to implementing a backend function to compile SAX compiled circuit.
Functions#
|
Convert from: |
|
This function returns a list of tuples that match the names of the connections. |
|
|
|
This function allows us to map the |
|
Not for the hdl21 design flow, but useful for other SPICE level conversions. |
Module Contents#
- convert_connections_to_tuples(connections: dict)[source]#
Convert from:
{ 'straight_1,e1': 'taper_1,e2', 'straight_1,e2': 'taper_2,e2', 'taper_1,e1': 'via_stack_1,e3', 'taper_2,e1': 'via_stack_2,e1' }
to:
[(('straight_1', 'e1'), ('taper_1', 'e2')), (('straight_1', 'e2'), ('taper_2', 'e2')), (('taper_1', 'e1'), ('via_stack_1', 'e3')), (('taper_2', 'e1'), ('via_stack_2', 'e1'))]
- get_matching_connections(names: list, connections: dict)[source]#
This function returns a list of tuples that match the names of the connections.
- Parameters:
names – List of names to match
connections – Dictionary of connections to match
- Returns:
List of tuples that match the names of the connections
- gdsfactory_netlist_with_hdl21_generators(gdsfactory_netlist: dict, generators=None)[source]#
This function allows us to map the
hdl21measurement dictionary in a sax-like implementation to theGDSFactorynetlist. This allows us to iterate over each instance in the netlist and construct a circuit after this function.]Example usage:
>>> import gdsfactory as gf >>> from piel.integration.gdsfactory_hdl21.conversion import gdsfactory_netlist_with_hdl21_generators >>> from piel.measurement.physical.electronic import get_default_models >>> gdsfactory_netlist_with_hdl21_generators(gdsfactory_netlist=gf.components.mzi2x2_2x2_phase_shifter().get_netlist(exclude_port_types="optical"),generators=get_default_models())
- Parameters:
gdsfactory_netlist – The netlist from
GDSFactoryto map to thehdl21measurement dictionary.generators – The
hdl21measurement dictionary to map to theGDSFactorynetlist.
- Returns:
The
GDSFactorynetlist with thehdl21measurement dictionary.
- gdsfactory_netlist_to_spice_string_connectivity_netlist(gdsfactory_netlist: dict, models=None)[source]#
Not for the hdl21 design flow, but useful for other SPICE level conversions.
This function maps the connections of a netlist to a node that can be used in a SPICE netlist. SPICE netlists are in the form of:
RXXXXXXX N1 N2 <VALUE> <MNAME> <L=LENGTH> <W=WIDTH> <TEMP=T>
This means that every instance, is an electrical type, and we define the two particular nodes in which it is connected. This means we need to convert the gdsfactory dictionary netlist into a form that allows us to map the connectivity for every instance. Then we can define that as a line of the SPICE netlist with a particular electrical model. For passives this works fine when it’s a two port network such as sources, or electrical elements. However, non-passive elements like transistors have three connection or more which are provided in an ordered form.
This means that the order of translations is as follows:
1. Extract all instances and required measurement from the netlist, and assign the corresponding parameters on instantiation. 2. Verify that the measurement have been provided. Each model describes the type of component this is, how many connection it requires and so on. 3. Map the connections to each instance port as part of the instance dictionary.
We should get as an output a dictionary in the structure:
{ instance_1: { ... "connections": [('straight_1,e1', 'taper_1,e2'), ('straight_1,e2', 'taper_2,e2')], 'spice_nets': {'e1': 'straight_1__e1___taper_1__e2', 'e2': 'straight_1__e2___taper_2__e2'}, 'spice_model': <function piel.measurement.physical.electronic.spice.resistor.basic_resistor()>}, } ... }