3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-04-29 03:45:52 +00:00
This commit is contained in:
KrystalDelusion 2025-03-12 14:35:25 +00:00 committed by GitHub
commit 7c2bffb645
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 295 additions and 97 deletions

View file

@ -141,6 +141,39 @@ static bool match_attr(const dict<RTLIL::IdString, RTLIL::Const> &attributes, co
return match_attr(attributes, match_expr, std::string(), 0);
}
static bool match_type_prop(RTLIL::IdString type, const std::string &property)
{
auto *ct = yosys_celltypes.get_cell(type);
if (ct == nullptr) {
return false;
} else
if (property.compare("internal") == 0) {
return ct->is_internal;
} else
if (property.compare("evaluable") == 0) {
return ct->is_evaluable;
} else
if (property.compare("combinatorial") == 0) {
return ct->is_combinatorial;
} else
if (property.compare("synthesizable") == 0) {
return ct->is_synthesizable;
} else
if (property.compare("builtin_ff") == 0) {
return ct->is_builtin_ff;
} else
if (property.compare("formal") == 0) {
return ct->is_formal;
} else
if (property.compare("metainfo") == 0) {
return ct->is_metainfo;
} else
if (property.compare("effects") == 0) {
return ct->has_effects;
} else
log_cmd_error("Unsupported type property '%s'!\n", property.c_str());
}
static void select_op_neg(RTLIL::Design *design, RTLIL::Selection &lhs)
{
if (lhs.full_selection) {
@ -891,6 +924,11 @@ static void select_stmt(RTLIL::Design *design, std::string arg, bool disable_emp
sel.selected_members[mod->name].insert(cell->name);
}
} else
if (arg_memb.compare(0, 2, "y:") == 0) {
for (auto cell : mod->cells())
if (match_type_prop(cell->type, arg_memb.substr(2)))
sel.selected_members[mod->name].insert(cell->name);
} else
if (arg_memb.compare(0, 2, "p:") == 0) {
for (auto &it : mod->processes)
if (match_ids(it.first, arg_memb.substr(2)))
@ -1178,6 +1216,11 @@ struct SelectPass : public Pass {
log(" t:@<name>\n");
log(" all cells with a type matching a module in the saved selection <name>\n");
log("\n");
log(" y:<property>\n");
log(" all cells with a given type property, possible values are:\n");
log(" evaluable, combinatorial, synthesizable, builtin_ff, formal\n");
log(" (currently only internal cells can have type properties)\n");
log("\n");
log(" p:<pattern>\n");
log(" all processes with a name matching the given pattern\n");
log("\n");