import os import sys import tempfile import unittest import yaml ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), "..")) sys.path.insert(0, ROOT) import mxpic.technologies as technologies from scripts.export_technology_manifests import build_silterra_eom1_manifest, export_manifests class TechnologyManifestExportTest(unittest.TestCase): def test_silterra_manifest_contains_route_xsections(self): manifest = build_silterra_eom1_manifest() self.assertEqual(manifest["foundry"], "Silterra") self.assertEqual(manifest["technology"], "EMO1_2ML_CU_Al_RDL") self.assertEqual(manifest["defaults"]["xsection"], "strip") self.assertEqual(manifest["defaults"]["routing_type"], "euler_bend") self.assertIn("standard_bend", manifest["routing_types"]) self.assertEqual(manifest["xsections"]["strip"]["family"], "optical") self.assertEqual(manifest["xsections"]["rib_low"]["family"], "optical") self.assertEqual(manifest["xsections"]["metal_1"]["family"], "electrical") self.assertEqual(manifest["xsections"]["metal_2"]["family"], "electrical") self.assertIn("WG_STRIP", manifest["layers"]) def test_export_writes_eda_technology_yml(self): with tempfile.TemporaryDirectory() as temp_dir: export_manifests(temp_dir) output = os.path.join(temp_dir, "Silterra", "EMO1_2ML_CU_Al_RDL", "technology.yml") si_palik = os.path.join( temp_dir, "Silterra", "EMO1_2ML_CU_Al_RDL", "EMO1_2ML_CU_materials", "si_palik.csv", ) self.assertTrue(os.path.exists(output)) self.assertTrue(os.path.exists(si_palik)) with open(output, "r", encoding="utf-8") as file: data = yaml.safe_load(file) self.assertEqual(data["xsections"]["metal_1"]["family"], "electrical") def test_silterra_technology_loads_from_manifest(self): technology = technologies.foundry["Silterra"]["EMO1_2ML_CU_Al_RDL"]() expected_manifest = os.path.join( "mxpic", "technologies", "silterra", "EMO1_2ML_CU.yml", ) self.assertTrue(str(technology.manifest_path).endswith(expected_manifest)) self.assertEqual(technology.layers["WG_HM"].layer, (275, 0)) self.assertEqual(technology.layers["WG_HM"].z_start, 0.0) self.assertEqual(technology.layers["WG_HM"].thickness, 0.22) self.assertEqual(technology.layers["WG_HM"].sidewall_angle, 83.0) si_palik = technology.materials["si_palik"] self.assertTrue( si_palik.data_file.endswith( os.path.join( "mxpic", "technologies", "silterra", "EMO1_2ML_CU_materials", "si_palik.csv", ) ) ) self.assertTrue(os.path.exists(si_palik.data_file)) def test_foundry_registry_uses_manifest_names(self): loader = technologies.foundry["Silterra"]["EMO1_2ML_CU_Al_RDL"] self.assertEqual(loader.foundry, "Silterra") self.assertEqual(loader.technology, "EMO1_2ML_CU_Al_RDL") self.assertEqual(loader.manifest, "silterra/EMO1_2ML_CU.yml") def test_all_modern_technologies_load_from_manifests(self): technology_loaders = ( technologies.foundry["CUMEC"]["CUMEC_CSiP130Cu"], technologies.foundry["CUMEC"]["CUMEC_CSiP180Al_PASSIVE"], technologies.foundry["AMF"]["AMF_Si220_Active"], technologies.foundry["ANT"]["ANT_Si220_MPW"], technologies.foundry["consemi"]["PSIN_SOI"], technologies.foundry["IMEC"]["IMEC_Si220_Active"], technologies.foundry["IMECAS"]["IMECAS_SiP"], technologies.foundry["CompTek"]["CT_CU3ML"], technologies.foundry["SITRI"]["SITRI_LSIN_SOI"], technologies.foundry["Silterra"]["EMO1_2ML_CU_Al_RDL"], ) for technology_loader in technology_loaders: technology = technology_loader() self.assertIsNotNone(technology.manifest_path) self.assertTrue(os.path.exists(technology.manifest_path)) self.assertGreater(len(technology.layers), 0) if __name__ == "__main__": unittest.main()