public void TestCoordinateSystemExtensions()
        {
            var prjString = ReadFile("Clarke 1880 (RGS).prj");

            PrjFile prjFile = PrjFile.Parse(prjString);

            var prjFile2 = prjFile.AsMapProjection().AsEsriPrj();

            var temp = prjFile.AsEsriCrsWkt() == prjFile2.AsEsriCrsWkt();

            Assert.Fail();
        }
        public override void Execute()
        {
            base.Execute();

            if (!string.IsNullOrEmpty(TopModule))
            {
                PrjFile prj = new PrjFile(Program.Repository);

                foreach (string core in Cores)
                {
                    Logger.Instance.WriteVerbose("Selecting Core: {0}", core);
                    prj.AddAllInLibrary(prj.Environment.GetLibrary(core));
                }

                // Select top module
                string[] splitModule = TopModule.Split('.');

                ILibrary library = prj.Environment.GetLibrary(splitModule[0]);
                if (library != null)
                {
                    IModule module = library.Modules.First((m) => string.Compare(m.Name, splitModule[1], true) == 0);
                    if (module != null)
                    {
                        Logger.Instance.WriteVerbose("Selected module '{0}' in library '{1}'", module.Name, library.Name);

                        string workingDirectory = XilinxSynthesizer.GenerateWorkingDirectory();
                        Logger.Instance.WriteVerbose("Starting Build");
                        XilinxSynthesizer.BuildResult result = XilinxSynthesizer.BuildProject(workingDirectory, prj, module);
                        Logger.Instance.WriteVerbose("Build Complete");

                        Logger.Instance.WriteDebug(result.BuildLog);

                        Logger.Instance.WriteVerbose("Cleaning temporary directory");
                        Directory.Delete(workingDirectory, true);
                    }
                    else
                    {
                        Logger.Instance.WriteError("Top Level module does not existing in library '{0}'", library.Name);
                    }
                }
                else
                {
                    Logger.Instance.WriteError("Top Level module library does not exist in the repository");
                }
            }
            else
            {
                Logger.Instance.WriteError("Top Level Module not specified, terminating...");
            }
        }
Example #3
0
        public static BuildResult BuildProject(string workingDirectory, PrjFile projectFile, IModule topModule)
        {
            // Create prj file on disk
            string toplevelComponentName = string.Format("{0}.{1}", topModule.Parent.Name, topModule.Name);
            string projectFilePath       = PathHelper.Combine(workingDirectory, "projectfile.prj");

            File.WriteAllText(projectFilePath, projectFile.ToString(ExecutionType.SynthesisOnly));
            string projectXstFilePath = PathHelper.Combine(workingDirectory, "projectfile.xst");
            string projectSyrFilePath = PathHelper.Combine(workingDirectory, "projectfile.syr");
            string projectXstPath     = PathHelper.Combine(workingDirectory, "xst");
            string projectTmpPath     = PathHelper.Combine(projectXstPath, ".tmp");

            File.WriteAllText(projectXstFilePath, GenerateScript(workingDirectory, projectFilePath, topModule.Name));

            Directory.CreateDirectory(projectXstPath);
            Directory.CreateDirectory(projectTmpPath);

            Logger.Instance.WriteDebug("Top Level component name: {0}", toplevelComponentName);
            Logger.Instance.WriteDebug("Xst path: {0}", projectXstFilePath);

            List <string> arguments = new List <string>();

            arguments.Add(string.Format("-ifn \"{0}\"", projectXstFilePath));
            arguments.Add(string.Format("-ofn \"{0}\"", projectSyrFilePath));

            XilinxProcess         process      = new XilinxProcess("xst", arguments);
            DefaultMessageParser  parser       = new DefaultMessageParser();
            StringProcessListener stringParser = new StringProcessListener();

            parser.MessageOccured += ((obj) => obj.WriteToLogger());

            process.Listeners.Add(parser);
            process.Listeners.Add(stringParser);
            process.WorkingDirectory = workingDirectory;

            process.Start();
            process.WaitForExit();

            BuildResult buildResult = new BuildResult();

            buildResult.BuildLog         = stringParser.Output + "\n\n\n" + stringParser.ErrorOutput;
            buildResult.WorkingDirectory = workingDirectory;

            File.Delete(projectFilePath);
            File.Delete(projectXstFilePath);
            Directory.Delete(PathHelper.Combine(workingDirectory, "xst"), true);

            return(buildResult);
        }
