Merge pull request #2163 from jfng/cxxrtl-blackbox-debuginfo

cxxrtl: restrict the debug info of a blackbox to its ports.
This commit is contained in:
whitequark 2020-06-17 06:07:41 +00:00 committed by GitHub
commit c4f20f744b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 17 additions and 13 deletions

View File

@ -1623,6 +1623,8 @@ struct CxxrtlWorker {
for (auto wire : module->wires()) { for (auto wire : module->wires()) {
if (wire->name[0] != '\\') if (wire->name[0] != '\\')
continue; continue;
if (module->get_bool_attribute(ID(cxxrtl_blackbox)) && (wire->port_id == 0))
continue;
count_public_wires++; count_public_wires++;
if (debug_const_wires.count(wire)) { if (debug_const_wires.count(wire)) {
// Wire tied to a constant // Wire tied to a constant
@ -1649,19 +1651,21 @@ struct CxxrtlWorker {
count_skipped_wires++; count_skipped_wires++;
} }
} }
for (auto &memory_it : module->memories) { if (!module->get_bool_attribute(ID(cxxrtl_blackbox))) {
if (memory_it.first[0] != '\\') for (auto &memory_it : module->memories) {
continue; if (memory_it.first[0] != '\\')
f << indent << "items.add(path + " << escape_cxx_string(get_hdl_name(memory_it.second)); continue;
f << ", debug_item(" << mangle(memory_it.second) << ", "; f << indent << "items.add(path + " << escape_cxx_string(get_hdl_name(memory_it.second));
f << memory_it.second->start_offset << "));\n"; f << ", debug_item(" << mangle(memory_it.second) << ", ";
} f << memory_it.second->start_offset << "));\n";
for (auto cell : module->cells()) { }
if (is_internal_cell(cell->type)) for (auto cell : module->cells()) {
continue; if (is_internal_cell(cell->type))
const char *access = is_cxxrtl_blackbox_cell(cell) ? "->" : "."; continue;
f << indent << mangle(cell) << access << "debug_info(items, "; const char *access = is_cxxrtl_blackbox_cell(cell) ? "->" : ".";
f << "path + " << escape_cxx_string(get_hdl_name(cell) + ' ') << ");\n"; f << indent << mangle(cell) << access << "debug_info(items, ";
f << "path + " << escape_cxx_string(get_hdl_name(cell) + ' ') << ");\n";
}
} }
dec_indent(); dec_indent();