bag.interface.skill

This module implements all CAD database manipulations using skill commands.

Module Contents

Classes

SkillInterface

Skill interface between bag and Virtuoso.

Functions

_dict_to_pcell_params(→ List[Any])

Convert given parameter dictionary to pcell parameter list format.

to_skill_list_str(→ str)

Convert given python list to a skill list string.

dict_to_item_list(→ List[List[str]])

Given a Python dictionary, convert to sorted item list.

format_inst_map(→ List[List[Any]])

Given instance map from DesignModule, format it for database changes.

bag.interface.skill._dict_to_pcell_params(table: Dict[str, Any]) List[Any][source]

Convert given parameter dictionary to pcell parameter list format.

Parameters:

table (Dict[str, Any]) – the parameter dictionary.

Returns:

param_list – the Pcell parameter list

Return type:

List[Any]

bag.interface.skill.to_skill_list_str(pylist: List[str]) str[source]

Convert given python list to a skill list string.

Parameters:

pylist (List[str]) – a list of string.

Returns:

ans – a string representation of the equivalent skill list.

Return type:

str

bag.interface.skill.dict_to_item_list(table: Dict[str, Any]) List[List[str]][source]

Given a Python dictionary, convert to sorted item list.

Parameters:

table (Dict[str, Any]) – a Python dictionary where the keys are strings.

Returns:

assoc_list – the sorted item list representation of the given dictionary.

Return type:

List[List[str]]

bag.interface.skill.format_inst_map(inst_map: Dict[str, Any]) List[List[Any]][source]

Given instance map from DesignModule, format it for database changes.

Parameters:

inst_map (Dict[str, Any]) – the instance map created by DesignModule.

Returns:

ans – the database change instance map.

Return type:

List[List[Any]]

class bag.interface.skill.SkillInterface(dealer: bag.interface.zmqwrapper.ZMQDealer, tmp_dir: str, db_config: Dict[str, Any], lib_defs_file: str)[source]

Bases: bag.interface.database.DbAccess

Skill interface between bag and Virtuoso.

This class sends all bag’s database and simulation operations to an external Virtuoso process, then get the result from it.

get_exit_object() Any[source]

Returns an object to send to the server to shut it down.

Return None if this option is not supported.

get_cells_in_library(lib_name: str) List[str][source]

Get a list of cells in the given library.

Returns an empty list if the given library does not exist.

Parameters:

lib_name (str) – the library name.

Returns:

cell_list – a list of cells in the library

Return type:

List[str]

create_library(lib_name: str, lib_path: str = '') None[source]

Create a new library if one does not exist yet.

Parameters:
  • lib_name (str) – the library name.

  • lib_path (str) – directory to create the library in. If Empty, use default location.

create_implementation(lib_name: str, template_list: Sequence[Any], change_list: Sequence[Any], lib_path: str = '') None[source]
configure_testbench(tb_lib: str, tb_cell: str) Tuple[str, List[str], Dict[str, str], Dict[str, str]][source]

Update testbench state for the given testbench.

This method fill in process-specific information for the given testbench.

Parameters:
  • tb_lib (str) – testbench library name.

  • tb_cell (str) – testbench cell name.

Returns:

  • cur_env (str) – the current simulation environment.

  • envs (List[str]) – a list of available simulation environments.

  • parameters (Dict[str, str]) – a list of testbench parameter values, represented as string.

  • outputs (Dict[str, str]) – a dictionary of output expressions

get_testbench_info(tb_lib: str, tb_cell: str) Tuple[List[str], List[str], Dict[str, str], Dict[str, str]][source]

Returns information about an existing testbench.

Parameters:
  • tb_lib (str) – testbench library.

  • tb_cell (str) – testbench cell.

Returns:

  • cur_envs (List[str]) – the current simulation environments.

  • envs (List[str]) – a list of available simulation environments.

  • parameters (Dict[str, str]) – a list of testbench parameter values, represented as string.

  • outputs (Dict[str, str]) – a list of testbench output expressions.

update_testbench(lib: str, cell: str, parameters: Dict[str, str], sim_envs: List[str], config_rules: List[List[str]], env_parameters: List[List[Tuple[str, str]]]) None[source]

Update the given testbench configuration.

Parameters:
  • lib (str) – testbench library.

  • cell (str) – testbench cell.

  • parameters (Dict[str, str]) – testbench parameters.

  • sim_envs (Sequence[str]) – list of enabled simulation environments.

  • config_rules (Sequence[List[str]]) – config view mapping rules, list of (lib, cell, view) rules.

  • env_parameters (Sequence[List[Tuple[str, str]]]) – list of param/value list for each simulation environment.

instantiate_layout_pcell(lib_name: str, cell_name: str, view_name: str, inst_lib: str, inst_cell: str, params: Dict[str, Any], pin_mapping: Dict[str, str]) None[source]

Create a layout cell with a single pcell instance.