Example #4
0
        public override void Execute()
        {
            base.Execute();

            if (!string.IsNullOrEmpty(TopModule))
            {
                PrjFile prj = new PrjFile(Program.Repository);

                foreach (string core in Cores)
                {
                    Logger.Instance.WriteVerbose("Selecting Core: {0}", core);
                    prj.AddAllInLibrary(prj.Environment.GetLibrary(core));
                }

                // Select top module
                string[] splitModule = TopModule.Split('.');

                ILibrary library = prj.Environment.GetLibrary(splitModule[0]);
                if (library != null)
                {
                    IModule module = library.Modules.First((m) => string.Compare(m.Name, splitModule[1], true) == 0);
                    if (module != null)
                    {
                        Logger.Instance.WriteVerbose("Selected module '{0}' in library '{1}'", module.Name, library.Name);

                        ISimInstance instance = new ISimInstance(prj, module);
                        if (UseGraphicalUserInterface)
                        {
                            Logger.Instance.WriteVerbose("Using Graphical User Interface");
                        }
                        instance.UseGraphicalUserInterface = UseGraphicalUserInterface;
                        instance.Start();
                        instance.Stop();
                    }
                    else
                    {
                        Logger.Instance.WriteError("Top Level module does not existing in library '{0}'", library.Name);
                    }
                }
                else
                {
                    Logger.Instance.WriteError("Top Level module library does not exist in the repository");
                }
            }
            else
            {
                Logger.Instance.WriteError("Top Level Module not specified, terminating...");
            }
        }
Example #5
0
        public static BuildResult BuildProject(string workingDirectory, PrjFile projectFile, IModule topModule)
        {
            // Create prj file on disk
            string toplevelComponentName = string.Format("{0}.{1}", topModule.Parent.Name, topModule.Name);
            string projectFilePath = PathHelper.Combine(workingDirectory, "projectfile.prj");
            File.WriteAllText(projectFilePath, projectFile.ToString(ExecutionType.SynthesisOnly));
            string projectXstFilePath = PathHelper.Combine(workingDirectory, "projectfile.xst");
            string projectSyrFilePath = PathHelper.Combine(workingDirectory, "projectfile.syr");
            string projectXstPath = PathHelper.Combine(workingDirectory, "xst");
            string projectTmpPath = PathHelper.Combine(projectXstPath, ".tmp");
            File.WriteAllText(projectXstFilePath, GenerateScript(workingDirectory, projectFilePath, topModule.Name));

            Directory.CreateDirectory(projectXstPath);
            Directory.CreateDirectory(projectTmpPath);

            Logger.Instance.WriteDebug("Top Level component name: {0}", toplevelComponentName);
            Logger.Instance.WriteDebug("Xst path: {0}", projectXstFilePath);

            List<string> arguments = new List<string>();
            arguments.Add(string.Format("-ifn \"{0}\"", projectXstFilePath));
            arguments.Add(string.Format("-ofn \"{0}\"", projectSyrFilePath));

            XilinxProcess process = new XilinxProcess("xst", arguments);
            DefaultMessageParser parser = new DefaultMessageParser();
            StringProcessListener stringParser = new StringProcessListener();
            parser.MessageOccured += ((obj) => obj.WriteToLogger());

            process.Listeners.Add(parser);
            process.Listeners.Add(stringParser);
            process.WorkingDirectory = workingDirectory;

            process.Start();
            process.WaitForExit();

            BuildResult buildResult = new BuildResult();
            buildResult.BuildLog = stringParser.Output + "\n\n\n" + stringParser.ErrorOutput;
            buildResult.WorkingDirectory = workingDirectory;

            File.Delete(projectFilePath);
            File.Delete(projectXstFilePath);
            Directory.Delete(PathHelper.Combine(workingDirectory, "xst"), true);

            return buildResult;
        }
