Skip to content
Snippets Groups Projects
Commit 2bac6679 authored by Thomas Kramer's avatar Thomas Kramer
Browse files

pull17, magic writer: remove hardcoded technology name

* instead introduce the `magscale` parameter for `MagicWriter`
* use `magscale` parameter in the tech-file to set the correct scale
parent 37fa4834
No related branches found
No related tags found
No related merge requests found
......@@ -93,7 +93,8 @@ def store_layout_to_magic_file(tech_name: str,
top_cell: db.Cell,
output_file: str,
ignore_non_rectilinear: bool = False,
scale_factor: int = 1):
scale_factor: int = 1,
magscale: Tuple[int, int] = (1, 10)):
"""
Write the cell layout to a file in the Magic (.mag) format.
......@@ -106,6 +107,8 @@ def store_layout_to_magic_file(tech_name: str,
:return:
"""
assert len(magscale) == 2, "magscale must be a 2-tuple"
layer_config = []
for source_layer_name, destinations in output_map.items():
assert isinstance(destinations, str) or isinstance(destinations, List), \
......@@ -126,7 +129,7 @@ def store_layout_to_magic_file(tech_name: str,
mag_lines = ["magic",
"# Generated by librecell",
"tech {}".format(tech_name),
"magscale 1 10" if tech_name=='gf180mcuC' else "magscale 1 1",
f"magscale {magscale[0]} {magscale[1]}",
"timestamp {}".format(int(time.time()))
]
......@@ -197,7 +200,12 @@ def store_layout_to_magic_file(tech_name: str,
class MagWriter(Writer):
def __init__(self, tech_name: str, output_map: Dict[str, str], scale_factor: float = 1):
def __init__(self,
tech_name: str,
output_map: Dict[str, str],
scale_factor: float = 1,
magscale: Tuple[int, int] = (1, 10)
):
"""
:param tech_name:
......@@ -207,6 +215,7 @@ class MagWriter(Writer):
self.tech_name = tech_name
self.output_map = output_map
self.scale_factor = scale_factor
self.magscale = magscale
def write_layout(self,
layout: db.Layout,
......@@ -225,4 +234,6 @@ class MagWriter(Writer):
top_cell,
mag_out_path,
ignore_non_rectilinear=False,
scale_factor=self.scale_factor)
scale_factor=self.scale_factor,
magscale=self.magscale
)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment