Library class#
- class laygo2.object.database.Library(name, params=None, elements=None)[source]#
Bases:
LibraryWrapper
[Design
]Class for library management function implementation.
Example
>>> import laygo2 >>> lib = laygo2.object.database.Library(name="mylib") >>> dsn0 = laygo2.object.database.Design(name="mycell0") >>> dsn1 = laygo2.object.database.Design(name="mycell1") >>> lib.append(dsn0) >>> lib.append(dsn1) >>> print(lib) <laygo2.object.database.Library object at 0x0000025F2D25B8B0> name: mylib, params: None elements: { 'mycell0': <laygo2.object.database.Design object at 0x0000025F2D25B010>, 'mycell1': <laygo2.object.database.Design object at 0x0000025F2D25BF70>}
See also
laygo2.object.databse.Design
Check for more comprehensive Example.
Public Data Attributes:
elements
Element object dictionary.
Inherited from
LibraryWrapper
libname
getter function of libname property.
Inherited from
BaseDatabase
name
Name of BaseDatabase object.
params
BaseDatabase object's parameter dictionary.
elements
Element object dictionary.
noname_index
Unique identifier index for unnamed objects.
Public Methods:
Inherited from
LibraryWrapper
get_libname
()getter function of libname property.
set_libname
(val)setter function of libname property.
append
(item)Add physical object to Library without taking any further actions.
__init__
(name[, params, elements])Constructor function of Library class.
summarize
()Get object information summary.
Inherited from
BaseDatabase
keys
()Keys of elements.
items
()Key-object pairs of elements.
__getitem__
(pos)Return the object corresponding to pos.
__setitem__
(key, item)Add key/object pair.
append
(item)Add physical object to BaseDatabase without taking any further actions.
__iter__
()Element-mapped direct iterator function.
__str__
()Return str(self).
summarize
()Get object information summary.
__init__
(name[, params, elements])BaseDatabase class constructor function.
Inherited from
Generic
__class_getitem__
Parameterizes a generic class.
__init_subclass__
Function to initialize subclasses.
- __init__(name, params=None, elements=None)#
Constructor function of Library class.
- Parameters:
- Return type:
laygo2.object.Library
Example
>>> import laygo2 >>> lib = laygo2.object.database.Library(name='mylib') >>> print(lib) <laygo2.object.database.Library > name: mylib, params: None elements: {} >
- append(item: T)#
Add physical object to Library without taking any further actions.
- get_libname()#
getter function of libname property.
- items()#
Key-object pairs of elements.
- Parameters:
None
- Return type:
dict_items
Example
>>> import laygo2 >>> from laygo2.object.database import BaseDatabase >>> from laygo2.object.physical import Rect, Pin, Instance, Text >>> # Create a design >>> dsn = BaseDatabase(name="mycell") >>> # Create layout objects >>> r0 = Rect(xy=[[0, 0], [100, 100]], layer=["M1", "drawing"]) >>> p0 = Pin(xy=[[0, 0], [50, 50]], layer=["M1", "pin"], name="P") >>> i0 = Instance(libname="tlib", cellname="t0", name="I0", xy=[0, 0]) >>> t0 = Text(xy=[[50, 50], [100, 100]], layer=["text", "drawing"], text="T") >>> dsn.append(r0) >>> dsn.append(p0) >>> dsn.append(i0) >>> dsn.append(t0) >>> print(dsn.items()) dict_items([('NoName_0', <laygo2.object.physical.Rect object at 0x0000024C6C230F40>), ('P', <laygo2.object.physical.Pin object at 0x0000024C6C2EFF40>), ('I0', <laygo2.object.physical.Instance object at 0x0000024C6C2EFDC0>), ('NoName_1', <laygo2.object.physical.Text object at 0x0000024C6C2EF8B0>)])
- keys()#
Keys of elements.
Example
>>> import laygo2 >>> from laygo2.object.database import BaseDatabase >>> from laygo2.object.physical import Rect, Pin, Instance, Text >>> # Create a design >>> dsn = BaseDatabase(name="mycell") >>> # Create layout objects >>> r0 = Rect(xy=[[0, 0], [100, 100]], layer=["M1", "drawing"]) >>> p0 = Pin(xy=[[0, 0], [50, 50]], layer=["M1", "pin"], name="P") >>> i0 = Instance(libname="tlib", cellname="t0", name="I0", xy=[0, 0]) >>> t0 = Text(xy=[[50, 50], [100, 100]], layer=["text", "drawing"], text="T") >>> dsn.append(r0) >>> dsn.append(p0) >>> dsn.append(i0) >>> dsn.append(t0) >>> print(dsn.keys()) dict_keys(['NoName_0', 'P', 'I0', 'NoName_1'])
- set_libname(val)#
setter function of libname property.
- summarize()#
Get object information summary.
- elements: Dict[str, Type[PhysicalObject | T]] = None#
Element object dictionary.
Example
>>> import laygo2 >>> from laygo2.object.database import BaseDatabase >>> from laygo2.object.physical import Rect, Pin, Instance, Text >>> # Create a design. >>> dsn = BaseDatabase(name="mycell") >>> # Create layout objects. >>> r0 = Rect(xy=[[0, 0], [100, 100]], layer=["M1", "drawing"]) >>> p0 = Pin(xy=[[0, 0], [50, 50]], layer=["M1", "pin"], name="P") >>> i0 = Instance(libname="tlib", cellname="t0", name="I0", xy=[0, 0]) >>> t0 = Text(xy=[[50, 50], [100, 100]], layer=["text", "drawing"], text="T") >>> # Add layout objects to the design. >>> dsn.append(r0) >>> dsn.append(p0) >>> dsn.append(i0) >>> dsn.append(t0) >>> # >>> # Display elements of the design. >>> print(dsn.elements) {'NoName_0': <laygo2.object.physical.Rect object at 0x0000024C6C230F40>, 'P': <laygo2.object.physical.Pin object at 0x0000024C6C2EFF40>, 'I0': <laygo2.object.physical.Instance object at 0x0000024C6C2EFDC0>, 'NoName_1': <laygo2.object.physical.Text object at 0x0000024C6C2EF8B0>}
- Type:
- property libname#
getter function of libname property.
- name = None#
Name of BaseDatabase object.
Example
>>> import laygo2 >>> base = laygo2.object.database.BaseDatabase(name="mycell") >>> base.name "mycell"
- Type:
- noname_index = 0#
Unique identifier index for unnamed objects.
Example
>>> import laygo2 >>> from laygo2.object.database import BaseDatabase >>> from laygo2.object.physical import Rect, Pin, Instance, Text >>> # Create a design >>> dsn = BaseDatabase(name="mycell") >>> # Create layout objects >>> r0 = Rect(xy=[[0, 0], [100, 100]], layer=["M1", "drawing"]) >>> dsn.append(r0) >>> print(base.noname_index) 0 >>> r1 = Rect(xy=[[100, 100], [200, 200]], layer=["M1", "drawing"]) >>> dsn.append(r1) >>> print(base.noname_index) 1
- Type: