mirror of
https://github.com/YosysHQ/yosys
synced 2026-07-25 16:42:35 +00:00
rtlil: evacuate src_id_ from AttrObject to per-Design meta vector
This commit is contained in:
parent
e70eed3296
commit
f1edb571f2
22 changed files with 668 additions and 390 deletions
|
|
@ -122,7 +122,7 @@ struct BtorWorker
|
|||
string infostr = obj->name.unescape();
|
||||
if (!srcsym && !print_internal_names && infostr[0] == '$') return "";
|
||||
if (obj->has_attribute(ID::src)) {
|
||||
string raw_src = module && module->design ? obj->get_src_attribute(&module->design->src_twines) : std::string();
|
||||
string raw_src = module && module->design ? module->design->get_src_attribute(obj) : std::string();
|
||||
string src = module && module->design ? module->design->resolve_src(raw_src) : raw_src;
|
||||
if (srcsym && infostr[0] == '$') {
|
||||
std::replace(src.begin(), src.end(), ' ', '_');
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ static const int FIRRTL_MAX_DSH_WIDTH_ERROR = 20; // For historic reasons, this
|
|||
|
||||
std::string getFileinfo(const RTLIL::AttrObject *design_entity, const RTLIL::Design *design = nullptr)
|
||||
{
|
||||
std::string src = design ? design_entity->get_src_attribute(&design->src_twines) : std::string();
|
||||
std::string src = design ? design->get_src_attribute(design_entity) : std::string();
|
||||
std::string fileinfo_str = src.empty() ? "" : "@[" + src + "]";
|
||||
return fileinfo_str;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -135,9 +135,9 @@ struct JsonWriter
|
|||
bool first = true;
|
||||
// Emit the typed src field first if present — it lives outside the
|
||||
// attribute dict after the typed-src migration.
|
||||
if (src_obj && src_obj->src_id() != Twine::Null && design) {
|
||||
if (src_obj && design && design->obj_src_id(src_obj) != Twine::Null) {
|
||||
f << stringf("\n %s%s: ", for_module ? "" : " ", get_name(RTLIL::ID::src));
|
||||
write_parameter_value(RTLIL::Const(src_obj->get_src_attribute(&design->src_twines)));
|
||||
write_parameter_value(RTLIL::Const(design->get_src_attribute(src_obj)));
|
||||
first = false;
|
||||
}
|
||||
for (auto ¶m : parameters) {
|
||||
|
|
|
|||
|
|
@ -37,12 +37,13 @@ void RTLIL_BACKEND::dump_attributes(std::ostream &f, std::string indent, const R
|
|||
// Emit the typed src field first. It is not stored in obj->attributes
|
||||
// — the dict no longer holds ID::src under any circumstance. Backends
|
||||
// that want to materialize the pipe-joined literal pass resolve_src.
|
||||
if (obj->src_id() != Twine::Null && design) {
|
||||
if (design && design->obj_src_id(obj) != Twine::Null) {
|
||||
Twine::Id id = design->obj_src_id(obj);
|
||||
f << stringf("%s" "attribute \\src ", indent);
|
||||
if (resolve_src) {
|
||||
dump_const(f, RTLIL::Const(design->src_twines.flatten(obj->src_id())));
|
||||
dump_const(f, RTLIL::Const(design->src_twines.flatten(id)));
|
||||
} else {
|
||||
dump_const(f, RTLIL::Const(TwinePool::format_ref(obj->src_id())));
|
||||
dump_const(f, RTLIL::Const(TwinePool::format_ref(id)));
|
||||
}
|
||||
f << stringf("\n");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue