protected override void DoCommandAction()
        {
            if (!System.IO.Directory.Exists(Directory))
            {
                throw new ArgumentException("Directory " + Directory + " does not exist");
            }
            string[] files = System.IO.Directory.GetFiles(Directory).Where(s =>
                                                                           s.EndsWith("xdl", StringComparison.OrdinalIgnoreCase) ||
                                                                           s.EndsWith("viv_rpt", StringComparison.OrdinalIgnoreCase)).ToArray();

            int fileCount = 0;

            foreach (string file in files)
            {
                string binFPGAFile = Path.ChangeExtension(file, "binFPGA");
                if (File.Exists(binFPGAFile))
                {
                    OutputManager.WriteOutput("File " + binFPGAFile + " already exists, skipping " + file);
                    continue;
                }

                if (file.EndsWith("xdl", StringComparison.OrdinalIgnoreCase))
                {
                    ReadXDL readCmd = new ReadXDL();
                    readCmd.FileName      = file;
                    readCmd.PrintProgress = PrintProgress;
                    readCmd.Profile       = Profile;
                    readCmd.ExcludePipsToBidirectionalWiresFromBlocking = ExcludePipsToBidirectionalWiresFromBlocking;
                    CommandExecuter.Instance.Execute(readCmd);
                }
                else if (file.EndsWith("viv_rpt", StringComparison.OrdinalIgnoreCase))
                {
                    ReadVivadoFPGA readCmd = new ReadVivadoFPGA();
                    readCmd.FileName      = file;
                    readCmd.PrintProgress = PrintProgress;
                    readCmd.Profile       = Profile;
                    readCmd.ExcludePipsToBidirectionalWiresFromBlocking = ExcludePipsToBidirectionalWiresFromBlocking;
                    CommandExecuter.Instance.Execute(readCmd);
                }
                else
                {
                    continue;
                }
                SaveBinFPGA saveCmd = new SaveBinFPGA();
                saveCmd.FileName = binFPGAFile;
                CommandExecuter.Instance.Execute(saveCmd);

                ProgressInfo.Progress = (int)((double)fileCount++ / (double)files.Length);
            }
        }
Beispiel #2
0
        protected override void DoCommandAction()
        {
            List <StringTripel> files = new List <StringTripel>();

            foreach (string package in GetAllPackages().Where(p => Regex.IsMatch(p, FPGAFilter)))
            {
                string[] atoms           = Regex.Split(package, "\t");
                string   deviceName      = atoms[0];
                string   xdlFileName     = StorePath + Path.DirectorySeparatorChar + package + ".xdl";
                string   binFPGAFileName = StorePath + Path.DirectorySeparatorChar + package + ".binFPGA";

                /*
                 * StringTripel tripel = new StringTripel();
                 * tripel.xdlFileName = xdlFileName;
                 * tripel.binFPGAFileName = binFPGAFileName;
                 * tripel.decivceName = deviceName;
                 * files.Add(tripel);
                 * */

                if (!PrintCommandsOnly)
                {
                    GenerateXDL(xdlFileName, binFPGAFileName, deviceName);
                }
            }

            /*
             * if (!this.PrintCommandsOnly)
             * {
             *  // generate XDL in parallel
             *  ParallelOptions parallelOptions = new ParallelOptions();
             *  parallelOptions.MaxDegreeOfParallelism = this.MaxDegreeOfParallelism;
             *  Parallel.ForEach(files, parallelOptions, tripel => { this.GenerateXDL(tripel.xdlFileName, tripel.binFPGAFileName, tripel.decivceName); });
             * }*/

            // read and serialize must be sequentiell
            foreach (StringTripel tripel in files)
            {
                if (File.Exists(tripel.binFPGAFileName) && KeepExisting_binFPGAS)
                {
                    // TODO check if tripel.binFPGAFileName maybe deserialzed, if not ReadXDL!
                    continue;
                }

                // parse in ...
                ReadXDL read = new ReadXDL();
                read.FileName      = tripel.xdlFileName;
                read.PrintProgress = true;
                read.ExcludePipsToBidirectionalWiresFromBlocking = ExcludePipsToBidirectionalWiresFromBlocking;
                // ... and serialize
                SaveBinFPGA save = new SaveBinFPGA();
                save.FileName = tripel.binFPGAFileName;
                save.Compress = Compress;

                if (PrintCommandsOnly)
                {
                    OutputManager.WriteOutput(read.ToString());
                    OutputManager.WriteOutput(save.ToString());
                }
                else
                {
                    CommandExecuter.Instance.Execute(read);
                    CommandExecuter.Instance.Execute(save);

                    // remove?
                    if (!KeepXDLFiles)
                    {
                        File.Delete(tripel.xdlFileName);
                    }
                }
            }
        }