Example #6
0
        public override void Execute()
        {
            base.Execute();

            ExecutionType executionType = ExecutionType.All;

            if (SimulationExecutionOnly && SynthesisExecutionOnly)
            {
                Logger.Instance.WriteWarning("Selected both Simulation only and Synthesis only, defaulting to All");
            }
            else if (SimulationExecutionOnly)
            {
                Logger.Instance.WriteVerbose("Selecting only Simulation modules.");
                executionType = ExecutionType.SimulationOnly;
            }
            else if (SynthesisExecutionOnly)
            {
                Logger.Instance.WriteVerbose("Selecting only Synthesis modules.");
                executionType = ExecutionType.SynthesisOnly;
            }

            if (!string.IsNullOrEmpty(OutputPath))
            {
                PrjFile prj = new PrjFile(Program.Repository);

                foreach (string core in Cores)
                {
                    Logger.Instance.WriteVerbose("Selecting Core: {0}", core);
                    prj.AddAllInLibrary(prj.Environment.GetLibrary(core));
                }

                Logger.Instance.WriteVerbose("Generating...");
                File.WriteAllText(OutputPath, prj.ToString(executionType));
                Logger.Instance.WriteVerbose("Generated!");
            }
            else
            {
                Logger.Instance.WriteError("Output Path not specified, terminating...");
            }
        }
Example #7
0
        public static BuildResult BuildProject(string workingDirectory, PrjFile projectFile, string topModule)
        {
            // Create prj file on disk
            string projectFilePath = PathHelper.Combine(workingDirectory, "projectfile.prj");
            File.WriteAllText(projectFilePath, projectFile.ToString(ExecutionType.SimulationOnly));

            BuildResult result = null;
            try
            {
                result = BuildProject(workingDirectory, projectFilePath, topModule);
            }
            catch
            {
                // Clean up and rethrow
                File.Delete(projectFilePath);
                throw;
            }

            File.Delete(projectFilePath);

            return result;
        }
Example #8
0
        public static BuildResult BuildProject(string workingDirectory, PrjFile projectFile, string topModule)
        {
            // Create prj file on disk
            string projectFilePath = PathHelper.Combine(workingDirectory, "projectfile.prj");

            File.WriteAllText(projectFilePath, projectFile.ToString(ExecutionType.SimulationOnly));

            BuildResult result = null;

            try
            {
                result = BuildProject(workingDirectory, projectFilePath, topModule);
            }
            catch
            {
                // Clean up and rethrow
                File.Delete(projectFilePath);
                throw;
            }

            File.Delete(projectFilePath);

            return(result);
        }
Example #9
0
 public static BuildResult BuildProject(string workingDirectory, PrjFile projectFile, IModule topModule)
 {
     return(BuildProject(workingDirectory, projectFile, string.Format("{0}.{1}", topModule.Parent.Name, topModule.Name)));
 }
Example #10
0
 public static BuildResult BuildProject(string workingDirectory, PrjFile projectFile, IModule topModule)
 {
     return BuildProject(workingDirectory, projectFile, string.Format("{0}.{1}", topModule.Parent.Name, topModule.Name));
 }
Example #11
0
 public ISimInstance(PrjFile project, IModule topModule)
 {
     Project = project;
     TopModule = topModule;
 }
Example #12
0
 public ISimInstance(PrjFile project, IModule topModule)
 {
     Project   = project;
     TopModule = topModule;
 }