mirror of https://github.com/YosysHQ/yosys.git
Made "cover" a compile-time option (disabled by default)
This commit is contained in:
parent
80869531b9
commit
a346c0bf2b
5
Makefile
5
Makefile
|
@ -11,6 +11,7 @@ ENABLE_ABC := 1
|
||||||
ENABLE_PLUGINS := 1
|
ENABLE_PLUGINS := 1
|
||||||
ENABLE_READLINE := 1
|
ENABLE_READLINE := 1
|
||||||
ENABLE_VERIFIC := 0
|
ENABLE_VERIFIC := 0
|
||||||
|
ENABLE_COVER := 0
|
||||||
|
|
||||||
# other configuration flags
|
# other configuration flags
|
||||||
ENABLE_GPROF := 0
|
ENABLE_GPROF := 0
|
||||||
|
@ -138,6 +139,10 @@ CXXFLAGS += $(patsubst %,-I$(VERIFIC_DIR)/%,$(VERIFIC_COMPONENTS)) -DYOSYS_ENABL
|
||||||
LDLIBS += $(patsubst %,$(VERIFIC_DIR)/%/*-linux.a,$(VERIFIC_COMPONENTS))
|
LDLIBS += $(patsubst %,$(VERIFIC_DIR)/%/*-linux.a,$(VERIFIC_COMPONENTS))
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(ENABLE_COVER),1)
|
||||||
|
CXXFLAGS += -DYOSYS_ENABLE_COVER
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(PRETTY), 1)
|
ifeq ($(PRETTY), 1)
|
||||||
P_STATUS = 0
|
P_STATUS = 0
|
||||||
P_OFFSET = 0
|
P_OFFSET = 0
|
||||||
|
|
|
@ -335,7 +335,7 @@ int main(int argc, char **argv)
|
||||||
log("%s\n", out_count ? "" : " no commands executed");
|
log("%s\n", out_count ? "" : " no commands executed");
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef COVER_ACTIVE
|
#ifdef YOSYS_ENABLE_COVER
|
||||||
if (getenv("YOSYS_COVER_DIR") || getenv("YOSYS_COVER_FILE"))
|
if (getenv("YOSYS_COVER_DIR") || getenv("YOSYS_COVER_FILE"))
|
||||||
{
|
{
|
||||||
char filename_buffer[4096];
|
char filename_buffer[4096];
|
||||||
|
|
|
@ -274,7 +274,7 @@ void log_cell(RTLIL::Cell *cell, std::string indent)
|
||||||
// ---------------------------------------------------
|
// ---------------------------------------------------
|
||||||
// This is the magic behind the code coverage counters
|
// This is the magic behind the code coverage counters
|
||||||
// ---------------------------------------------------
|
// ---------------------------------------------------
|
||||||
#ifdef COVER_ACTIVE
|
#ifdef YOSYS_ENABLE_COVER
|
||||||
|
|
||||||
std::map<std::string, std::pair<std::string, int>> extra_coverage_data;
|
std::map<std::string, std::pair<std::string, int>> extra_coverage_data;
|
||||||
|
|
||||||
|
|
|
@ -87,8 +87,7 @@ static inline void log_assert_worker(bool cond, const char *expr, const char *fi
|
||||||
// This is the magic behind the code coverage counters
|
// This is the magic behind the code coverage counters
|
||||||
// ---------------------------------------------------
|
// ---------------------------------------------------
|
||||||
|
|
||||||
#if defined(__linux__) && !defined(NDEBUG)
|
#ifdef YOSYS_ENABLE_COVER
|
||||||
#define COVER_ACTIVE
|
|
||||||
|
|
||||||
#define cover(_id) do { \
|
#define cover(_id) do { \
|
||||||
static CoverData __d __attribute__((section("yosys_cover_list"), aligned(1))) = { __FILE__, __FUNCTION__, _id, __LINE__, 0 }; \
|
static CoverData __d __attribute__((section("yosys_cover_list"), aligned(1))) = { __FILE__, __FUNCTION__, _id, __LINE__, 0 }; \
|
||||||
|
|
|
@ -128,7 +128,7 @@ struct CoverPass : public Pass {
|
||||||
log("\n");
|
log("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef COVER_ACTIVE
|
#ifdef YOSYS_ENABLE_COVER
|
||||||
for (auto &it : get_coverage_data()) {
|
for (auto &it : get_coverage_data()) {
|
||||||
if (!patterns.empty()) {
|
if (!patterns.empty()) {
|
||||||
for (auto &p : patterns)
|
for (auto &p : patterns)
|
||||||
|
@ -146,7 +146,7 @@ struct CoverPass : public Pass {
|
||||||
for (auto f : out_files)
|
for (auto f : out_files)
|
||||||
fclose(f);
|
fclose(f);
|
||||||
|
|
||||||
log_cmd_error("Coverage counters are only available in debug builds of Yosys for Linux.\n");
|
log_cmd_error("This version of Yosys was not built with support for code coverage counters.\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (auto f : out_files)
|
for (auto f : out_files)
|
||||||
|
|
Loading…
Reference in New Issue