| 
 | 1 | +from siliconcompiler import DesignSchema, ASICProject  | 
 | 2 | + | 
1 | 3 | #  individual modules  | 
2 | 4 | from lambdalib import auxlib  | 
3 | 5 | from lambdalib import fpgalib  | 
 | 
7 | 9 | from lambdalib import ramlib  | 
8 | 10 | from lambdalib import veclib  | 
9 | 11 | 
 
  | 
10 |  | -__version__ = "0.3.4"  | 
 | 12 | +__version__ = "0.4.0-rc1"  | 
 | 13 | + | 
 | 14 | + | 
 | 15 | +class LambalibTechLibrary(DesignSchema):  | 
 | 16 | +    """A DesignSchema class to manage a lambda library and its associated technology libraries.  | 
 | 17 | +
  | 
 | 18 | +    This class encapsulates a main lambda library cell and a list of technology  | 
 | 19 | +    libraries, providing a mechanism to alias them within an ASIC project.  | 
 | 20 | +    """  | 
 | 21 | +    def __init__(self, lambdalib, techlibs):  | 
 | 22 | +        """Initializes the LambalibTechLibrary instance.  | 
 | 23 | +
  | 
 | 24 | +        Args:  | 
 | 25 | +            lambdalib: The main lambda library cell.  | 
 | 26 | +            techlibs (list): A list of technology library classes to be associated  | 
 | 27 | +                             with the main lambda library.  | 
 | 28 | +        """  | 
 | 29 | +        super().__init__()  | 
 | 30 | + | 
 | 31 | +        self.__cell = lambdalib  | 
 | 32 | + | 
 | 33 | +        if not techlibs:  | 
 | 34 | +            techlibs = []  | 
 | 35 | +        self.__techlibs = techlibs  | 
 | 36 | + | 
 | 37 | +    @classmethod  | 
 | 38 | +    def alias(cls, project: ASICProject):  | 
 | 39 | +        """Creates and registers aliases for the library and its techlibs in a project.  | 
 | 40 | +
  | 
 | 41 | +        This method checks if the provided project is an ASICProject and if the  | 
 | 42 | +        lambda library cell exists within the project's libraries. If both  | 
 | 43 | +        conditions are met, it adds an alias for the main library and adds  | 
 | 44 | +        each associated technology library to the project's ASIC libraries.  | 
 | 45 | +
  | 
 | 46 | +        Args:  | 
 | 47 | +            project (ASICProject): The ASIC project instance to which the aliases  | 
 | 48 | +                                   and libraries will be added.  | 
 | 49 | +        """  | 
 | 50 | +        if not isinstance(project, ASICProject):  | 
 | 51 | +            return  | 
 | 52 | + | 
 | 53 | +        tech = cls()  | 
 | 54 | +        if not project.has_library(tech.__cell):  | 
 | 55 | +            return  | 
 | 56 | + | 
 | 57 | +        project.add_alias(tech.__cell, "rtl", tech, "rtl")  | 
 | 58 | + | 
 | 59 | +        for lib in tech.__techlibs:  | 
 | 60 | +            project.add_asiclib(lib())  | 
 | 61 | + | 
11 | 62 | 
 
  | 
12 | 63 | __all__ = [  | 
13 | 64 |     "auxlib",  | 
 | 
0 commit comments