diff --git a/Changes b/Changes index e82046609..cacfdd2e9 100644 --- a/Changes +++ b/Changes @@ -3,6 +3,10 @@ Revision history for Verilator The contributors that suggested a given feature are shown in []. [by ...] indicates the contributor was also the author of the fix; Thanks! +* Verilator 3.711 2009/** + +**** Add BLKLOOPINIT error code, and describe --unroll-count. [Jeff Winston] + * Verilator 3.711 2009/06/23 **** Support decimal constants of arbitrary widths. [Mark Marshall] diff --git a/bin/verilator b/bin/verilator index 76d5b120a..3b62da3e7 100755 --- a/bin/verilator +++ b/bin/verilator @@ -1617,17 +1617,9 @@ All specify blocks and timing checks are ignored. =head2 Array Initialization -When initializing an array, you need to use non-delayed assignments. This -is done in the interest of speed; if delayed assignments were used, the -simulator would have to copy large arrays every cycle. (In smaller loops, -loop unrolling allows the delayed assignment to work, though it's a bit -slower than a non-delayed assignment.) Here's an example - - always @ (posedge clk) - if (~reset_l) begin - for (i=0; i<`ARRAY_SIZE; i++) begin - array[i] = 0; // Non-delayed for verilator - end +When initializing a large array, you need to use non-delayed assignments. +Verilator will tell you when this needs to be fixed; see the BLKLOOPINIT +error for more information. =head2 Array Out of Bounds @@ -1795,6 +1787,24 @@ inside a public task. Ignoring this warning may make Verilator simulations differ from other simulators. +=item BLKLOOPINIT + +This indicates that the initialization of an array needs to use non-delayed +assignments. This is done in the interest of speed; if delayed assignments +were used, the simulator would have to copy large arrays every cycle. (In +smaller loops, loop unrolling allows the delayed assignment to work, though +it's a bit slower than a non-delayed assignment.) Here's an example + + always @ (posedge clk) + if (~reset_l) begin + for (i=0; i<`ARRAY_SIZE; i++) begin + array[i] = 0; // Non-delayed for verilator + end + +This message is only seen on large or complicated loops because Verilator +generally unrolls small loops. You may want to try increasing +--unroll-count which will raise the small loop bar to avoid this error. + =item CASEINCOMPLETE Warns that inside a case statement there is a stimulus pattern for which diff --git a/src/V3Delayed.cpp b/src/V3Delayed.cpp index 28127115e..7ffc80ffa 100644 --- a/src/V3Delayed.cpp +++ b/src/V3Delayed.cpp @@ -335,7 +335,7 @@ private: && nodep->lhsp()->castSel()->fromp()->castArraySel())) { AstNode* lhsp = nodep->lhsp()->unlinkFrBack(); AstNode* newlhsp = createDlyArray(nodep, lhsp); - if (m_inLoop) nodep->v3error("Unsupported: Delayed assignment to array inside for loops (non-delayed is ok - see docs)"); + if (m_inLoop) nodep->v3warn(BLKLOOPINIT,"Unsupported: Delayed assignment to array inside for loops (non-delayed is ok - see docs)"); if (newlhsp) { nodep->lhsp(newlhsp); } else { diff --git a/src/V3Error.h b/src/V3Error.h index ba65e150c..ceb6bcba6 100644 --- a/src/V3Error.h +++ b/src/V3Error.h @@ -47,6 +47,7 @@ public: // Error codes: MULTITOP, // Error: Multiple top level modules TASKNSVAR, // Error: Task I/O not simple + BLKLOOPINIT, // Error: Delayed assignment to array inside for loops // Warning codes: FIRST_WARN, // Just a code so the program knows where to start warnings // @@ -88,7 +89,7 @@ public: // Boolean " I_COVERAGE", " I_TRACING", // Errors - "MULTITOP", "TASKNSVAR", + "MULTITOP", "TASKNSVAR", "BLKLOOPINIT", // Warnings " FIRST_WARN", "BLKANDNBLK",