Definition

class spydrnet_physical.ir.definition.Definition(name=None, properties=None)[source]

Bases: spydrnet.ir.Definition

Extending the definitions representation

Methods:

__init__

Creates an empty object of type definition

remove_cable

Remove a cable from the definition.

remove_port

Remove port from the definition.

create_ft_ports

Alias to create_feedthroughs_ports

create_feedthroughs_ports

Given the cable object it creates a feedthrough ports on this definition

create_feedthrough

Creates a feedthrough for a single cable passing through list of instances

create_ft_multiple

Alias to create_feedthrough_multiple

create_feedthrough_multiple

This creates feedthough from list of instances on multiple locations Expects the list of tuples in following format

merge_multiple_instance

This method can merge multiple group of instances having same order of reference definition.

merge_instance

Merges the list of instances to unique definition

OptPins

This method optimizes the definitions pins bu inspecting all the instances of the definition

OptWires

List the wires which can be optimised based on different constraints

duplicate_port

Duplicates existing port in the definition Uses assign block beetween to short two cables If post in output port assign new_port = initial_port else assign initial_port = new_port

combine_cables

Combines multiple cables to new cable.

combine_ports

This method can combine multiple input or output ports togther to create a bus structure.

create_unconn_wires

split_port

Split the given port

flatten_instance

Flatterns single instance in the given definition

get_connectivity_network

This method converts current module into networkx graph each cell is represented as as node and nets are represented as edges

make_instance_unique

clone the definition and point the reference to the new definition

add_buffer

Adds buffer on the given net :Parameters: * wire (sdn.Wire, sdn.Cable) -- Cable or a wire to be buffered * buffer (str) * instance_name (sdn.Instance) * ports tuple (str, str)

add_cable

Add a cable to the definition.

add_child

Add an existing instance to the definition.

add_port

Add a preexisting port to the definition.

clone

Clone the definition in an api safe way.

create_cable

Create a cable, add it to the definition, and return the cable.

create_child

Create an instance to add to the definition, add it, and return the instance.

create_port

Create a port, add it to the definition, and return that port.

get

get the item from the data structure

get_cables

Shortcut to get_cables().

get_definitions

Shortcut to get_definitions().

get_hcables

Shortcut to get_hcables().

get_hinstances

Shortcut to get_hinstances().

get_hpins

Shortcut to get_hpins().

get_hports

Shortcut to get_hports().

get_hwires

Shortcut to get_hwires().

get_instances

Shortcut to get_instances().

get_libraries

Shortcut to get_libraries().

get_netlists

Shortcut to get_netlists().

get_pins

Shortcut to get_pins().

get_ports

Shortcut to get_ports().

get_wires

Shortcut to get_wires().

is_leaf

Check to see if this definition represents a leaf cell.

pop

pop the object from the data structure

remove_cables_from

Remove a set of cables from the definition.

remove_child

Remove an instance from the definition.

remove_children_from

Remove a set of instances from the definition.

remove_ports_from

Remove a set of ports from the definition.

somhing

Attributes:

utilization

Return utilization of this module

area

cables

Get the cables that are instanced in this definition.

children

Return a list of all instances instantiated in this definition

data

Data stores information about the element

get_index

Returns python index of element

get_verilog_index

Returns verilog index of element

library

Get the library that contains this definition

name

The name of this element

ports

Get the ports that are instanced in this definition

properties

Returns properties of the object

references

Get a list of all the instances of this definition

__init__(name=None, properties=None)[source]

Creates an empty object of type definition

Parameters
  • name - (str) the name of this instance

  • properties - (dict) the dictionary which holds the properties

property utilization

Return utilization of this module

remove_cable(cable)[source]

Remove a cable from the definition.

The cable must be a member of the definition.

Parameters

cable - (Cable) the cable to be removed from the definition

remove_port(port)[source]

Remove port from the definition. (Overrides the base method)

Parameters

port ((Port) the port to be removed, must be of this definition)

create_ft_ports(*args, **kwargs)[source]

Alias to create_feedthroughs_ports

create_feedthroughs_ports(cable, suffix='ft', get_port_names=<function Definition.<lambda>>)[source]

Given the cable object it creates a feedthrough ports on this definition

  • The new ports names as {cable_name}_{suffix}_in and {cable_name}_{suffix}_out - Direct assignment is created beetween newly added two ports

Parameters
  • cable (Port) – The cable for which feedthrough needs to be created

  • suffix (str) – Sufffix used for the port naming

  • get_port_names (callable) – function to return custom names get_port_names(sdn.IN or sdn.out)

Returns

