| 79 | } |
| 80 | |
| 81 | int 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 | } |
nothing calls this directly
no test coverage detected