Fix replication of 64-bit signal change detects.

This commit is contained in:
Wilson Snyder 2018-09-28 08:36:37 -04:00
parent 1871e2b541
commit c9ee425ed5
2 changed files with 10 additions and 5 deletions

View File

@ -12,6 +12,9 @@ The contributors that suggested a given feature are shown in []. Thanks!
*** Fix MinGW compile issues, msg2636. [HyungKi Jeong] *** Fix MinGW compile issues, msg2636. [HyungKi Jeong]
*** Fix replication of 64-bit signal change detects.
* Verilator 4.002 2018-09-16 * Verilator 4.002 2018-09-16
** This is a major release. Any patches may require major rework to apply. ** This is a major release. Any patches may require major rework to apply.

View File

@ -849,6 +849,7 @@ class EmitCImp : EmitCStmts {
// METHODS // METHODS
void doubleOrDetect(AstChangeDet* changep, bool& gotOne) { void doubleOrDetect(AstChangeDet* changep, bool& gotOne) {
static int s_addDoubleOr = 10; // Determined experimentally as best
if (!changep->rhsp()) { if (!changep->rhsp()) {
if (!gotOne) gotOne = true; if (!gotOne) gotOne = true;
else puts(" | "); else puts(" | ");
@ -857,17 +858,18 @@ class EmitCImp : EmitCStmts {
else { else {
AstNode* lhsp = changep->lhsp(); AstNode* lhsp = changep->lhsp();
AstNode* rhsp = changep->rhsp(); AstNode* rhsp = changep->rhsp();
static int addDoubleOr = 10; // Determined experimentally as best
if (!VN_IS(lhsp, VarRef) && !VN_IS(lhsp, ArraySel)) changep->v3fatalSrc("Not ref?"); if (!VN_IS(lhsp, VarRef) && !VN_IS(lhsp, ArraySel)) changep->v3fatalSrc("Not ref?");
if (!VN_IS(rhsp, VarRef) && !VN_IS(rhsp, ArraySel)) changep->v3fatalSrc("Not ref?"); if (!VN_IS(rhsp, VarRef) && !VN_IS(rhsp, ArraySel)) changep->v3fatalSrc("Not ref?");
for (int word=0; word<changep->lhsp()->widthWords(); word++) { for (int word=0;
word < (changep->lhsp()->isWide() ? changep->lhsp()->widthWords() : 1);
++word) {
if (!gotOne) { if (!gotOne) {
gotOne = true; gotOne = true;
addDoubleOr = 10; // Determined experimentally as best s_addDoubleOr = 10;
puts("("); puts("(");
} else if (--addDoubleOr == 0) { } else if (--s_addDoubleOr == 0) {
puts("|| ("); puts("|| (");
addDoubleOr = 10; s_addDoubleOr = 10;
} else { } else {
puts(" | ("); puts(" | (");
} }