Skip to content

Commit

Permalink
Beginnings of UPF support
Browse files Browse the repository at this point in the history
  • Loading branch information
akashlevy committed Nov 21, 2024
1 parent 2b39770 commit 6a7e2d2
Showing 1 changed file with 70 additions and 0 deletions.
70 changes: 70 additions & 0 deletions frontends/verific/verific.cc
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ USING_YOSYS_NAMESPACE
#include "SynlibGroup.h"
#endif

#ifdef VERIFIC_UPF_SUPPORT
#include "upf_file.h"
#include "UpfRuntimeFlags.h"
#endif

#include "VerificStream.h"
#include "FileSystem.h"

Expand Down Expand Up @@ -1289,6 +1294,49 @@ bool VerificImporter::import_netlist_instance_cells(Instance *inst, RTLIL::IdStr
return true;
}

#ifdef VERIFIC_UPF_SUPPORT
if (inst->Type() == PRIM_UPF_POWER_SWITCH)
{
log("TODO: PRIM_UPF_POWER_SWITCH\n");
return true;
}
if (inst->Type() == PRIM_UPF_RETENTION_DLATCH)
{
log("TODO: PRIM_UPF_RETENTION_DLATCH\n");
return true;
}
if (inst->Type() == PRIM_UPF_RETENTION_DLATCHRS)
{
log("TODO: PRIM_UPF_RETENTION_DLATCHRS\n");
return true;
}
if (inst->Type() == PRIM_UPF_RETENTION_DFF)
{
log("TODO: PRIM_UPF_RETENTION_DFF\n");
return true;
}
if (inst->Type() == PRIM_UPF_RETENTION_DFFRS)
{
log("TODO: PRIM_UPF_RETENTION_DFFRS\n");
return true;
}
if (inst->Type() == PRIM_UPF_ISOLATION)
{
log("TODO: PRIM_UPF_ISOLATION\n");
return true;
}
if (inst->Type() == PRIM_UPF_LEVEL_SHIFTER)
{
log("TODO: PRIM_UPF_LEVEL_SHIFTER\n");
return true;
}
if (inst->Type() == PRIM_UPF_REPEATER)
{
log("TODO: PRIM_UPF_REPEATER\n");
return true;
}
#endif

#ifdef YOSYSHQ_VERIFIC_API_VERSION
if (inst->Type() == OPER_YOSYSHQ_SET_TAG)
{
Expand Down Expand Up @@ -2961,6 +3009,10 @@ std::string verific_import(Design *design, const std::map<std::string,std::strin
top_mod_names = import_tops("work", &nl_todo, &verific_params, false, "", tops, &top) ;
}

#ifdef VERIFIC_UPF_SUPPORT
upf_file::Elaborate(top.c_str());
#endif

if (!verific_error_msg.empty())
log_error("%s\n", verific_error_msg.c_str());

Expand Down Expand Up @@ -3075,6 +3127,13 @@ struct VerificPass : public Pass {
log("\n");
log("\n");
#endif
#ifdef VERIFIC_UPF_SUPPORT
log(" import {-upf} <upf-file>..\n");
log("\n");
log("Load the specified UPF files into IMPORT.\n");
log("\n");
log("\n");
#endif
#ifdef VERIFIC_SYSTEMVERILOG_SUPPORT
log(" import {-f|-F} [-vlog95|-vlog2k|-sv2005|-sv2009|\n");
log(" -sv2012|-sv|-formal] <command-file>\n");
Expand Down Expand Up @@ -3695,6 +3754,17 @@ struct VerificPass : public Pass {
goto check_error;
}

#ifdef VERIFIC_UPF_SUPPORT
if (GetSize(args) > argidx && (args[argidx] == "-upf")) {
if (++argidx >= GetSize(args))
log_cmd_error("Missing UPF file name.\n");
const char *top = args[argidx].c_str();
for (argidx++; argidx < GetSize(args); argidx++)
upf_file::Analyze(args[argidx].c_str(), top);
goto check_error;
}
#endif

if (GetSize(args) > argidx && (args[argidx] == "-f" || args[argidx] == "-F" || args[argidx] == "-FF"))
{
unsigned verilog_mode = veri_file::SYSTEM_VERILOG;
Expand Down

0 comments on commit 6a7e2d2

Please sign in to comment.