private void CommonTraversal(TestBench TestBench_obj) { // 1. A first traversal maps CyPhy objects to a corresponding but significantly lighter weight object network that only includes a // small set of concepts/classes : TestBench, ComponentAssembly, Component, Parameter, Port, Connection // 2. Second and third traversal passes compute the layout of the graph in schematic // 3. Forth traversal wires the object network // the object network is hierarchical, but the wiring is direct and skips hierarchy. The dependency on CyPhy is largely localized to the // traversal/visitor code (CyPhyVisitors.cs) TestBench_obj.accept(new CyPhyBuildVisitor(this.mainParameters.ProjectDirectory, this.mode, Traceability, mgaIdToDomainIDs, selectedSpiceModels) { Logger = Logger }); if (mode == Mode.EDA) { TestBench_obj.accept(new CyPhyLayoutVisitor() { Logger = Logger }); TestBench_obj.accept(new CyPhyLayout2Visitor() { Logger = Logger }); } TestBench_obj.accept(new CyPhyConnectVisitor(this.mode) { Logger = Logger }); }
private Eagle.eagle GenerateSchematicCode(TestBench TestBench_obj) { // load schematic library Eagle.eagle eagle = null; try { eagle = Eagle.eagle.Deserialize(CyPhy2Schematic.Properties.Resources.schematicTemplate); Logger.WriteInfo("Parsed Eagle Library schema version: " + eagle.version); } catch (Exception e) { eagle = new Eagle.eagle(); // create an empty eagle object network Logger.WriteError("Error parsing XML: " + e.Message + "<br>Inner: " + e.InnerException + "<br>Stack: " + e.StackTrace); } // 2. The second traversal walks the lighter weight (largely CyPhy independent) object network and maps to the eagle XML object network // the classes of this object network are automatically derived from the eagle XSD using the XSD2Code tool in the META repo // an important step of this traversal is the routing which is implemented currently as a simple rats nest routing, // the traversal and visitor code is localized in (SchematicTraversal.cs) TestBench_obj.accept(new EdaVisitor(this) { eagle_obj = eagle, Logger = Logger }); // 2.5 Finally a serializer (XSD generated code), walks the object network and generates the XML file System.IO.Directory.CreateDirectory(this.mainParameters.OutputDirectory); String outFile = Path.Combine(this.mainParameters.OutputDirectory, "schema.sch"); try { eagle.SaveToFile(outFile); } catch (Exception ex) { Logger.WriteError("Error Saving Schema File: {0}<br> Exception: {1}<br> Trace: {2}", outFile, ex.Message, ex.StackTrace); } return(eagle); }
private void GenerateSpiceCode(TestBench TestBench_obj) { var circuit = new Spice.Circuit() { name = TestBench_obj.Name }; var siginfo = new Spice.SignalContainer() { name = TestBench_obj.Name, objectToNetId = new Dictionary <CyPhy2SchematicInterpreter.IDs, string>() }; // now traverse the object network with Spice Visitor to build the spice and siginfo object network TestBench_obj.accept(new SpiceVisitor(Traceability, mgaIdToDomainIDs, this) { circuit_obj = circuit, siginfo_obj = siginfo, mode = this.mode }); String spiceTemplateFile = Path.Combine(this.mainParameters.OutputDirectory, "schema.cir.template"); circuit.Serialize(spiceTemplateFile); String siginfoFile = Path.Combine(this.mainParameters.OutputDirectory, "siginfo.json"); siginfo.Serialize(siginfoFile); }