Add attributes to the hierarchical cells (#1405)
* Adds attributes to the hierarchical cells * python: add binding for hierarchical cells attributes * frontend/base: import hierarchical cells attributes
This commit is contained in:
parent
d810aac867
commit
f01465f628
@ -519,6 +519,8 @@ struct HierarchicalCell
|
|||||||
dict<IdString, HierarchicalPort> ports;
|
dict<IdString, HierarchicalPort> ports;
|
||||||
// Name inside cell instance -> global name
|
// Name inside cell instance -> global name
|
||||||
dict<IdString, IdString> hier_cells;
|
dict<IdString, IdString> hier_cells;
|
||||||
|
// Cell attributes
|
||||||
|
dict<IdString, Property> attrs;
|
||||||
};
|
};
|
||||||
|
|
||||||
NEXTPNR_NAMESPACE_END
|
NEXTPNR_NAMESPACE_END
|
||||||
|
@ -283,6 +283,9 @@ PYBIND11_EMBEDDED_MODULE(MODULE_NAME, m)
|
|||||||
wrap_context<IdIdMap &>>::def_wrap(hierarchy_cls, "nets");
|
wrap_context<IdIdMap &>>::def_wrap(hierarchy_cls, "nets");
|
||||||
readonly_wrapper<HierarchicalCell &, decltype(&HierarchicalCell::hier_cells), &HierarchicalCell::hier_cells,
|
readonly_wrapper<HierarchicalCell &, decltype(&HierarchicalCell::hier_cells), &HierarchicalCell::hier_cells,
|
||||||
wrap_context<IdIdMap &>>::def_wrap(hierarchy_cls, "hier_cells");
|
wrap_context<IdIdMap &>>::def_wrap(hierarchy_cls, "hier_cells");
|
||||||
|
readonly_wrapper<HierarchicalCell &, decltype(&HierarchicalCell::attrs), &HierarchicalCell::attrs,
|
||||||
|
wrap_context<AttrMap &>>::def_wrap(hierarchy_cls, "attrs");
|
||||||
|
|
||||||
WRAP_MAP(m, AttrMap, conv_to_str<Property>, "AttrMap");
|
WRAP_MAP(m, AttrMap, conv_to_str<Property>, "AttrMap");
|
||||||
WRAP_MAP(m, PortMap, wrap_context<PortInfo &>, "PortMap");
|
WRAP_MAP(m, PortMap, wrap_context<PortInfo &>, "PortMap");
|
||||||
WRAP_MAP(m, IdIdMap, conv_to_str<IdString>, "IdIdMap");
|
WRAP_MAP(m, IdIdMap, conv_to_str<IdString>, "IdIdMap");
|
||||||
|
@ -535,6 +535,9 @@ template <typename FrontendType> struct GenericFrontend
|
|||||||
// Do the submodule import
|
// Do the submodule import
|
||||||
auto type = impl.get_cell_type(cd);
|
auto type = impl.get_cell_type(cd);
|
||||||
import_module(submod, name, type, mod_refs.at(type));
|
import_module(submod, name, type, mod_refs.at(type));
|
||||||
|
// Add current cell attributes to the imported module
|
||||||
|
impl.foreach_attr( cd, [&](const std::string &name, const Property &value)
|
||||||
|
{ ctx->hierarchy[submod.path].attrs[ctx->id(name)] = value; } );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Import the cells section of a module
|
// Import the cells section of a module
|
||||||
|
Loading…
Reference in New Issue
Block a user