Esempio n. 1
0
 static ISEDetector()
 {
     foreach (PropDesc prop in PropEnum.EnumProps(typeof(EISEVersion)))
     {
         _versionMap[prop.IDs[EPropAssoc.ISE]] = (EISEVersion)prop.EnumValue;
     }
 }
Esempio n. 2
0
 static XilinxIntegration()
 {
     foreach (PropDesc prop in PropEnum.EnumProps(typeof(EISEVersion)))
     {
         _versionMap[prop.IDs[EPropAssoc.ISE]] = (EISEVersion)prop.EnumValue;
     }
 }
Esempio n. 3
0
        public static PropDesc FindProp(EXilinxProjectProperties prop)
        {
            IList <PropDesc> allProps = PropEnum.EnumProps(typeof(EXilinxProjectProperties));
            PropDesc         pd       = (from PropDesc pdi in allProps
                                         where pdi.EnumValue.Equals(prop)
                                         select pdi).Single();

            return(pd);
        }
Esempio n. 4
0
 private static void CreateRMap()
 {
     _rmap = new Dictionary <string, EDeviceResource>();
     foreach (var value in Enum.GetValues(typeof(EDeviceResource)))
     {
         string str = PropEnum.ToString(value, EPropAssoc.PARReport);
         _rmap[str] = (EDeviceResource)value;
     }
 }
Esempio n. 5
0
        public object GetProperty(EXilinxProjectProperties prop)
        {
            PropDesc pd = PropEnum.FindProp(prop);
            object   result;

            if (!Properties.TryGetValue(prop, out result))
            {
                result = pd.DefaultValue;
            }
            return(result);
        }
Esempio n. 6
0
        private void PostInitializeProperties()
        {
            Properties[EXilinxProjectProperties.PROP_DevFamilyPMName] =
                PropEnum.ToString(
                    Properties[EXilinxProjectProperties.DeviceFamily], EPropAssoc.CoreGen);

            if (TopLevelComponent != null)
            {
                var gi = TopLevelComponent.QueryAttribute <VHDLGenInfo>();
                PutProperty(EXilinxProjectProperties.AutoImplementationTop, false);
                PutProperty(EXilinxProjectProperties.ImplementationTop, "Architecture|" + gi.EntityName + "|" + gi.DefaultArch);
                PutProperty(EXilinxProjectProperties.ImplementationTopInstancePath, VHDLGenInfo.GetInstancePath(TopLevelComponent));
                PutProperty(EXilinxProjectProperties.ImplementationTopFile, gi.FileName);
            }
        }
Esempio n. 7
0
        public PropertyBag Copy(EPropAssoc assoc)
        {
            PropertyBag result = new PropertyBag();

            foreach (var pd in PropEnum.EnumProps(typeof(EXilinxProjectProperties)))
            {
                EXilinxProjectProperties key = (EXilinxProjectProperties)pd.EnumValue;
                object value;
                if (pd.IDs.ContainsKey(assoc) && Properties.TryGetValue(key, out value))
                {
                    result.PutProperty(key, value);
                }
            }
            return(result);
        }
Esempio n. 8
0
        public void PutProperty(EXilinxProjectProperties prop, object value)
        {
            if (value == null)
            {
                throw new ArgumentException("Value must be non-null");
            }

            PropDesc pd = PropEnum.FindProp(prop);

            if (!pd.Type.IsInstanceOfType(value))
            {
                throw new ArgumentException("Wrong argument type");
            }

            Properties[prop] = value;
        }
