diff --git a/csrc/SimDTM.cc b/csrc/SimDTM.cc index 0f313a17..82e676ef 100644 --- a/csrc/SimDTM.cc +++ b/csrc/SimDTM.cc @@ -6,6 +6,27 @@ dtm_t* dtm; + +namespace { + + // Remove args that will confuse dtm, such as those that require two tokens, like VCS code coverage "-cm line+cond" +std::vector filter_argv_for_dtm(int argc, char** argv) +{ + std::vector out; + for (int i = 1; i < argc; ++i) { // start with 1 to skip my executable name + if (!strncmp(argv[i], "-cm", 3)) { + ++i; // skip this one and the next one + } + else { + out.push_back(argv[i]); + } + } + return out; +} + +} + + extern "C" int debug_tick ( unsigned char* debug_req_valid, @@ -23,7 +44,7 @@ extern "C" int debug_tick s_vpi_vlog_info info; if (!vpi_get_vlog_info(&info)) abort(); - dtm = new dtm_t(std::vector(info.argv + 1, info.argv + info.argc)); + dtm = new dtm_t(filter_argv_for_dtm(info.argc, info.argv)); } dtm_t::resp resp_bits;