public override void visit(ComponentAssembly obj)
 {
     var layoutFile = (obj.Impl.Impl as GME.MGA.MgaFCO).RegistryValue["layoutFile"];
     if (layoutFile != null)
     {
         var pathLayoutFile = Path.Combine(obj.Impl.GetDirectoryPath(ComponentLibraryManager.PathConvention.ABSOLUTE), layoutFile);
         var layoutParser = new Layout.LayoutParser(pathLayoutFile,
             CodeGenerator.Logger)
             {
                 parentInstanceGUID = (obj.Impl.Impl as GME.MGA.MgaFCO).
                 RegistryValue["Elaborator/InstanceGUID_Chain"]
             };
         Logger.WriteDebug("Parent GUID : {0}", layoutParser.parentInstanceGUID);
         layoutParser.BuildMaps();
         CodeGenerator.preRouted.Add(obj, layoutParser);
     }
 }
        public Result GenerateCode()
        {
            Result result = new Result();

            // map the root testbench obj
            var testbench = TonkaClasses.TestBench.Cast(this.mainParameters.CurrentFCO);
            if (testbench == null)
            {
                Logger.WriteError("Invalid context of invocation <{0}>, invoke the interpreter from a Testbench model", 
                    this.mainParameters.CurrentFCO.Name);
                return result;
            }
            var TestBench_obj = new TestBench(testbench);
            BasePath = testbench.Path;

            CommonTraversal(TestBench_obj);

            GenerateReferenceDesignatorMappingTable(TestBench_obj);

            switch (mode)
            {
                case Mode.EDA:
                    var eagle = GenerateSchematicCode(TestBench_obj);
                    GenerateLayoutCode(eagle, TestBench_obj);
                    CopyBoardFiles(TestBench_obj);     // copy DRU/board template file if the testbench has it specified
                    GenerateChipFitCommandFile();
                    GenerateShowChipFitResultsCommandFile();
                    GeneratePlacementCommandFile();
                    GeneratePlaceOnlyCommandFile();
                    result.runCommandArgs = GenerateCommandArgs(TestBench_obj);
                    break;
                case Mode.SPICE_SI:
                    // parse and map the nets to ports
                    signalIntegrityLayout = new Layout.LayoutParser("layout.json", Logger)
                    {
                        mode = this.mode
                    };
                    signalIntegrityLayout.BuildMaps();

                    // spice code generator uses the mapped traces 
                    // to generate subcircuits for traces and inserts them appropriately
                    GenerateSpiceCode(TestBench_obj);
                    GenerateSpiceCommandFile(TestBench_obj);
                    break;
                case Mode.SPICE:
                    GenerateSpiceCode(TestBench_obj);
                    GenerateSpiceCommandFile(TestBench_obj);
                    GenerateSpiceViewerLauncher();
                    break;
                default:
                    throw new NotSupportedException(String.Format("Mode {0} is not supported", mode.ToString()));
            }

            return result;
        }