mirror of https://github.com/YosysHQ/yosys.git
Merge pull request #3802 from YosysHQ/micko/build_full
Improve Verific usage in plugins
This commit is contained in:
commit
a310bd2d23
11
Makefile
11
Makefile
|
@ -523,6 +523,7 @@ CXXFLAGS += -I$(GHDL_INCLUDE_DIR) -DYOSYS_ENABLE_GHDL
|
||||||
LDLIBS += $(GHDL_LIB_DIR)/libghdl.a $(file <$(GHDL_LIB_DIR)/libghdl.link)
|
LDLIBS += $(GHDL_LIB_DIR)/libghdl.a $(file <$(GHDL_LIB_DIR)/libghdl.link)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
LDLIBS_VERIFIC =
|
||||||
ifeq ($(ENABLE_VERIFIC),1)
|
ifeq ($(ENABLE_VERIFIC),1)
|
||||||
VERIFIC_DIR ?= /usr/local/src/verific_lib
|
VERIFIC_DIR ?= /usr/local/src/verific_lib
|
||||||
VERIFIC_COMPONENTS ?= verilog database util containers hier_tree
|
VERIFIC_COMPONENTS ?= verilog database util containers hier_tree
|
||||||
|
@ -548,9 +549,9 @@ CXXFLAGS += -DYOSYSHQ_VERIFIC_EXTENSIONS
|
||||||
endif
|
endif
|
||||||
CXXFLAGS += $(patsubst %,-I$(VERIFIC_DIR)/%,$(VERIFIC_COMPONENTS)) -DYOSYS_ENABLE_VERIFIC
|
CXXFLAGS += $(patsubst %,-I$(VERIFIC_DIR)/%,$(VERIFIC_COMPONENTS)) -DYOSYS_ENABLE_VERIFIC
|
||||||
ifeq ($(OS), Darwin)
|
ifeq ($(OS), Darwin)
|
||||||
LDLIBS += $(patsubst %,$(VERIFIC_DIR)/%/*-mac.a,$(VERIFIC_COMPONENTS)) -lz
|
LDLIBS_VERIFIC += $(foreach comp,$(patsubst %,$(VERIFIC_DIR)/%/*-mac.a,$(VERIFIC_COMPONENTS)),-Wl,-force_load $(comp)) -lz
|
||||||
else
|
else
|
||||||
LDLIBS += $(patsubst %,$(VERIFIC_DIR)/%/*-linux.a,$(VERIFIC_COMPONENTS)) -lz
|
LDLIBS_VERIFIC += -Wl,--whole-archive $(patsubst %,$(VERIFIC_DIR)/%/*-linux.a,$(VERIFIC_COMPONENTS)) -Wl,--no-whole-archive -lz
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -740,13 +741,13 @@ yosys.js: $(filter-out yosysjs-$(YOSYS_VER).zip,$(EXTRA_TARGETS))
|
||||||
endif
|
endif
|
||||||
|
|
||||||
$(PROGRAM_PREFIX)yosys$(EXE): $(OBJS)
|
$(PROGRAM_PREFIX)yosys$(EXE): $(OBJS)
|
||||||
$(P) $(LD) -o $(PROGRAM_PREFIX)yosys$(EXE) $(EXE_LDFLAGS) $(LDFLAGS) $(OBJS) $(LDLIBS)
|
$(P) $(LD) -o $(PROGRAM_PREFIX)yosys$(EXE) $(EXE_LDFLAGS) $(LDFLAGS) $(OBJS) $(LDLIBS) $(LDLIBS_VERIFIC)
|
||||||
|
|
||||||
libyosys.so: $(filter-out kernel/driver.o,$(OBJS))
|
libyosys.so: $(filter-out kernel/driver.o,$(OBJS))
|
||||||
ifeq ($(OS), Darwin)
|
ifeq ($(OS), Darwin)
|
||||||
$(P) $(LD) -o libyosys.so -shared -Wl,-install_name,$(LIBDIR)/libyosys.so $(LDFLAGS) $^ $(LDLIBS)
|
$(P) $(LD) -o libyosys.so -shared -Wl,-install_name,$(LIBDIR)/libyosys.so $(LDFLAGS) $^ $(LDLIBS) $(LDLIBS_VERIFIC)
|
||||||
else
|
else
|
||||||
$(P) $(LD) -o libyosys.so -shared -Wl,-soname,$(LIBDIR)/libyosys.so $(LDFLAGS) $^ $(LDLIBS)
|
$(P) $(LD) -o libyosys.so -shared -Wl,-soname,$(LIBDIR)/libyosys.so $(LDFLAGS) $^ $(LDLIBS) $(LDLIBS_VERIFIC)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
%.o: %.cc
|
%.o: %.cc
|
||||||
|
|
|
@ -112,15 +112,26 @@ void msg_func(msg_type_t msg_type, const char *message_id, linefile_type linefil
|
||||||
string message = linefile ? stringf("%s:%d: ", LineFile::GetFileName(linefile), LineFile::GetLineNo(linefile)) : "";
|
string message = linefile ? stringf("%s:%d: ", LineFile::GetFileName(linefile), LineFile::GetLineNo(linefile)) : "";
|
||||||
message += vstringf(msg, args);
|
message += vstringf(msg, args);
|
||||||
|
|
||||||
if (msg_type == VERIFIC_ERROR || msg_type == VERIFIC_WARNING || msg_type == VERIFIC_PROGRAM_ERROR)
|
if (log_verific_callback) {
|
||||||
log_warning_noprefix("%s%s\n", message_prefix.c_str(), message.c_str());
|
string full_message = stringf("%s%s\n", message_prefix.c_str(), message.c_str());
|
||||||
else
|
log_verific_callback(int(msg_type), message_id, LineFile::GetFileName(linefile), LineFile::GetLineNo(linefile), full_message.c_str());
|
||||||
log("%s%s\n", message_prefix.c_str(), message.c_str());
|
} else {
|
||||||
|
if (msg_type == VERIFIC_ERROR || msg_type == VERIFIC_WARNING || msg_type == VERIFIC_PROGRAM_ERROR)
|
||||||
|
log_warning_noprefix("%s%s\n", message_prefix.c_str(), message.c_str());
|
||||||
|
else
|
||||||
|
log("%s%s\n", message_prefix.c_str(), message.c_str());
|
||||||
|
}
|
||||||
if (verific_error_msg.empty() && (msg_type == VERIFIC_ERROR || msg_type == VERIFIC_PROGRAM_ERROR))
|
if (verific_error_msg.empty() && (msg_type == VERIFIC_ERROR || msg_type == VERIFIC_PROGRAM_ERROR))
|
||||||
verific_error_msg = message;
|
verific_error_msg = message;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void set_verific_logging(void (*cb)(int msg_type, const char *message_id, const char* file_path, unsigned int line_no, const char *msg))
|
||||||
|
{
|
||||||
|
Message::SetConsoleOutput(0);
|
||||||
|
Message::RegisterCallBackMsg(msg_func);
|
||||||
|
log_verific_callback = cb;
|
||||||
|
}
|
||||||
|
|
||||||
string get_full_netlist_name(Netlist *nl)
|
string get_full_netlist_name(Netlist *nl)
|
||||||
{
|
{
|
||||||
if (nl->NumOfRefs() == 1) {
|
if (nl->NumOfRefs() == 1) {
|
||||||
|
|
|
@ -59,6 +59,7 @@ bool log_quiet_warnings = false;
|
||||||
int log_verbose_level;
|
int log_verbose_level;
|
||||||
string log_last_error;
|
string log_last_error;
|
||||||
void (*log_error_atexit)() = NULL;
|
void (*log_error_atexit)() = NULL;
|
||||||
|
void (*log_verific_callback)(int msg_type, const char *message_id, const char* file_path, unsigned int line_no, const char *msg) = NULL;
|
||||||
|
|
||||||
int log_make_debug = 0;
|
int log_make_debug = 0;
|
||||||
int log_force_debug = 0;
|
int log_force_debug = 0;
|
||||||
|
|
|
@ -130,6 +130,9 @@ void log_header(RTLIL::Design *design, const char *format, ...) YS_ATTRIBUTE(for
|
||||||
void log_warning(const char *format, ...) YS_ATTRIBUTE(format(printf, 1, 2));
|
void log_warning(const char *format, ...) YS_ATTRIBUTE(format(printf, 1, 2));
|
||||||
void log_experimental(const char *format, ...) YS_ATTRIBUTE(format(printf, 1, 2));
|
void log_experimental(const char *format, ...) YS_ATTRIBUTE(format(printf, 1, 2));
|
||||||
|
|
||||||
|
void set_verific_logging(void (*cb)(int msg_type, const char *message_id, const char* file_path, unsigned int line_no, const char *msg));
|
||||||
|
extern void (*log_verific_callback)(int msg_type, const char *message_id, const char* file_path, unsigned int line_no, const char *msg);
|
||||||
|
|
||||||
// Log with filename to report a problem in a source file.
|
// Log with filename to report a problem in a source file.
|
||||||
void log_file_warning(const std::string &filename, int lineno, const char *format, ...) YS_ATTRIBUTE(format(printf, 3, 4));
|
void log_file_warning(const std::string &filename, int lineno, const char *format, ...) YS_ATTRIBUTE(format(printf, 3, 4));
|
||||||
void log_file_info(const std::string &filename, int lineno, const char *format, ...) YS_ATTRIBUTE(format(printf, 3, 4));
|
void log_file_info(const std::string &filename, int lineno, const char *format, ...) YS_ATTRIBUTE(format(printf, 3, 4));
|
||||||
|
|
Loading…
Reference in New Issue