NativeInstanceTemplate class#
- class laygo2.object.template.NativeInstanceTemplate(libname, cellname, bbox=array([[0, 0], [0, 0]]), pins=None)[source]#
Bases:
Template
NativeInstanceTemplate class implements the template that generate Instance.
Public Data Attributes:
libname
Library name.
cellname
Cell name.
Inherited from
Template
name
Template name.
Public Methods:
__init__
(libname, cellname[, bbox, pins])Constructor function.
summarize
()Return the summary of the object information.
bbox
([params])Bounding box of the object.
pins
([params])Dictionary storing pins of the object.
generate
([name, shape, pitch, transform, ...])Generate Instance object.
export_to_dict
()Return a dictionary containing the template information.
Inherited from
Template
__init__
([name])The constructor function.
__str__
()Return a string representation of this template's information.
summarize
()Return the summary of the template information.
height
([params])int: Return the height of the template.
width
([params])int: Return the width of the template.
size
([params])int: Return the size of the template.
bbox
([params])numpy.ndarray: (Abstract method) the physical bounding box of the template.
pins
([params])dict: (Abstract method) Dictionary storing the pins of the template.
generate
([name, shape, pitch, transform, ...])instance: (Abstract method) Generate an instance from the template.
- __init__(libname, cellname, bbox=array([[0, 0], [0, 0]]), pins=None)[source]#
Constructor function.
- Parameters:
libname (str) – Library name.
cellname (str) – Cell name.
bbox (numpy.ndarray) – Bounding box of the object.
pins (dict) – Dictionary storing the template’s pin objects.
- Return type:
Example
>>> from laygo2.object.physical import Pin >>> from laygo2.object.template import NativeInstanceTemplate >>> p = dict() >>> p['i'] = Pin(xy=[[0, 0], [10, 10]], layer=['M1', 'drawing'], netname='i') >>> p['o'] = Pin(xy=[[90, 90], [100, 100]], layer=['M1', 'drawing'], netname='o') >>> nt = NativeInstanceTemplate(libname='mylib', cellname='mytemp', bbox=[[0, 0], [100, 100]], pins=p) <laygo2.object.template.NativeInstanceTemplate object> >>> print(nt) <laygo2.object.template.NativeInstanceTemplate object at 0x0000013C01..> name: mytemp, class: NativeInstanceTemplate, bbox: [[0, 0], [100, 100]], pins: {'i': <laygo2.object.physical.Pin object at 0x0000013C01CEFDC0>, 'o': <laygo2.object.physical.Pin object at 0x0000013C01C30BE0>},
- bbox(params=None)[source]#
Bounding box of the object.
- Parameters:
None
- Return type:
Example
>>> from laygo2.object.physical import Pin >>> from laygo2.object.template import NativeInstanceTemplate >>> p = dict() >>> p['i'] = Pin(xy=[[0, 0], [10, 10]], layer=['M1', 'drawing'], netname='i') >>> p['o'] = Pin(xy=[[90, 90], [100, 100]], layer=['M1', 'drawing'], netname='o') >>> nt = NativeInstanceTemplate(libname='mylib', cellname='mytemp', bbox=[[0, 0], [100, 100]], pins=p) >>> nt.bbox() array([[ 0, 0], [100, 100]])
- export_to_dict()[source]#
Return a dictionary containing the template information.
- Parameters:
None
- Return type:
See also
Class
Example
>>> from laygo2.object.physical import Pin >>> from laygo2.object.template import NativeInstanceTemplate >>> p = dict() >>> p['i'] = Pin(xy=[[0, 0], [10, 10]], layer=['M1', 'drawing'], netname='i') >>> p['o'] = Pin(xy=[[90, 90], [100, 100]], layer=['M1', 'drawing'], netname='o') >>> nt = NativeInstanceTemplate(libname='mylib', cellname='mytemp', bbox=[[0, 0], [100, 100]], pins=p) >>> nt.export_to_dict() {'libname': 'mylib', 'cellname': 'mytemp', 'bbox': [[0, 0], [100, 100]], 'pins': {'i': {'xy': [[0, 0], [10, 10]], 'layer': ['M1', 'drawing'], 'name': None, 'netname': 'i'}, 'o': {'xy': [[90, 90], [100, 100]], 'layer': ['M1', 'drawing'], 'name': None, 'netname': 'o'} } }
- generate(name=None, shape=None, pitch=None, transform='R0', netmap=None, params=None)[source]#
Generate Instance object.
- Parameters:
name (str) – Name of the instance to be generated.
shape (numpy.ndarray, optional.) – Shape of the object to be generated.
pitch (numpy.ndarray, optional.) – Element pitch of the array object to be generated.
transform (str) – Transformation attribute of the object to be generated.
netmap (dict, optional.) – Dictionary storing net-pin conversion mappings.
params (dict, optional.) – Dictionary storing the parameters associated with the object.
- Return type:
(laygo2.object.physical.Instance) generated Instance object
See also
Class
Example
>>> from laygo2.object.physical import Pin >>> from laygo2.object.template import NativeInstanceTemplate >>> p = dict() >>> p['i'] = Pin(xy=[[0, 0], [10, 10]], layer=['M1', 'drawing'], netname='i') >>> p['o'] = Pin(xy=[[90, 90], [100, 100]], layer=['M1', 'drawing'], netname='o') >>> nt = NativeInstanceTemplate(libname='mylib', cellname='mytemp', bbox=[[0, 0], [100, 100]], pins=p) >>> i0 = nt.generate(name="I0") >>> i1 = nt.generate(name="I1") >>> print(i0) <laygo2.object.physical.Instance object at 0x000002C3F717F850> name: I0, class: Instance, xy: [0, 0], params: None, size: [100, 100], shape: None, pitch: [100, 100], transform: R0, pins: {'i': <laygo2.object.physical.Pin object at 0x000002C3F717F820>, 'o': <laygo2.object.physical.Pin object at 0x000002C3F717FD90>}, >>> print(i1) <laygo2.object.physical.Instance object at 0x000002C3FF91C100> name: I1, class: Instance, xy: [0, 0], params: None, size: [100, 100], shape: None, pitch: [100, 100], transform: R0, pins: {'i': <laygo2.object.physical.Pin object at 0x000002C3FF91C0A0>, 'o': <laygo2.object.physical.Pin object at 0x000002C3FF91C070>},
- height(params=None)#
int: Return the height of the template.
- pins(params=None)[source]#
Dictionary storing pins of the object.
- Parameters:
None
- Returns:
dict
- Return type:
Dictionary storing pin objects.
Example
>>> from laygo2.object.physical import Pin >>> from laygo2.object.template import NativeInstanceTemplate >>> p = dict() >>> p['i'] = Pin(xy=[[0, 0], [10, 10]], layer=['M1', 'drawing'], netname='i') >>> p['o'] = Pin(xy=[[90, 90], [100, 100]], layer=['M1', 'drawing'], netname='o') >>> nt = NativeInstanceTemplate(libname='mylib', cellname='mytemp', bbox=[[0, 0], [100, 100]], pins=p) >>> nt.pins() >>> {'i': <laygo2.object.physical.Pin object at 0x000002578C762500>, 'o': <laygo2.object.physical.Pin object at 0x00000257FBA87C40>} >>> print(nt.pins()['i']) <laygo2.object.physical.Pin object at 0x000002578C762500> name: None, class: Pin, xy: [[0, 0], [10, 10]], params: None, layer: ['M1' 'drawing'], netname: i, shape: None, master: None
- size(params=None)#
int: Return the size of the template.
- width(params=None)#
int: Return the width of the template.
- _abc_impl = <_abc._abc_data object>#
- _bbox = array([[0, 0], [0, 0]])#
- _pins = None#
- cellname = None#
Cell name.
Example
>>> from laygo2.object.physical import Pin >>> from laygo2.object.template import NativeInstanceTemplate >>> p = dict() >>> p['i'] = Pin(xy=[[0, 0], [10, 10]], layer=['M1', 'drawing'], netname='i') >>> p['o'] = Pin(xy=[[90, 90], [100, 100]], layer=['M1', 'drawing'], netname='o') >>> nt = NativeInstanceTemplate(libname='mylib', cellname='mytemp', bbox=[[0, 0], [100, 100]], pins=p) >>> nt.cellname 'mytemp'
- Type:
- libname = None#
Library name.
Example
>>> from laygo2.object.physical import Pin >>> from laygo2.object.template import NativeInstanceTemplate >>> p = dict() >>> p['i'] = Pin(xy=[[0, 0], [10, 10]], layer=['M1', 'drawing'], netname='i') >>> p['o'] = Pin(xy=[[90, 90], [100, 100]], layer=['M1', 'drawing'], netname='o') >>> nt = NativeInstanceTemplate(libname='mylib', cellname='mytemp', bbox=[[0, 0], [100, 100]], pins=p) >>> nt.libname 'mylib'
- Type: