mirror of
https://github.com/YosysHQ/yosys
synced 2026-07-22 07:05:51 +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
|
|
@ -288,9 +288,9 @@ void json_parse_attr_param(dict<IdString, Const> &results, JsonNode *node)
|
|||
}
|
||||
|
||||
// AttrObject-aware overload: extracts ID::src and routes it to the typed
|
||||
// src_id_ field via set_src_attribute. Other keys still land in the
|
||||
// attributes dict via the generic path.
|
||||
void json_parse_attributes(TwinePool *pool, RTLIL::AttrObject *obj, JsonNode *node)
|
||||
// meta-vector slot via Design::set_src_attribute. Other keys still land
|
||||
// in the attributes dict via the generic path.
|
||||
void json_parse_attributes(RTLIL::Design *design, RTLIL::AttrObject *obj, JsonNode *node)
|
||||
{
|
||||
if (node->type != 'D')
|
||||
log_error("JSON attributes or parameters node is not a dictionary.\n");
|
||||
|
|
@ -300,7 +300,7 @@ void json_parse_attributes(TwinePool *pool, RTLIL::AttrObject *obj, JsonNode *no
|
|||
IdString key = RTLIL::escape_id(it.first.c_str());
|
||||
Const value = json_parse_attr_param_value(it.second);
|
||||
if (key == ID::src && (value.flags & RTLIL::CONST_FLAG_STRING))
|
||||
obj->set_src_attribute(pool, value.decode_string());
|
||||
design->set_src_attribute(obj, value.decode_string());
|
||||
else
|
||||
obj->attributes[key] = value;
|
||||
}
|
||||
|
|
@ -319,7 +319,7 @@ void json_import(Design *design, string &modname, JsonNode *node)
|
|||
design->add(module);
|
||||
|
||||
if (node->data_dict.count("attributes"))
|
||||
json_parse_attributes(&design->src_twines, module, node->data_dict.at("attributes"));
|
||||
json_parse_attributes(design, module, node->data_dict.at("attributes"));
|
||||
|
||||
if (node->data_dict.count("parameter_default_values"))
|
||||
json_parse_attr_param(module->parameter_default_values, node->data_dict.at("parameter_default_values"));
|
||||
|
|
@ -502,7 +502,7 @@ void json_import(Design *design, string &modname, JsonNode *node)
|
|||
}
|
||||
|
||||
if (net_node->data_dict.count("attributes"))
|
||||
json_parse_attributes(&design->src_twines, wire, net_node->data_dict.at("attributes"));
|
||||
json_parse_attributes(design, wire, net_node->data_dict.at("attributes"));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -583,7 +583,7 @@ void json_import(Design *design, string &modname, JsonNode *node)
|
|||
}
|
||||
|
||||
if (cell_node->data_dict.count("attributes"))
|
||||
json_parse_attributes(&design->src_twines, cell, cell_node->data_dict.at("attributes"));
|
||||
json_parse_attributes(design, cell, cell_node->data_dict.at("attributes"));
|
||||
|
||||
if (cell_node->data_dict.count("parameters"))
|
||||
json_parse_attr_param(cell->parameters, cell_node->data_dict.at("parameters"));
|
||||
|
|
@ -631,7 +631,7 @@ void json_import(Design *design, string &modname, JsonNode *node)
|
|||
}
|
||||
|
||||
if (memory_node->data_dict.count("attributes"))
|
||||
json_parse_attributes(&design->src_twines, mem, memory_node->data_dict.at("attributes"));
|
||||
json_parse_attributes(design, mem, memory_node->data_dict.at("attributes"));
|
||||
|
||||
module->memories[mem->name] = mem;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue