3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-12-18 02:08:33 +00:00

cxxrtl: rationalize debug_items accessors.

Before this commit, `at()` and `operator[]` did the same thing, making
one of them redundant. There was also a somewhat awkward `parts_at()`,
which is more generic than `at()`.

After this commit, `parts_at()` becomes `at()`, and `at()` becomes
`operator[]`. Any quick-and-dirty accesses should use `items["name"]`,
which expects a single-part item. Generic code should instead use
`items.at("name")`, which will return multiple parts. Both will check
for the existence of the name.

This is unlikely to break downstream code since it's likely been using
the shorter `operator[]`. (In any case this API is not stable.)
This commit is contained in:
Catherine 2024-02-13 12:47:58 +00:00
parent c3c44225de
commit 42920c9bc0
2 changed files with 12 additions and 7 deletions

View file

@ -641,7 +641,7 @@ public:
assert(items.count(name) != 0);
assert(part_index < items.count(name));
const debug_item &part = items.parts_at(name).at(part_index);
const debug_item &part = items.at(name).at(part_index);
assert(chunks == (part.width + sizeof(chunk_t) * 8 - 1) / (sizeof(chunk_t) * 8));
assert(depth == part.depth);