mirror of https://github.com/VLSIDA/OpenRAM.git
Add comments to module importing routines
This commit is contained in:
parent
2a9129ef45
commit
5176a70f84
|
|
@ -36,12 +36,14 @@ class sram_factory:
|
||||||
A generic function to create a module with a given module_type.
|
A generic function to create a module with a given module_type.
|
||||||
The args are passed directly to the module constructor.
|
The args are passed directly to the module constructor.
|
||||||
"""
|
"""
|
||||||
|
try:
|
||||||
from tech import tech_modules
|
from tech import tech_modules
|
||||||
real_module_type = tech_modules[module_type]
|
real_module_type = tech_modules[module_type]
|
||||||
# if name!="":
|
except ImportError:
|
||||||
# # This is a special case where the name and type don't match
|
# If they didn't define these, then don't use the option types.
|
||||||
# # Can't be overridden in the config file
|
# Primarily for backward compatibility and simplicity of tech files.
|
||||||
# module_name = name
|
pass
|
||||||
|
|
||||||
if hasattr(OPTS, module_type):
|
if hasattr(OPTS, module_type):
|
||||||
# Retrieve the name from OPTS if it exists,
|
# Retrieve the name from OPTS if it exists,
|
||||||
# otherwise just use the name
|
# otherwise just use the name
|
||||||
|
|
@ -49,8 +51,10 @@ class sram_factory:
|
||||||
|
|
||||||
# Either retrieve the already loaded module or load it
|
# Either retrieve the already loaded module or load it
|
||||||
try:
|
try:
|
||||||
|
# Load a cached version from previous usage
|
||||||
mod = self.modules[real_module_type]
|
mod = self.modules[real_module_type]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
|
# Dynamically load the module
|
||||||
import importlib
|
import importlib
|
||||||
c = importlib.reload(__import__(real_module_type))
|
c = importlib.reload(__import__(real_module_type))
|
||||||
mod = getattr(c, real_module_type)
|
mod = getattr(c, real_module_type)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue