aboutsummaryrefslogtreecommitdiffstats
path: root/backends/cxxrtl/cxxrtl_capi.cc
diff options
context:
space:
mode:
authorwhitequark <whitequark@whitequark.org>2020-06-11 13:31:16 +0000
committerwhitequark <whitequark@whitequark.org>2020-06-11 19:34:35 +0000
commit8d712b1095c85cd34f8f4d33798d6a7f1f6c5a2d (patch)
tree983b617122fb49f0cff5e162a93b247e8cbc66bc /backends/cxxrtl/cxxrtl_capi.cc
parentfa04b1967076d8a97bdd8802664fd2d1a2424be2 (diff)
downloadyosys-8d712b1095c85cd34f8f4d33798d6a7f1f6c5a2d.tar.gz
yosys-8d712b1095c85cd34f8f4d33798d6a7f1f6c5a2d.tar.bz2
yosys-8d712b1095c85cd34f8f4d33798d6a7f1f6c5a2d.zip
cxxrtl: handle multipart signals.
This avoids losing design visibility when using the `splitnets` pass.
Diffstat (limited to 'backends/cxxrtl/cxxrtl_capi.cc')
-rw-r--r--backends/cxxrtl/cxxrtl_capi.cc17
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());
}