From 2dfcf18167f619852c69a6ebee8bf4a78e1349cf Mon Sep 17 00:00:00 2001 From: Andrew Waterman Date: Tue, 30 Aug 2016 16:49:39 -0700 Subject: [PATCH] Filter simv command-line args starting with -cm These confuse HTIF, so don't pass them through. Contributed by @scottj97. --- csrc/SimDTM.cc | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) 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;