bag.simulation.base

This module handles high level simulation routines.

This module defines SimAccess, which provides methods to run simulations and retrieve results.

Module Contents

Classes

SimAccess

A class that interacts with a simulator.

SimProcessManager

An implementation of SimAccess using SubProcessManager.

EmSimAccess

A class that interacts with an EM simulator.

EmSimProcessManager

An implementation of EmSimAccess using SubProcessManager.

Functions

get_corner_temp(→ Tuple[str, int])

setup_corner(→ str)

get_bit_list(→ Sequence[str])

bag.simulation.base.get_corner_temp(env_str: str) Tuple[str, int][source]
bag.simulation.base.setup_corner(corner_str: str, temp: int) str[source]
bag.simulation.base.get_bit_list(pin: Union[str, Sequence[str]]) Sequence[str][source]
class bag.simulation.base.SimAccess(parent: str, sim_config: Mapping[str, Any])[source]

Bases: abc.ABC

A class that interacts with a simulator.

Parameters:
  • parent (str) – parent directory for SimAccess.

  • sim_config (Mapping[str, Any]) – the simulation configuration dictionary.

abstract property netlist_type: pybag.enum.DesignOutput[source]
property dir_path: pathlib.Path[source]

the directory for simulation files.

Type:

Path

property config: Mapping[str, Any][source]

simulation configurations.

Type:

Dict[str, Any]

abstract create_netlist(output_path: pathlib.Path, sch_netlist: pathlib.Path, info: bag.simulation.data.SimNetlistInfo, precision: int = 6) None[source]
abstract get_sim_file(dir_path: pathlib.Path, sim_tag: str) pathlib.Path[source]

Returns path to the simulation file.

abstract load_sim_data(dir_path: pathlib.Path, sim_tag: str) bag.simulation.data.SimData[source]

Load simulation results.

Parameters:
  • dir_path (Path) – the working directory path.

  • sim_tag (str) – optional simulation name. Empty for default.

Returns:

data – the simulation data dictionary.

Return type:

Dict[str, Any]

abstract async async_run_simulation(netlist: pathlib.Path, sim_tag: str) None[source]

A coroutine for simulation a testbench.

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

  • sim_tag (str) – optional simulation name. Empty for default.

run_simulation(netlist: pathlib.Path, sim_tag: str) None[source]
class bag.simulation.base.SimProcessManager(tmp_dir: str, sim_config: Mapping[str, Any])[source]

Bases: SimAccess, abc.ABC

An implementation of SimAccess using SubProcessManager.

Parameters:
  • tmp_dir (str) – temporary file directory for SimAccess.

  • sim_config (Dict[str, Any]) – the simulation configuration dictionary.

property manager: bag.concurrent.core.SubProcessManager[source]
class bag.simulation.base.EmSimAccess(parent: str, sim_config: Mapping[str, Any])[source]

Bases: abc.ABC

A class that interacts with an EM simulator.

Parameters:
  • parent (str) – parent directory for EmSimAccess.

  • sim_config (Mapping[str, Any]) – the simulation configuration dictionary.

property dir_path: pathlib.Path[source]

the directory for simulation files.

Type:

Path

property config: Mapping[str, Any][source]

simulation configurations.

Type:

Mapping[str, Any]

static _get_em_base_path(root_path: pathlib.Path) pathlib.Path[source]
get_log_path(root_path: pathlib.Path) pathlib.Path[source]

Path: the directory for simulation files.

abstract async async_gen_nport(cell_name: str, gds_file: pathlib.Path, params: Mapping[str, Any], root_path: pathlib.Path, run_sim: bool = False) pathlib.Path[source]

A coroutine for running EM sim to generate nport for the current module.

Parameters:
  • cell_name (str) – Name of the cell

  • gds_file (Path) – location of the gds file of the cell

  • params (Mapping[str, Any]) – various EM parameters

  • root_path (Path) – Root path for running sims and storing results

  • run_sim (bool) – True to run EM sim; False by default

Returns:

sp_file – location of generated s parameter file

Return type:

Path

run_simulation(cell_name: str, gds_file: pathlib.Path, params: Mapping[str, Any], root_path: pathlib.Path) None[source]
abstract process_output(cell_name: str, params: Mapping[str, Any], root_path: pathlib.Path) None[source]
class bag.simulation.base.EmSimProcessManager(tmp_dir: str, sim_config: Mapping[str, Any])[source]

Bases: EmSimAccess, abc.ABC

An implementation of EmSimAccess using SubProcessManager.

Parameters:
  • tmp_dir (str) – temporary file directory for EmSimAccess.

  • sim_config (Mapping[str, Any]) – the simulation configuration dictionary.

property manager: bag.concurrent.core.SubProcessManager[source]