@@ -28,10 +28,10 @@ index 0000000..edcf578
2828+ # ORFS ASAP7 package
2929diff --git a/orfs_asap7/generate.py b/orfs_asap7/generate.py
3030new file mode 100644
31- index 0000000..58fef20
31+ index 0000000..4e00ecf
3232--- /dev/null
3333+++ b/orfs_asap7/generate.py
34- @@ -0,0 +1,83 @@
34+ @@ -0,0 +1,70 @@
3535+ import json
3636+ import sys
3737+ from pathlib import Path
@@ -43,31 +43,7 @@ index 0000000..58fef20
4343+ from utils.ram_liberty_exporter import RAMLibertyExporter
4444+ from utils.lef_exporter import LefExporter
4545+
46- + ASAP7_PROCESS_CONFIG = {
47- + "tech_nm": 7,
48- + "voltage": 0.7,
49- + "metal_prefix": "M",
50- + "metal_layer": "M4",
51- + "pin_width_nm": 24,
52- + "pin_pitch_nm": 48,
53- + "metal_track_pitch_nm": 48,
54- + "manufacturing_grid_nm": 1,
55- + "contacted_poly_pitch_nm": 54,
56- + "fin_pitch_nm": 27,
57- + "column_mux_factor": 1,
58- + "snap_width_nm": 190,
59- + "snap_height_nm": 1400,
60- + }
61- +
62- + ASAP7_TIMING_CONFIG = {
63- + "cycle_time": 1.0,
64- + "access_time": 0.5,
65- + "setup_time": 0.1,
66- + "hold_time": 0.05,
67- + "leakage": 0.001,
68- + }
69- +
70- + def run_orfs_asap7(platform: str, out_dir: Path, json_path: Path):
46+ + def run_orfs_asap7(platform: str, out_dir: Path, json_path: Path, tech_config_path: Path | None = None):
7147+ if platform != "asap7":
7248+ sys.stderr.write(f"FakeRAM2.0 orfs_asap7: unsupported platform {platform}\n")
7349+ return 1
@@ -79,11 +55,22 @@ index 0000000..58fef20
7955+ sys.stderr.write(f"FakeRAM2.0 orfs_asap7: failed to read {json_path}: {e}\n")
8056+ return 1
8157+
58+ + process_config = {}
59+ + timing_config = {}
60+ + if tech_config_path and tech_config_path.is_file():
61+ + try:
62+ + tech_data = json.loads(tech_config_path.read_text())
63+ + process_config = tech_data
64+ + timing_config = tech_data.get("timing", {})
65+ + except Exception as e:
66+ + sys.stderr.write(f"FakeRAM2.0 orfs_asap7: failed to read tech_config {tech_config_path}: {e}\n")
67+ + return 1
68+ +
8269+ out_dir.mkdir(parents=True, exist_ok=True)
8370+ converted = sorted((m for m in memories if m.get("idiomatic")), key=lambda m: m["name"])
8471+
85- + process = Process(ASAP7_PROCESS_CONFIG )
86- + timing_data = TimingData(ASAP7_TIMING_CONFIG )
72+ + process = Process(process_config )
73+ + timing_data = TimingData(timing_config )
8774+
8875+ for m in converted:
8976+ name = m["name"]
@@ -116,52 +103,78 @@ index 0000000..58fef20
116103+ (out_dir / "blackboxes.txt").write_text("".join(f"{m['name']}\n" for m in converted))
117104+ return 0
118105diff --git a/run.py b/run.py
119- index f525c5f..06ae626 100755
106+ index f525c5f..ee89130 100755
120107--- a/run.py
121108+++ b/run.py
122- @@ -8,6 +8,7 @@ from utils.class_process import Process
109+ @@ -1,4 +1,7 @@
110+ #!/usr/bin/env python3
111+ + import sys
112+ + from pathlib import Path
113+ + sys.path.insert(0, str(Path(__file__).resolve().parent))
114+
115+ import sys
116+ import argparse
117+ @@ -8,6 +11,8 @@ from utils.class_process import Process
123118 from utils.memory_config import MemoryConfig
124119 from utils.memory_factory import MemoryFactory
125120 from utils.timing_data import TimingData
126121+ from orfs_asap7.generate import run_orfs_asap7
122+ +
127123
128124
129125 def get_args() -> argparse.Namespace:
130- @@ -28,10 +29,19 @@ def get_args() -> argparse.Namespace:
131- required=False,
132- default="results",
126+ @@ -21,6 +26,17 @@ def get_args() -> argparse.Namespace:
127+ exist. """
133128 )
129+ parser.add_argument("config", help="JSON configuration file")
134130+ parser.add_argument(
135131+ "--orfs_asap7_backend",
136132+ action="store_true",
137133+ help="Use ORFS ASAP7 backend (expects JSON in memories.json format)",
138134+ )
139- return parser.parse_args()
135+ + parser.add_argument(
136+ + "--tech_config",
137+ + required=False,
138+ + default=None,
139+ + help="Path to platform tech configuration JSON",
140+ + )
141+ parser.add_argument(
142+ "--output_dir",
143+ action="store",
144+ @@ -32,6 +48,10 @@ def get_args() -> argparse.Namespace:
140145
141146
142147 def main(args: argparse.Namespace):
143148+ if args.orfs_asap7_backend:
144149+ from pathlib import Path
145- + return run_orfs_asap7(platform="asap7", out_dir= Path(args.output_dir), json_path=Path( args.config))
146- +
150+ + tech_path = Path(args.tech_config) if args.tech_config else None
151+ + return run_orfs_asap7(platform="asap7", out_dir=Path(args.output_dir), json_path=Path(args.config), tech_config_path=tech_path)
147152 json_data = RunUtils.get_config(args.config)
148153 # Create a process object (shared by all srams)
149154 process = Process(json_data)
150- @@ -52,4 +62 ,4 @@ def main(args: argparse.Namespace):
155+ @@ -52,4 +72 ,4 @@ def main(args: argparse.Namespace):
151156 ### Entry point
152157 if __name__ == "__main__":
153158 args = get_args()
154159- main(args)
155160+ sys.exit(main(args))
156161diff --git a/utils/class_process.py b/utils/class_process.py
157- index e1cfac3..745285c 100644
162+ index e1cfac3..cb6f641 100644
158163--- a/utils/class_process.py
159164+++ b/utils/class_process.py
160- @@ -119,6 +119,9 @@ class Process:
165+ @@ -24,6 +24,7 @@ class Process:
166+ self.fin_pitch_nm = json_data.get("fin_pitch_nm", None)
167+ self.manufacturing_grid_nm = int(json_data["manufacturing_grid_nm"])
168+ self.column_mux_factor = int(json_data["column_mux_factor"])
169+ + self.min_macro_height_um = float(json_data.get("min_macro_height_um", 0.0))
170+
171+ # Optional keys
172+ self.snap_width_nm = (
173+ @@ -119,6 +120,9 @@ class Process:
161174
162175 total_height += additional_height
163176
164- + min_height = max(3.5 , self.snap_height_nm / 1000.0 if self.snap_height_nm else 0)
177+ + min_height = max(self.min_macro_height_um , self.snap_height_nm / 1000.0 if self.snap_height_nm else 0)
165178+ total_height = max(total_height, min_height)
166179+
167180 return (total_width, total_height)
0 commit comments