Feedthrough port (inport and outport)

Return type

tuple

create_feedthrough(instances_list, cable, get_port_names=<function Definition.<lambda>>, get_cable_names=<function Definition.<lambda>>)[source]

Creates a feedthrough for a single cable passing through list of instances

The driver cable name is unchanged and newly created feedthrough cable name {cable_name}_ft_{indx}

Parameters
  • instances_list (list[instance]) – List of instances to create feedthrough from

  • cable (Cable) – cable fro which feedthrough needs to be creared

  • get_port_names (callable) – –

  • get_cable_names (callable) – –

Returns

List of newly created cables in order

Return type

list(Cable)

create_ft_multiple(*args, **kwargs)[source]

Alias to create_feedthrough_multiple

create_feedthrough_multiple(instances_list)[source]

This creates feedthough from list of instances on multiple locations Expects the list of tuples in following format

Parameters

instances_list ([(Cable, (inst1, inst1, … .instn), …) – (Cable, (inst1, inst1, … .instn))]

merge_multiple_instance(instances_list_tuple, new_definition_name=None, pin_map=None)[source]

This method can merge multiple group of instances having same order of reference definition.

First pair of the instances_list_tuple is used to create new definition and that is reused while grouping remaining group of instances

Parameters
  • instances_list_tuple = [ (inst_1, inst_2, …., inst_n)

  • new_definition_name (str)

  • pin_map (Callable)

merge_instance(instances_list, new_definition_name='', new_instance_name='', pin_map=None)[source]

Merges the list of instances to unique definition

Parameters
  • instances_list (List(Instance)) – List of instances to be merged

  • new_definition_name – Name of the new definition created

  • new_instance_name – Name of the new instance created

  • pin_map (Callable, Dict) – External function to map new pin name based in definition and instance name get_pin_name(<definition_name:<str>, <pin_name:<str>, <instance_name:<str>)

Returns

(Definition, Instance, Dict)

OptPins(pins=<function Definition.<lambda>>, dry_run=False, merge=True, absorb=True)[source]

This method optimizes the definitions pins bu inspecting all the instances of the definition

Parameters
  • dry_run (Just performs the dryrun and list the pins which can be merged or absorbed)

  • pins (only consider specific pins, provide filter function)

  • absorb (if two pins are only connected to each other they will be absorbed and internal connection will be made)

  • merge (if two pins are connected to each other and few other instances, one of the pin will be absorbed and other will exist)

OptWires(no_load=True, no_driver=False, floating=True)[source]

List the wires which can be optimised based on different constraints

Parameters
  • no_load ((bool) (Default: True) Wires without load pin)

  • no_driver ((bool) (Default: False) Wires without drivers pin)

  • floating ((bool) (Default: True) Wires without any connection to pin)

duplicate_port(port, port_name=None)[source]

Duplicates existing port in the definition Uses assign block beetween to short two cables If post in output port assign new_port = initial_port else assign initial_port = new_port

Parameters
  • port ((Port) Port of this definition)

  • port_name ((str) Options New port name (default {port_name}_dup))

combine_cables(new_cable_name, cables, quiet=False)[source]

Combines multiple cables to new cable. Helpful in creating Bus/Vector from scalar wires

Parameters
  • new_cable_name ((str) New cable name)

  • cables ((list[Cable]) List of cables)

  • quiet ((bool) Do not raise error if no cables are passed)

combine_ports(port_name, ports)[source]

This method can combine multiple input or output ports togther to create a bus structure.

It does create a cable for internal wires, but does not change anything about the external wire connection ports[0] will be newport[0] default properties will be used for creating a new port

Parameters
  • port_name (str) – Name of the new port

  • ports (list[Ports]) – List of ports to combine

Returns

return new port and internal cable

Return type

(new_port, new_cable)

split_port(port)[source]

Split the given port

Parameters

port (Port) – Definition port to split into independent pins

flatten_instance(instance)[source]

Flatterns single instance in the given definition

get_connectivity_network(get_weights=None, split_ports=False)[source]

This method converts current module into networkx graph each cell is represented as as node and nets are represented as edges

  • Netowrkx should be installed

  • Higher fanout nets are represented with independent edge from driver

to each load

make_instance_unique(instance, new_name, instance_list=())[source]

clone the definition and point the reference to the new definition

add_buffer(wire, buffer, instance_name, ports=('A', 'Y'))[source]

Adds buffer on the given net :Parameters: * wire (sdn.Wire, sdn.Cable) – Cable or a wire to be buffered

  • buffer (str)

  • instance_name (sdn.Instance)

  • ports tuple (str, str)