- class kqcircuits.masks.mask_set.MaskSet(view=None, name='MaskSet', version=1, with_grid=False, export_drc=False, mask_export_layers=None, export_path=PosixPath('/__w/KQCircuits/KQCircuits/tmp'))¶
Class representing a set of masks for different chip faces.
A mask set consists of one or more MaskLayouts, each of which is for a certain face.
To create a mask, add mask layouts to the mask set using add_mask_layout() and add chips to these mask layouts using add_chip(). These functions also export some files for each chip. Then call build() to create the cell hierarchy of the entire mask, and finally export mask files by calling export().
Chips are created in parallel in separate processes but the user may choose to use a
-dswitch on the command line for debugging with a single process. It is also possible to manually limit the number of concurrently used CPUs for resource management purposes with the
-c 4switch (to 4 in this example).
mask = MaskSet(…) mask.add_mask_layout(…) mask.add_mask_layout(…) mask.add_chip(…) mask.build() mask.export()
pya.Layout of this mask set
Name of the mask set
Version of the mask set
Boolean determining if ground grid is generated
Boolean determining if DRC report is exported
Dictionary where keys are chip names, values are chip cells
list of MaskLayout objects in this mask set
list of names of the layers which are exported for each MaskLayout
similar to chips_map_legend, but only includes chips which are actually used in mask layouts
The folder for mask files will be generated under this. TMP_PATH by default.
- add_mask_layout(chips_map, face_id='1t1', mask_layout_type=<class 'kqcircuits.masks.mask_layout.MaskLayout'>, **kwargs)¶
Creates a mask layout from chips_map and adds it to self.mask_layouts.
chips_map – List of lists (2D-array) of strings, each string is a chip name (or — for no chip)
face_id – face_id of the mask layout
mask_layout_type – type of the mask layout (MaskLayout or a child class of it)
kwargs – keyword arguments passed to the mask layout
the created mask layout
- add_chip(chips, variant_name=None, cpus=None, **parameters)¶
Adds a chip (or list of chips) with parameters to self.chips_map_legend and exports the files for each chip.
Note the complex polymorphism used here:
chipsis either a single chip class or a list of
(chip, variant, parameters)tuples. In the latter case the rest of the arguments (except
cpus) are ignored. Also,
chips(or the individual chip part of tuples) may be a simple file name to load a static .oas file instead.
The chip’s parameters dictionary may also contain an
alt_netlistsdictionary to specify alternative ways of generating netlists. See
quick_demo.pymask for further information.
chip – A chip class. Or a list of tuples, like
[(QualityFactor, "QDG", parameters),...], parameters are optional.
variant_name – Name for specific variant, the same as in the mask layout.
cpus – Number of parallel processes to use for chip generation. By default uses
os.cpu_count()or the number of chips, whichever is smaller.
**parameters – Any parameters passed to the a single chip PCell.
Builds the mask set.
Creates cells for the mask based on self.mask_layouts and self.chips_map_legend. Optionally removes guiding shapes from the layout. Populates self.used_chips with the chips used in the mask layouts.
remove_guiding_shapes (Boolean) – determines if the guiding shapes are removed
Exports designs, bitmaps and documentation of this mask set.
Assumes that self.build() has been called before.
- static chips_map_from_box_map(box_map, mask_map)¶
Returns the chips_map created from box_map and mask_map.
Given NxN box map and MxM mask_map, creates chips_map of size MNxMN. So each element of mask map is “replaced” by a box in the box map. Assumes that box_map and mask_map are square.
box_map – dictionary where keys are strings identifying the box type, and values are 2D arrays (lists of lists) where each element is a string identifying the chip type
mask_map – 2D array (list of lists), where each element is a string identifying the box type