private static int RunOpts(SVCodeGenOptions opts)
        {
            Stream input;
            bool   txt = false;

            Directory.SetCurrentDirectory(opts.OutputDir);

            if (opts.InputFile == "-")
            {
                Console.WriteLine("Elastic Silicon Interconnect SystemVerilog code generator");
                Console.WriteLine("expecting binary-encoded code generation request from standard input");

                input = Console.OpenStandardInput();
            }
            else
            {
                input = new FileStream(opts.InputFile, FileMode.Open, FileAccess.Read);
                txt   = opts.InputFile.EndsWith(".capnp");
            }

            using (var esiCtxt = new EsiContext())
            {
                esiCtxt.Log.Information("Starting conversion to EsiTypes");
                EsiSystem sys;
                if (txt)
                {
                    sys = EsiCapnpReader.ConvertTextSchema(esiCtxt, new FileInfo(opts.InputFile));
                }
                else
                {
                    sys = EsiCapnpReader.ConvertFromCGRMessage(esiCtxt, input);
                }
                esiCtxt.Log.Information("Completed reading capnp message");
                esiCtxt.Log.Information("Starting SV interface output");
                var sv = new EsiSystemVerilogInterfaceWriter(esiCtxt, sys);
                sv.WriteSV();
                esiCtxt.Log.Information("Completed SV interface output");
            }

            return(0);
        }
Пример #2
0
 public EsiSystem ReadSchema(string resource)
 {
     return(EsiCapnpReader.ConvertTextSchema(C, ResolveResource(resource)));
 }