export_to_template() method#
- Design.export_to_template(libname=None, cellname=None)[source]#
Generate a NativeInstanceTemplate object corresponding to Design object.
- Parameters:
- Returns:
laygo2.NativeInstanceTemplate
- Return type:
The generated template object.
Example
>>> import laygo2 >>> from laygo2.object.database import Design >>> from laygo2.object.physical import Rect, Pin, Instance, Text >>> # Create a design >>> dsn = Design(name="mycell", libname="genlib") >>> # 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) >>> # Export the design to a template. >>> nt0 = dsn.export_to_template() >>> print(nt0) <laygo2.object.template.NativeInstanceTemplate object at XXXX> name: mycell, class: NativeInstanceTemplate, bbox: [[0, 0], [0, 0]], pins: {'P': <laygo2.object.physical.Pin object at YYYY>}, >>> # Save the template into a yaml file. >>> laygo2.interface.yaml.export_template(nt0, filename='mytemp.yaml')
See also
laygo2.interface.yaml.export_template
Export a template to a yaml file.