diff options
author | Clifford Wolf <clifford@clifford.at> | 2014-02-02 13:06:21 +0100 |
---|---|---|
committer | Clifford Wolf <clifford@clifford.at> | 2014-02-02 13:06:21 +0100 |
commit | cdd6e11af52c3791b84875966d63ec9775774031 (patch) | |
tree | 1e4852919c5af307e6845db97e98f85d33708989 /frontends/verilog | |
parent | f4f0bd6eeff3d7307c6290025d22b126779939a1 (diff) | |
download | yosys-cdd6e11af52c3791b84875966d63ec9775774031.tar.gz yosys-cdd6e11af52c3791b84875966d63ec9775774031.tar.bz2 yosys-cdd6e11af52c3791b84875966d63ec9775774031.zip |
Added support for blanks after -I and -D in read_verilog
Diffstat (limited to 'frontends/verilog')
-rw-r--r-- | frontends/verilog/verilog_frontend.cc | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/frontends/verilog/verilog_frontend.cc b/frontends/verilog/verilog_frontend.cc index 1f4a4c893..6e9c00d0b 100644 --- a/frontends/verilog/verilog_frontend.cc +++ b/frontends/verilog/verilog_frontend.cc @@ -195,18 +195,31 @@ struct VerilogFrontend : public Frontend { flag_ignore_redef = true; continue; } - if (arg.compare(0,2,"-D") == 0) { - size_t equal = arg.find('=',2); // returns string::npos it not found - std::string name = arg.substr(2,equal-2); - std::string value; + if (arg == "-D" && argidx+1 < args.size()) { + std::string name = args[++argidx], value; + size_t equal = name.find('=', 2); if (equal != std::string::npos) { - value = arg.substr(equal+1,std::string::npos); + value = arg.substr(equal+1); + name = arg.substr(0, equal); } defines_map[name] = value; continue; } - if (arg.compare(0,2,"-I") == 0) { - include_dirs.push_back(arg.substr(2,std::string::npos)); + if (arg.compare(0, 2, "-D") == 0) { + size_t equal = arg.find('=', 2); + std::string name = arg.substr(2, equal-2); + std::string value; + if (equal != std::string::npos) + value = arg.substr(equal+1); + defines_map[name] = value; + continue; + } + if (arg == "-I" && argidx+1 < args.size()) { + include_dirs.push_back(args[++argidx]); + continue; + } + if (arg.compare(0, 2, "-I") == 0) { + include_dirs.push_back(arg.substr(2)); continue; } break; |