コード例 #1
0
        public void Read(string XMLSpecification)
        {
            m_xmlDoc.Load(XMLSpecification);

            XmlElement xmlEl = m_xmlDoc.DocumentElement;

            foreach (XmlNode xmlNode in xmlEl.ChildNodes)
            {
                if (Regex.IsMatch(xmlNode.Name, "(" + Device + ")|(" + ConnectionPrimitive + ")"))
                {
                    //this.SystemParameter[xmlNode.Name] = xmlNode.InnerText;
                    SystemParameter[xmlNode.Name] = xmlNode;
                }
                else if (Regex.IsMatch(xmlNode.Name, StaticInfo))
                {
                    foreach (XmlNode innerNode in xmlNode.ChildNodes)
                    {
                        StaticParameter[innerNode.Name] = innerNode;
                    }
                }
                else if (Regex.IsMatch(xmlNode.Name, PartialInfo))
                {
                    foreach (XmlNode innerNode in xmlNode.ChildNodes)
                    {
                        PartialParameter[innerNode.Name] = innerNode;
                    }
                }
                else if (Regex.IsMatch(xmlNode.Name, PartialArea))
                {
                    string name = xmlNode.Attributes[0].Value;
                    if (PartialAreas.ContainsKey(name))
                    {
                        throw new ArgumentException("A partial area named " + name + " already exists");
                    }
                    PartialAreas.Add(name, new PartialAreaSetting());

                    foreach (XmlNode innerNode in xmlNode.ChildNodes)
                    {
                        if (innerNode.Name.Equals(Module))
                        {
                            ModuleSetting moduleSettings = new ModuleSetting();
                            PartialAreas[name].Modules.Add(moduleSettings);
                            for (int i = 0; i < innerNode.Attributes.Count; i++)
                            {
                                moduleSettings.Settings[innerNode.Attributes[i].Name] = innerNode.Attributes[i].Value;
                            }
                        }
                        PartialAreas[name].Settings[innerNode.Name] = innerNode.InnerText;
                        PartialAreas[name].Nodes[innerNode.Name]    = innerNode;
                    }
                }
            }
        }
コード例 #2
0
        protected override void DoCommandAction()
        {
            IslandStyleSystemParameter systemParameter = new IslandStyleSystemParameter();

            systemParameter.Read(XMLSpecificationInput);

            if (systemParameter.PartialAreas.Count != 1)
            {
                throw new ArgumentException("Expecting only one island");
            }

            if (!Directory.Exists(XMLSpecificationOutputDirectory))
            {
                Directory.CreateDirectory(XMLSpecificationOutputDirectory);
            }

            foreach (KeyValuePair <string, PartialAreaSetting> tupel in systemParameter.PartialAreas)
            {
                if (tupel.Value.Modules.Count != 1)
                {
                    throw new ArgumentException("Expecting only one module setting");
                }
                ModuleSetting ms = tupel.Value.Modules[0];
                if (!ms.Settings.ContainsKey("netlist") || !ms.Settings.ContainsKey("name"))
                {
                    throw new ArgumentException("Expecting a value for a netlist and name in the module setting");
                }
                string path = ms.Settings["netlist"];
                string name = ms.Settings["name"];
                // is it a file
                if (!File.Exists(path))
                {
                    throw new ArgumentException("File " + path + " does not exist");
                }

                FindPlacementForReconfigurableArea selCmd = new FindPlacementForReconfigurableArea();
                selCmd.InstancePrefix = name;
                selCmd.XDLModules.Add(path);
                selCmd.TopN = TopN;
                selCmd.UserSelectionPrefix = "min_frag_for_placing_an_island_";
                CommandExecuter.Instance.Execute(selCmd);

                for (int i = 1; i < TopN; i++)
                {
                    systemParameter.PartialAreas[tupel.Key].Nodes[IslandStyleSystemParameter.Geometry].InnerText = "";

                    foreach (Command cmd in FPGA.TileSelectionManager.Instance.GetListOfAddToSelectionXYCommandsForUserSelection("min_frag_for_placing_an_island_" + i))
                    {
                        systemParameter.PartialAreas[tupel.Key].Nodes[IslandStyleSystemParameter.Geometry].InnerText += cmd.ToString();
                    }

                    string projectDir = XMLSpecificationOutputDirectory + @"\run" + i.ToString() + @"\";
                    systemParameter.StaticParameter[IslandStyleSystemParameter.ISEProjectDir].InnerText = projectDir;

                    string specificationOutputFileWithoutExtension = projectDir + Path.GetFileNameWithoutExtension(XMLSpecificationInput);

                    // save modifications
                    systemParameter.XmlDoc.Save(specificationOutputFileWithoutExtension + ".xml");
                }
            }
        }