mirror of https://github.com/VLSIDA/OpenRAM.git
sram_factory: Allow a prefered module name
Signed-off-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
This commit is contained in:
parent
de6b207798
commit
451ef4d896
|
|
@ -31,7 +31,7 @@ class sram_factory:
|
||||||
"""
|
"""
|
||||||
self.__init__()
|
self.__init__()
|
||||||
|
|
||||||
def create(self, module_type, **kwargs):
|
def create(self, module_type, module_name=None, **kwargs):
|
||||||
"""
|
"""
|
||||||
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.
|
||||||
|
|
@ -72,16 +72,18 @@ class sram_factory:
|
||||||
if obj_kwargs == kwargs:
|
if obj_kwargs == kwargs:
|
||||||
return obj_item
|
return obj_item
|
||||||
|
|
||||||
# Use the default name if there are default arguments
|
# If no prefered module name is provided, we generate one.
|
||||||
# This is especially for library cells so that the
|
if module_name is None:
|
||||||
# spice and gds files can be found.
|
# Use the default name if there are default arguments
|
||||||
if len(kwargs) > 0:
|
# This is especially for library cells so that the
|
||||||
# Create a unique name and increment the index
|
# spice and gds files can be found.
|
||||||
module_name = "{0}_{1}".format(real_module_type,
|
if len(kwargs) > 0:
|
||||||
self.module_indices[real_module_type])
|
# Create a unique name and increment the index
|
||||||
self.module_indices[real_module_type] += 1
|
module_name = "{0}_{1}".format(real_module_type,
|
||||||
else:
|
self.module_indices[real_module_type])
|
||||||
module_name = real_module_type
|
self.module_indices[real_module_type] += 1
|
||||||
|
else:
|
||||||
|
module_name = real_module_type
|
||||||
|
|
||||||
# type_str = "type={}".format(real_module_type)
|
# type_str = "type={}".format(real_module_type)
|
||||||
# name_str = "name={}".format(module_name)
|
# name_str = "name={}".format(module_name)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue