diff options
author | whitequark <whitequark@whitequark.org> | 2020-06-13 04:23:22 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-13 04:23:22 +0000 |
commit | dc6961f3d46657e501ed7115f819d7dd6372b1ce (patch) | |
tree | fbb25450af9b11ac8702fc0dd78707b861ca9498 /backends/cxxrtl/cxxrtl_capi.cc | |
parent | 3783ad625eb99abfa234f63a9d04dca859ac7b07 (diff) | |
parent | 8d712b1095c85cd34f8f4d33798d6a7f1f6c5a2d (diff) | |
download | yosys-dc6961f3d46657e501ed7115f819d7dd6372b1ce.tar.gz yosys-dc6961f3d46657e501ed7115f819d7dd6372b1ce.tar.bz2 yosys-dc6961f3d46657e501ed7115f819d7dd6372b1ce.zip |
Merge pull request #2145 from whitequark/cxxrtl-splitnets
cxxrtl: handle multipart signals
Diffstat (limited to 'backends/cxxrtl/cxxrtl_capi.cc')
-rw-r--r-- | backends/cxxrtl/cxxrtl_capi.cc | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/backends/cxxrtl/cxxrtl_capi.cc b/backends/cxxrtl/cxxrtl_capi.cc index 489d72da5..e0566e152 100644 --- a/backends/cxxrtl/cxxrtl_capi.cc +++ b/backends/cxxrtl/cxxrtl_capi.cc @@ -47,14 +47,17 @@ size_t cxxrtl_step(cxxrtl_handle handle) { return handle->module->step(); } -cxxrtl_object *cxxrtl_get(cxxrtl_handle handle, const char *name) { - if (handle->objects.count(name) > 0) - return static_cast<cxxrtl_object*>(&handle->objects.at(name)); - return nullptr; +struct cxxrtl_object *cxxrtl_get_parts(cxxrtl_handle handle, const char *name, size_t *parts) { + auto it = handle->objects.table.find(name); + if (it == handle->objects.table.end()) + return nullptr; + *parts = it->second.size(); + return static_cast<cxxrtl_object*>(&it->second[0]); } void cxxrtl_enum(cxxrtl_handle handle, void *data, - void (*callback)(void *data, const char *name, cxxrtl_object *object)) { - for (auto &it : handle->objects) - callback(data, it.first.c_str(), static_cast<cxxrtl_object*>(&it.second)); + void (*callback)(void *data, const char *name, + cxxrtl_object *object, size_t parts)) { + for (auto &it : handle->objects.table) + callback(data, it.first.c_str(), static_cast<cxxrtl_object*>(&it.second[0]), it.second.size()); } |