MCPcopy Create free account
hub / github.com/chipsalliance/Surelog / main

Function main

src/hellodesign.cpp:81–122  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

79}
80
81int main(int argc, const char **argv) {
82 if (argc < 2) return 0;
83
84 // Read command line, compile a design, use -parse argument
85 int32_t code = 0;
86 SURELOG::SymbolTable *const symbolTable = new SURELOG::SymbolTable();
87 SURELOG::ErrorContainer *const errors =
88 new SURELOG::ErrorContainer(symbolTable);
89 SURELOG::CommandLineParser *const clp =
90 new SURELOG::CommandLineParser(errors, symbolTable, false, false);
91 clp->noPython();
92 clp->setwritePpOutput(true);
93 clp->setParse(true);
94 clp->setCompile(true);
95 clp->setElaborate(true); // Request Surelog instance tree elaboration
96 clp->setElabUhdm(true); // Request UHDM Uniquification/Elaboration
97 bool success = clp->parseCommandLine(argc, argv);
98 errors->printMessages(clp->muteStdout());
99
100 vpiHandle vpi_design = nullptr;
101 SURELOG::scompiler *compiler = nullptr;
102 if (success && (!clp->help())) {
103 compiler = SURELOG::start_compiler(clp);
104 vpi_design = SURELOG::get_uhdm_design(compiler);
105 auto stats = errors->getErrorStats();
106 code = (!success) | stats.nbFatal | stats.nbSyntax | stats.nbError;
107 }
108
109 SURELOG::ErrorContainer::Stats stats = errors->getErrorStats();
110 errors->printStats(stats, false);
111
112 if (vpi_design == nullptr) return code;
113
114 if (!Build(vpi_design)) return -1;
115
116 // Do not delete these objects until you are done with UHDM
117 SURELOG::shutdown_compiler(compiler);
118 delete clp;
119 delete symbolTable;
120 delete errors;
121 return 0;
122}

Callers

nothing calls this directly

Calls 15

start_compilerFunction · 0.85
get_uhdm_designFunction · 0.85
BuildFunction · 0.85
shutdown_compilerFunction · 0.85
noPythonMethod · 0.80
setwritePpOutputMethod · 0.80
setParseMethod · 0.80
setCompileMethod · 0.80
setElaborateMethod · 0.80
setElabUhdmMethod · 0.80
parseCommandLineMethod · 0.80
printMessagesMethod · 0.80

Tested by

no test coverage detected