}
cxxrtl_handle cxxrtl_create(cxxrtl_toplevel design) {
+ return cxxrtl_create_at(design, "");
+}
+
+cxxrtl_handle cxxrtl_create_at(cxxrtl_toplevel design, const char *root) {
+ std::string path = root;
+ if (!path.empty()) {
+ // module::debug_info() accepts either an empty path, or a path ending in space to simplify
+ // the logic in generated code. While this is sketchy at best to expose in the C++ API, this
+ // would be a lot worse in the C API, so don't expose it here.
+ assert(path.back() != ' ');
+ path += ' ';
+ }
+
cxxrtl_handle handle = new _cxxrtl_handle;
handle->module = std::move(design->module);
- handle->module->debug_info(handle->objects);
+ handle->module->debug_info(handle->objects, path);
delete design;
return handle;
}
// The `design` is consumed by this operation and cannot be used afterwards.
cxxrtl_handle cxxrtl_create(cxxrtl_toplevel design);
+// Create a design handle at a given hierarchy position from a design toplevel.
+//
+// This operation is similar to `cxxrtl_create`, except the full hierarchical name of every object
+// is prepended with `root`.
+cxxrtl_handle cxxrtl_create_at(cxxrtl_toplevel design, const char *root);
+
// Release all resources used by a design and its handle.
void cxxrtl_destroy(cxxrtl_handle handle);