Skip to content

Commit

Permalink
fixup! Example pass for the scopeinfo index/lookup utils
Browse files Browse the repository at this point in the history
  • Loading branch information
jix committed Feb 6, 2024
1 parent c5a6a13 commit 91ed15c
Showing 1 changed file with 0 additions and 44 deletions.
44 changes: 0 additions & 44 deletions examples/cxx-api/scopeinfo_example.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,50 +27,6 @@
USING_YOSYS_NAMESPACE
PRIVATE_NAMESPACE_BEGIN

/*
static void dump_scope(int depth, const ScopeinfoIndex &info, ScopeinfoIndex::Scope scope);
static void dump_entry(int depth, const ScopeinfoIndex &info, ScopeinfoIndex::ScopeEntry entry)
{
const char *type;
const char *scope_type;
switch (info.data(entry).type) {
case ScopeinfoIndex::ScopeEntryData::Type::CELL: type = "cell"; scope_type = "module"; break;
case ScopeinfoIndex::ScopeEntryData::Type::WIRE: type = "wire"; scope_type = "struct"; break;
default: log_assert(false);
}
log("%*s- %s %s\n", depth, "", type, RTLIL::unescape_id(info.data(entry).name).c_str());
if (info.data(entry).has_attribute(ID::src))
log("%*s@ %s\n", depth + 2, "", info.data(entry).get_src_attribute().c_str());
for (auto const &entry : info.data(entry).attributes())
if (!entry.first.in(ID::src, ID::hdlname))
log("%*s: %s = %s\n", depth + 2, "", log_id(entry.first), log_const(entry.second));
if (info.data(entry).inner.valid()) {
dump_scope(depth + 2, info, info.data(entry).inner);
} else {
IdString scope_name = info.data(entry).scope_name();
if (!scope_name.empty())
log("%*s= %s %s\n", depth + 2, "", scope_type, RTLIL::unescape_id(scope_name).c_str());
}
}
static void dump_scope(int depth, const ScopeinfoIndex &info, ScopeinfoIndex::Scope scope) {
const char *type;
switch (info.data(scope).type) {
case ScopeinfoIndex::ScopeData::Type::MODULE: type = "module"; break;
case ScopeinfoIndex::ScopeData::Type::STRUCT: type = "struct"; break;
default: log_assert(false);
}
log("%*s+ %s %s\n", depth, "", type, RTLIL::unescape_id(info.data(scope).name()).c_str());
if (info.data(scope).has_attribute(ID::src))
log("%*s@ %s\n", depth + 2, "", info.data(scope).get_src_attribute().c_str());
for (auto const &entry : info.data(scope).attributes())
if (!entry.first.in(ID::src, ID::hdlname))
log("%*s: %s = %s\n", depth + 2, "", log_id(entry.first), log_const(entry.second));
for (auto entry : info.data(scope).entries)
dump_entry(depth + 2, info, entry.second);
};
*/
struct ScopeinfoExamplePass : public Pass {
ScopeinfoExamplePass() : Pass("scopeinfo_example", "dump scopeinfo") {}
void help() override
Expand Down

0 comments on commit 91ed15c

Please sign in to comment.