public override void visit(Component obj) { DesignEntity de = obj; CodeGenerator.Logger.WriteDebug( "SpiceVisitor::visit({0})", obj.Name); // create a signal container for this component var siginfo_obj = new Spice.SignalContainer() { name = de.Name, gmeid = de.Impl.ID }; ObjectSiginfoMap.Add(de, siginfo_obj); var siginfo_parent = this.siginfo_obj; if (de.Parent != null && ObjectSiginfoMap.ContainsKey(de.Parent)) { siginfo_parent = ObjectSiginfoMap[de.Parent] as Spice.SignalContainer; } siginfo_parent.signals.Add(siginfo_obj); var spiceObjs = obj.Impl.Children.SPICEModelCollection; var spiceObj = CyPhyBuildVisitor.GetSpiceModel(obj, spiceObjs); if (spiceObj == null) // no spice model in this component, skip from generating { return; } GenerateSpice(de, spiceObj); }
private Tuple <char, string> GetSpiceType(DesignEntity obj) { var spiceObjs = (obj.Impl is Tonka.ComponentType) ? (obj.Impl as Tonka.ComponentType).Children.SPICEModelCollection : (obj.Impl as Tonka.ComponentAssembly).Children.SPICEModelCollection; Tonka.SPICEModel spiceObj = CyPhyBuildVisitor.GetSpiceModel(obj, spiceObjs); string[] spiceType = (spiceObj != null) ? spiceObj.Attributes.Class.Split(new char[] { ':', ' ', '.' }) : null; char baseType = (spiceType != null && spiceType.Count() > 0 && spiceType[0].Length > 0) ? spiceType[0][0] : (char)0; string classType = (spiceType != null && spiceType.Count() > 1) ? spiceType[1] : ""; var tuple = new Tuple <char, string>(baseType, classType); return(tuple); }