Merge pull request #1932 from YosysHQ/dave/cxxrtl-unclocked-read

cxxrtl: Fix handling of unclocked memory read ports
This commit is contained in:
whitequark 2020-04-15 05:34:29 +00:00 committed by GitHub
commit a143f04e7d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -871,7 +871,8 @@ struct CxxrtlWorker {
dump_sigspec_rhs(cell->getPort(ID(ADDR))); dump_sigspec_rhs(cell->getPort(ID(ADDR)));
f << ", " << memory->start_offset << ", " << memory->size << ");\n"; f << ", " << memory->start_offset << ", " << memory->size << ");\n";
if (cell->type == ID($memrd)) { if (cell->type == ID($memrd)) {
if (!cell->getPort(ID(EN)).is_fully_ones()) { bool has_enable = cell->getParam(ID(CLK_ENABLE)).as_bool() && !cell->getPort(ID(EN)).is_fully_ones();
if (has_enable) {
f << indent << "if ("; f << indent << "if (";
dump_sigspec_rhs(cell->getPort(ID(EN))); dump_sigspec_rhs(cell->getPort(ID(EN)));
f << ") {\n"; f << ") {\n";
@ -930,7 +931,7 @@ struct CxxrtlWorker {
f << " = value<" << memory->width << "> {};\n"; f << " = value<" << memory->width << "> {};\n";
dec_indent(); dec_indent();
f << indent << "}\n"; f << indent << "}\n";
if (!cell->getPort(ID(EN)).is_fully_ones()) { if (has_enable) {
dec_indent(); dec_indent();
f << indent << "}\n"; f << indent << "}\n";
} }