Add support for EDIF file reading using Verific

This commit is contained in:
Miodrag Milanovic 2022-10-04 09:18:44 +02:00
parent f5e2c0a498
commit 1a6f10e8ba
2 changed files with 52 additions and 1 deletions

View File

@ -18,6 +18,7 @@ ENABLE_READLINE := 1
ENABLE_EDITLINE := 0
ENABLE_GHDL := 0
ENABLE_VERIFIC := 0
ENABLE_VERIFIC_EDIF := 0
DISABLE_VERIFIC_EXTENSIONS := 0
DISABLE_VERIFIC_VHDL := 0
ENABLE_COVER := 1
@ -527,6 +528,10 @@ ifneq ($(wildcard $(VERIFIC_DIR)/vhdl),)
VERIFIC_COMPONENTS += vhdl
endif
endif
ifeq ($(ENABLE_VERIFIC_EDIF),1)
VERIFIC_COMPONENTS += edif
CXXFLAGS += -DVERIFIC_EDIF_SUPPORT
endif
ifneq ($(DISABLE_VERIFIC_EXTENSIONS),1)
VERIFIC_COMPONENTS += extensions
CXXFLAGS += -DYOSYSHQ_VERIFIC_EXTENSIONS

View File

@ -53,6 +53,10 @@ USING_YOSYS_NAMESPACE
#include "VhdlUnits.h"
#endif
#ifdef VERIFIC_EDIF_SUPPORT
#include "edif_file.h"
#endif
#include "VerificStream.h"
#include "FileSystem.h"
@ -2351,6 +2355,9 @@ void verific_import(Design *design, const std::map<std::string,std::string> &par
veri_file::Reset();
#ifdef VERIFIC_VHDL_SUPPORT
vhdl_file::Reset();
#endif
#ifdef VERIFIC_EDIF_SUPPORT
edif_file::Reset();
#endif
Libset::Reset();
Message::Reset();
@ -2412,6 +2419,13 @@ struct VerificPass : public Pass {
log("Load the specified VHDL files into Verific.\n");
log("\n");
log("\n");
#endif
#ifdef VERIFIC_EDIF_SUPPORT
log(" verific {-edif} <edif-file>..\n");
log("\n");
log("Load the specified EDIF files into Verific.\n");
log("\n");
log("\n");
#endif
log(" verific {-f|-F} [-vlog95|-vlog2k|-sv2005|-sv2009|\n");
log(" -sv2012|-sv|-formal] <command-file>\n");
@ -2958,7 +2972,18 @@ struct VerificPass : public Pass {
goto check_error;
}
#endif
#ifdef VERIFIC_EDIF_SUPPORT
if (GetSize(args) > argidx && args[argidx] == "-edif") {
edif_file edif;
argidx++;
while (argidx < GetSize(args)) {
std::string filename = frontent_rewrite(args, argidx, tmp_files);
if (!edif.Read(filename.c_str()))
log_cmd_error("Reading `%s' in EDIF mode failed.\n", filename.c_str());
}
goto check_error;
}
#endif
if (argidx < GetSize(args) && args[argidx] == "-pp")
{
const char* filename = nullptr;
@ -3221,6 +3246,9 @@ struct VerificPass : public Pass {
veri_file::Reset();
#ifdef VERIFIC_VHDL_SUPPORT
vhdl_file::Reset();
#endif
#ifdef VERIFIC_EDIF_SUPPORT
edif_file::Reset();
#endif
Libset::Reset();
Message::Reset();
@ -3347,6 +3375,13 @@ struct ReadPass : public Pass {
log("Load the specified VHDL files. (Requires Verific.)\n");
log("\n");
log("\n");
#endif
#ifdef VERIFIC_EDIF_SUPPORT
log(" read {-edif} <edif-file>..\n");
log("\n");
log("Load the specified EDIF files. (Requires Verific.)\n");
log("\n");
log("\n");
#endif
log(" read {-f|-F} <command-file>\n");
log("\n");
@ -3440,6 +3475,17 @@ struct ReadPass : public Pass {
}
return;
}
#endif
#ifdef VERIFIC_EDIF_SUPPORT
if (args[1] == "-edif") {
if (use_verific) {
args[0] = "verific";
Pass::call(design, args);
} else {
cmd_error(args, 1, "This version of Yosys is built without Verific support.\n");
}
return;
}
#endif
if (args[1] == "-f" || args[1] == "-F") {
if (use_verific) {