144 bool flag_ppdump =
false;
145 bool flag_nopp =
false;
149 bool flag_ignore_redef =
false;
150 bool flag_defer =
false;
151 std::map<std::string, std::string> defines_map;
152 std::list<std::string> include_dirs;
153 std::list<std::string> attributes;
158 log_header(
"Executing Verilog-2005 frontend.\n");
163 for (argidx = 1; argidx <
args.size(); argidx++) {
164 std::string arg =
args[argidx];
169 if (arg ==
"-dump_ast1") {
170 flag_dump_ast1 =
true;
173 if (arg ==
"-dump_ast2") {
174 flag_dump_ast2 =
true;
177 if (arg ==
"-dump_vlog") {
178 flag_dump_vlog =
true;
181 if (arg ==
"-yydebug") {
185 if (arg ==
"-nolatches") {
186 flag_nolatches =
true;
189 if (arg ==
"-nomem2reg") {
190 flag_nomem2reg =
true;
193 if (arg ==
"-mem2reg") {
197 if (arg ==
"-ppdump") {
201 if (arg ==
"-nopp") {
209 if (arg ==
"-noopt") {
213 if (arg ==
"-icells") {
217 if (arg ==
"-ignore_redef") {
218 flag_ignore_redef =
true;
221 if (arg ==
"-defer") {
225 if (arg ==
"-setattr" && argidx+1 <
args.size()) {
229 if (arg ==
"-D" && argidx+1 <
args.size()) {
230 std::string name =
args[++argidx], value;
231 size_t equal = name.find(
'=', 2);
232 if (equal != std::string::npos) {
233 value = arg.substr(equal+1);
234 name = arg.substr(0, equal);
236 defines_map[name] = value;
239 if (arg.compare(0, 2,
"-D") == 0) {
240 size_t equal = arg.find(
'=', 2);
241 std::string name = arg.substr(2, equal-2);
243 if (equal != std::string::npos)
244 value = arg.substr(equal+1);
245 defines_map[name] = value;
248 if (arg ==
"-I" && argidx+1 <
args.size()) {
249 include_dirs.push_back(
args[++argidx]);
252 if (arg.compare(0, 2,
"-I") == 0) {
253 include_dirs.push_back(arg.substr(2));
260 log(
"Parsing %s input from `%s' to AST representation.\n",
sv_mode ?
"SystemVerilog" :
"Verilog", filename.c_str());
270 std::string code_after_preproc;
275 log(
"-- Verilog code after preprocessor --\n%s-- END OF DUMP --\n", code_after_preproc.c_str());
276 lexin =
new std::istringstream(code_after_preproc);
286 for (
auto &attr : attributes)
287 if (child->attributes.count(attr) == 0)
291 AST::process(design,
current_ast, flag_dump_ast1, flag_dump_ast2, flag_dump_vlog, flag_nolatches, flag_nomem2reg, flag_mem2reg, flag_lib, flag_noopt, flag_icells, flag_ignore_redef, flag_defer,
default_nettype_wire);
299 log(
"Successfully finished Verilog frontend.\n");
bool default_nettype_wire
static AstNode * mkconst_int(uint32_t v, bool is_signed, int width=32)
void log_header(const char *format,...)
std::string frontend_verilog_preproc(std::istream &f, std::string filename, const std::map< std::string, std::string > pre_defines_map, const std::list< std::string > include_dirs)
void(* set_line_num)(int)
static std::vector< std::string > verilog_defaults
static std::string escape_id(std::string str)
int frontend_verilog_yyget_lineno(void)
YOSYS_NAMESPACE_END int frontend_verilog_yydebug
int frontend_verilog_yyparse(void)
std::string current_filename
void log(const char *format,...)
void frontend_verilog_yyrestart(FILE *f)
void process(RTLIL::Design *design, AstNode *ast, bool dump_ast1, bool dump_ast2, bool dump_vlog, bool nolatches, bool nomem2reg, bool mem2reg, bool lib, bool noopt, bool icells, bool ignore_redef, bool defer, bool autowire)
int frontend_verilog_yylex_destroy(void)
void extra_args(std::istream *&f, std::string &filename, std::vector< std::string > args, size_t argidx)
void frontend_verilog_yyset_lineno(int)