Esempio n. 9
0
        public void Save()
        {
            PostInitializeProperties();

            string        path = MakeFullPath(ProjectName + ".xise");
            XmlTextWriter wr   = new XmlTextWriter(path, Encoding.UTF8);

            wr.Formatting = Formatting.Indented;
            wr.WriteStartDocument(false);
            //wr.WriteStartElement("project", "http://www.xilinx.com/XMLSchema");
            wr.WriteStartElement("project");
            wr.WriteAttributeString("xmlns", "http://www.xilinx.com/XMLSchema");
            wr.WriteAttributeString("xmlns:xil_pn", "http://www.xilinx.com/XMLSchema");
            wr.WriteStartElement("header");
            wr.WriteEndElement();

            wr.WriteStartElement("version");

            wr.WriteAttributeString("xil_pn:ise_version", PropEnum.ToString(ISEVersion, EPropAssoc.ISE));
            wr.WriteAttributeString("xil_pn:schema_version", "2");
            wr.WriteEndElement();

            var    libraries = new HashSet <string>();
            string ucf       = null;

            wr.WriteStartElement("files");
            foreach (string file in _projectFiles)
            {
                string type = GetFileType(file);
                wr.WriteStartElement("file");
                wr.WriteAttributeString("xil_pn:name", MakeUNIXPath(file));
                wr.WriteAttributeString("xil_pn:type", type);
                EComponentPurpose purpose = LookupAttribute <EComponentPurpose>(file);
                if (purpose == EComponentPurpose.SimulationAndSynthesis ||
                    purpose == EComponentPurpose.SimulationOnly)
                {
                    wr.WriteStartElement("association");
                    wr.WriteAttributeString("xil_pn:name", "BehavioralSimulation");
                    wr.WriteEndElement();
                }
                if (purpose == EComponentPurpose.SimulationAndSynthesis ||
                    purpose == EComponentPurpose.SynthesisOnly)
                {
                    wr.WriteStartElement("association");
                    wr.WriteAttributeString("xil_pn:name", "Implementation");
                    wr.WriteEndElement();
                }
                var library = LookupAttribute <LibraryAttribute>(file);
                if (library != null)
                {
                    wr.WriteStartElement("library");
                    wr.WriteAttributeString("xil_pn:name", library.Name);
                    libraries.Add(library.Name);
                    wr.WriteEndElement();
                }
                wr.WriteEndElement();
            }
            wr.WriteEndElement();

            wr.WriteStartElement("properties");
            IList <PropDesc> allProps = PropEnum.EnumProps(typeof(EXilinxProjectProperties));

            foreach (PropDesc pdesc in allProps)
            {
                string propID;
                if (!pdesc.IDs.TryGetValue(EPropAssoc.ISE, out propID))
                {
                    continue;
                }
                object propVal;
                //if (!Properties.TryGetValue(propID, out propVal))
                if (!Properties.TryGetValue((EXilinxProjectProperties)pdesc.EnumValue, out propVal))
                {
                    propVal = pdesc.DefaultValue;
                }
                bool   isDefault  = propVal.Equals(pdesc.DefaultValue);
                string propValStr = PropEnum.ToString(propVal, EPropAssoc.ISE);
                wr.WriteStartElement("property");
                wr.WriteAttributeString("xil_pn:name", propID);
                wr.WriteAttributeString("xil_pn:value", propValStr);
                wr.WriteAttributeString("xil_pn:valueState", isDefault ? "default" : "non-default");
                wr.WriteEndElement();
            }
            wr.WriteEndElement();

            wr.WriteStartElement("bindings");
            if (ucf != null && TopLevelComponent != null)
            {
                var gi = TopLevelComponent.QueryAttribute <VHDLGenInfo>();
                wr.WriteStartElement("binding");
                wr.WriteAttributeString("xil_pn:location", "/" + gi.EntityName);
                wr.WriteAttributeString("xil_pn:name", ucf);
                wr.WriteEndElement();
            }
            wr.WriteEndElement();

            wr.WriteStartElement("libraries");
            foreach (string lib in libraries)
            {
                wr.WriteStartElement("library");
                wr.WriteAttributeString("xil_pn:name", lib);
                wr.WriteEndElement();
            }
            wr.WriteEndElement();

            wr.WriteStartElement("autoManagedFiles");
            wr.WriteEndElement();

            wr.WriteEndElement();
            wr.Close();

            if (TwinProject != null)
            {
                TwinProject.Save();
            }
        }
Esempio n. 10
0
 /// <summary>
 /// Combines device, speed grade and package to a part name.
 /// </summary>
 public static string MakePartName(EDevice device, ESpeedGrade grade, EPackage package)
 {
     return(device.ToString() +
            PropEnum.ToString(grade, EPropAssoc.ISE) + "-" +
            package.ToString());
 }
Esempio n. 11
0
 /// <summary>
 /// Translates an ISE version to its textual identifier.
 /// </summary>
 public static string GetVersionText(this EISEVersion ver)
 {
     return(PropEnum.ToString(ver, EPropAssoc.ISE));
 }