Skip to content

Commit f987554

Browse files
authored
Merge pull request #110 from siliconcompiler/move-lambda
mark as release candidate 1
2 parents b28a2cb + 87fb599 commit f987554

File tree

1 file changed

+52
-1
lines changed

1 file changed

+52
-1
lines changed

lambdalib/__init__.py

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from siliconcompiler import DesignSchema, ASICProject
2+
13
# individual modules
24
from lambdalib import auxlib
35
from lambdalib import fpgalib
@@ -7,7 +9,56 @@
79
from lambdalib import ramlib
810
from lambdalib import veclib
911

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+
1162

1263
__all__ = [
1364
"auxlib",

0 commit comments

Comments
 (0)