Merge pull request #2160 from whitequark/cxxrtl-fix-warning

cxxrtl: avoid unused variable warning for transparent $memrd ports
This commit is contained in:
whitequark 2020-06-17 06:06:58 +00:00 committed by GitHub
commit eaf66037a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 23 additions and 21 deletions

View File

@ -1134,14 +1134,15 @@ struct CxxrtlWorker {
f << indent << "if(" << valid_index_temp << ".valid) {\n";
inc_indent();
if (writable_memories[memory]) {
std::string addr_temp = fresh_temporary();
f << indent << "const value<" << cell->getPort(ID::ADDR).size() << "> &" << addr_temp << " = ";
dump_sigspec_rhs(cell->getPort(ID::ADDR));
f << ";\n";
std::string lhs_temp = fresh_temporary();
f << indent << "value<" << memory->width << "> " << lhs_temp << " = "
<< mangle(memory) << "[" << valid_index_temp << ".index];\n";
std::vector<const RTLIL::Cell*> memwr_cells(transparent_for[cell].begin(), transparent_for[cell].end());
if (!memwr_cells.empty()) {
std::string addr_temp = fresh_temporary();
f << indent << "const value<" << cell->getPort(ID::ADDR).size() << "> &" << addr_temp << " = ";
dump_sigspec_rhs(cell->getPort(ID::ADDR));
f << ";\n";
std::sort(memwr_cells.begin(), memwr_cells.end(),
[](const RTLIL::Cell *a, const RTLIL::Cell *b) {
return a->getParam(ID::PRIORITY).as_int() < b->getParam(ID::PRIORITY).as_int();
@ -1160,6 +1161,7 @@ struct CxxrtlWorker {
dec_indent();
f << indent << "}\n";
}
}
f << indent;
dump_sigspec_lhs(cell->getPort(ID::DATA));
f << " = " << lhs_temp << ";\n";