Parameters:
  • lib_name (str) – layout library name.

  • cell_name (str) – layout cell name.

  • view_name (str) – layout view name, default is “layout”.

  • inst_lib (str) – pcell library name.

  • inst_cell (str) – pcell cell name.

  • params (Dict[str, Any]) – the parameter dictionary.

  • pin_mapping (Dict[str, str]) – the pin mapping dictionary.

create_schematics(lib_name: str, sch_view: str, sym_view: str, content_list: Sequence[Any], lib_path: str = '') None[source]

Create the given schematics in CAD database.

Precondition: the library already exists, all cellviews are writable (i.e. they have been closed already).

Parameters:
  • lib_name (str) – name of the new library to put the concrete schematics.

  • sch_view (str) – schematic view name.

  • sym_view (str) – symbol view name.

  • content_list (Sequence[Any]) – list of schematics to create.

  • lib_path (str) – the path to create the library in. If empty, use default location.

abstract create_layouts(lib_name: str, view: str, content_list: Sequence[Any]) None[source]

Create the given layouts in CAD database.

Precondition: the library already exists, all cellviews are writable (i.e. they have been closed already).

Parameters:
  • lib_name (str) – name of the new library to put the concrete schematics.

  • view (str) – layout view name.

  • content_list (Sequence[Any]) – list of layouts to create.

close_all_cellviews() None[source]

Close all currently opened cellviews in the database.

instantiate_layout(lib_name: str, content_list: Sequence[Any], lib_path: str = '', view: str = 'layout') None[source]

Create a batch of layouts.

Parameters:
  • lib_name (str) – layout library name.

  • content_list (Sequence[Any]) – list of layouts to create

  • lib_path (str) – the path to create the library in. If empty, use default location.

  • view (str) – layout view name.

release_write_locks(lib_name: str, cell_view_list: Sequence[Tuple[str, str]]) None[source]

Release write locks from all the given cells.

Parameters:
  • lib_name (str) – the library name.

  • cell_view_list (Sequence[Tuple[str, str]]) – list of cell/view name tuples.

refresh_cellviews(lib_name: str, cell_view_list: Sequence[Tuple[str, str]]) None[source]

Refresh the given cellviews in the database.

Parameters:
  • lib_name (str) – the library name.

  • cell_view_list (Sequence[Tuple[str, str]]) – list of cell/view name tuples.

perform_checks_on_cell(lib_name: str, cell_name: str, view_name: str) None[source]

Perform checks on the given cell.

Parameters:
  • lib_name (str) – the library name.

  • cell_name (str) – the cell name.

  • view_name (str) – the view name.

create_schematic_from_netlist(netlist: str, lib_name: str, cell_name: str, sch_view: str = '', **kwargs: Any) None[source]

Create a schematic from a netlist.

This is mainly used to create extracted schematic from an extracted netlist.

Parameters:
  • netlist (str) – the netlist file name.

  • lib_name (str) – library name.

  • cell_name (str) – cell_name

  • sch_view (Optional[str]) – schematic view name. The default value is implemendation dependent.

  • **kwargs (Any) – additional implementation-dependent arguments.

get_cell_directory(lib_name: str, cell_name: str) pathlib.Path[source]

Returns the directory name of the given cell.

Parameters:
  • lib_name (str) – library name.

  • cell_name (str) – cell name.

Returns:

cell_dir – path to the cell directory.

Return type:

Path

create_verilog_view(verilog_file: str, lib_name: str, cell_name: str, **kwargs: Any) None[source]

Create a verilog view for mix-signal simulation.

Parameters:
  • verilog_file (str) – the verilog file name.

  • lib_name (str) – library name.

  • cell_name (str) – cell name.

  • **kwargs (Any) – additional implementation-dependent arguments.

import_sch_cellview(lib_name: str, cell_name: str, view_name: str) None[source]

Recursively import the given schematic and symbol cellview.

Parameters:
  • lib_name (str) –

  • name. (library) –

  • cell_name (str) – cell name.

  • view_name (str) – view name.

import_design_library(lib_name: str, view_name: str) None[source]

Import all design templates in the given library from CAD database.

Parameters:
  • lib_name (str) – name of the library.

  • view_name (str) – the view name to import from the library.

abstract import_gds_file(gds_fname: str, lib_name: str, layer_map: str, obj_map: str, grid: bag.layout.routing.grid.RoutingGrid) None[source]
_import_design(lib_name: str, cell_name: str, view_name: str, cell_list: List[Tuple[str, str]]) None[source]

Recursive helper for import_design_library and import_sch_cellview.

parse_schematic_template(lib_name: str, cell_name: str, view_name: str) str[source]

Parse the given schematic template.

Parameters:
  • lib_name (str) – name of the library.

  • cell_name (str) – name of the cell.

  • view_name (str) – name of the view.

Returns:

template – the content of the netlist structure file.

Return type:

str

write_tech_info(tech_name: str, out_yaml: str) None[source]