mirror of
https://github.com/YosysHQ/yosys
synced 2025-04-12 12:08:19 +00:00
verific: set VHDL entity source location from another attribute if available
This commit is contained in:
parent
314842d2a0
commit
ef3c16d4c4
|
@ -408,7 +408,7 @@ static const std::string verific_unescape(const char *value)
|
|||
}
|
||||
#endif
|
||||
|
||||
void VerificImporter::import_attributes(dict<RTLIL::IdString, RTLIL::Const> &attributes, DesignObj *obj, Netlist *nl, int wire_width_hint)
|
||||
void VerificImporter::import_attributes(dict<RTLIL::IdString, RTLIL::Const> &attributes, DesignObj *obj, Netlist *nl, int wire_width_hint, bool is_module)
|
||||
{
|
||||
if (!obj)
|
||||
return;
|
||||
|
@ -416,15 +416,19 @@ void VerificImporter::import_attributes(dict<RTLIL::IdString, RTLIL::Const> &att
|
|||
MapIter mi;
|
||||
Att *attr;
|
||||
|
||||
IdString src = ID::src;
|
||||
if (is_module && nl->IsFromVhdl() && nl->GetAtt(" src_entity")) src = ID(src_architecture);
|
||||
#ifdef VERIFIC_LINEFILE_INCLUDES_COLUMNS
|
||||
if (obj->Linefile())
|
||||
attributes[ID::src] = stringf("%s:%d.%d-%d.%d", LineFile::GetFileName(obj->Linefile()), obj->Linefile()->GetLeftLine(), obj->Linefile()->GetLeftCol(), obj->Linefile()->GetRightLine(), obj->Linefile()->GetRightCol());
|
||||
attributes[src] = stringf("%s:%d.%d-%d.%d", LineFile::GetFileName(obj->Linefile()), obj->Linefile()->GetLeftLine(), obj->Linefile()->GetLeftCol(), obj->Linefile()->GetRightLine(), obj->Linefile()->GetRightCol());
|
||||
#else
|
||||
if (obj->Linefile())
|
||||
attributes[ID::src] = stringf("%s:%d", LineFile::GetFileName(obj->Linefile()), LineFile::GetLineNo(obj->Linefile()));
|
||||
attributes[src] = stringf("%s:%d", LineFile::GetFileName(obj->Linefile()), LineFile::GetLineNo(obj->Linefile()));
|
||||
#endif
|
||||
|
||||
FOREACH_ATTRIBUTE(obj, mi, attr) {
|
||||
if (is_module && nl->IsFromVhdl() && std::string(attr->Key())==" src_entity")
|
||||
attributes[ID::src] = verific_const(nullptr, attr->Value(), obj);
|
||||
if (attr->Key()[0] == ' ' || attr->Value() == nullptr)
|
||||
continue;
|
||||
attributes[RTLIL::escape_id(attr->Key())] = verific_const(nullptr, attr->Value(), obj);
|
||||
|
@ -1464,7 +1468,7 @@ void VerificImporter::import_netlist(RTLIL::Design *design, Netlist *nl, std::ma
|
|||
} else {
|
||||
log("Importing module %s.\n", RTLIL::id2cstr(module->name));
|
||||
}
|
||||
import_attributes(module->attributes, nl, nl);
|
||||
import_attributes(module->attributes, nl, nl, -1, true);
|
||||
if (module->name.isPublic())
|
||||
module->set_string_attribute(ID::hdlname, nl->CellBaseName());
|
||||
module->set_string_attribute(ID(library), nl->Owner()->Owner()->Name());
|
||||
|
|
|
@ -81,7 +81,7 @@ struct VerificImporter
|
|||
RTLIL::SigBit net_map_at(Verific::Net *net);
|
||||
|
||||
RTLIL::IdString new_verific_id(Verific::DesignObj *obj);
|
||||
void import_attributes(dict<RTLIL::IdString, RTLIL::Const> &attributes, Verific::DesignObj *obj, Verific::Netlist *nl = nullptr, int wire_width_hint = -1);
|
||||
void import_attributes(dict<RTLIL::IdString, RTLIL::Const> &attributes, Verific::DesignObj *obj, Verific::Netlist *nl = nullptr, int wire_width_hint = -1, bool is_module = false);
|
||||
|
||||
RTLIL::SigBit netToSigBit(Verific::Net *net);
|
||||
RTLIL::SigSpec operatorInput(Verific::Instance *inst);
|
||||
|
|
Loading…
Reference in a new issue