def create_implementation(self, lib_name, template_list, change_list, lib_path=''):
        """Create implementation of a design in the CAD database.

        Parameters
        ----------
        lib_name : str
            implementation library name.
        template_list : list
            a list of schematic templates to copy to the new library.
        change_list :
            a list of changes to be performed on each copied templates.
        lib_path : str
            directory to create the library in.  If Empty, use default location.
        """
        lib_path = lib_path or self.default_lib_path
        tech_lib = self.db_config['schematic']['tech_lib']

        if cybagoa is not None and self.db_config['schematic'].get('use_cybagoa', False):
            cds_lib_path = os.environ.get('CDS_LIB_PATH', './cds.lib')
            sch_name = 'schematic'
            sym_name = 'symbol'
            encoding = get_encoding()
            # release write locks
            cell_view_list = []
            for _, _, cell_name in template_list:
                cell_view_list.append((cell_name, sch_name))
                cell_view_list.append((cell_name, sym_name))
            self.release_write_locks(lib_name, cell_view_list)

            # create library in case it doesn't exist
            self.create_library(lib_name, lib_path)

            # write schematic
            with cybagoa.PyOASchematicWriter(cds_lib_path, lib_name, encoding) as writer:
                for temp_info, change_info in zip(template_list, change_list):
                    sch_cell = cybagoa.PySchCell(temp_info[0], temp_info[1], temp_info[2], encoding)
                    for old_pin, new_pin in change_info['pin_map']:
                        sch_cell.rename_pin(old_pin, new_pin)
                    for inst_name, rinst_list in change_info['inst_list']:
                        sch_cell.add_inst(inst_name, lib_name, rinst_list)
                    writer.add_sch_cell(sch_cell)
                writer.create_schematics(sch_name, sym_name)

            copy = 'nil'
        else:
            copy = "'t"

        in_files = {'template_list': template_list,
                    'change_list': change_list}
        sympin = to_skill_list_str(self.db_config['schematic']['sympin'])
        ipin = to_skill_list_str(self.db_config['schematic']['ipin'])
        opin = to_skill_list_str(self.db_config['schematic']['opin'])
        iopin = to_skill_list_str(self.db_config['schematic']['iopin'])
        simulators = to_skill_list_str(self.db_config['schematic']['simulators'])
        cmd = ('create_concrete_schematic( "%s" "%s" "%s" {template_list} '
               '{change_list} %s %s %s %s %s %s)' % (lib_name, tech_lib, lib_path,
                                                     sympin, ipin, opin, iopin, simulators, copy))

        return self._eval_skill(cmd, input_files=in_files)
Пример #2
0
    def create_implementation(self,
                              lib_name,
                              template_list,
                              change_list,
                              lib_path=''):
        # type: (str, Sequence[Any], Sequence[Any], str) -> None
        lib_path = lib_path or self.default_lib_path
        tech_lib = self.db_config['schematic']['tech_lib']

        if cybagoa is not None and self.db_config['schematic'].get(
                'use_cybagoa', False):
            cds_lib_path = os.environ.get('CDS_LIB_PATH', './cds.lib')
            sch_name = 'schematic'
            sym_name = 'symbol'
            encoding = get_encoding()
            # release write locks
            cell_view_list = []
            for _, _, cell_name in template_list:
                cell_view_list.append((cell_name, sch_name))
                cell_view_list.append((cell_name, sym_name))
            self.release_write_locks(lib_name, cell_view_list)

            # create library in case it doesn't exist
            self.create_library(lib_name, lib_path)

            # write schematic
            with cybagoa.PyOASchematicWriter(cds_lib_path, lib_name,
                                             encoding) as writer:
                for temp_info, change_info in zip(template_list, change_list):
                    sch_cell = cybagoa.PySchCell(temp_info[0], temp_info[1],
                                                 temp_info[2], encoding)
                    for old_pin, new_pin in change_info['pin_map']:
                        sch_cell.rename_pin(old_pin, new_pin)
                    for inst_name, rinst_list in change_info['inst_list']:
                        sch_cell.add_inst(inst_name, lib_name, rinst_list)
                    writer.add_sch_cell(sch_cell)
                writer.create_schematics(sch_name, sym_name)

            copy = 'nil'
        else:
            copy = "'t"

        in_files = {'template_list': template_list, 'change_list': change_list}
        sympin = to_skill_list_str(self.db_config['schematic']['sympin'])
        ipin = to_skill_list_str(self.db_config['schematic']['ipin'])
        opin = to_skill_list_str(self.db_config['schematic']['opin'])
        iopin = to_skill_list_str(self.db_config['schematic']['iopin'])
        simulators = to_skill_list_str(
            self.db_config['schematic']['simulators'])
        cmd = ('create_concrete_schematic( "%s" "%s" "%s" {template_list} '
               '{change_list} %s %s %s %s %s %s)' %
               (lib_name, tech_lib, lib_path, sympin, ipin, opin, iopin,
                simulators, copy))

        self._eval_skill(cmd, input_files=in_files)