Fix not in array context on non-power-of-two slices, msg2946.

This commit is contained in:
Wilson Snyder 2019-06-29 11:28:22 -04:00
parent a2c1b7f827
commit d43e9aa2c5
3 changed files with 6 additions and 11 deletions

View File

@ -8,6 +8,8 @@ The contributors that suggested a given feature are shown in []. Thanks!
**** Fix not reporting some duplicate signals/ports, bug1462. [Peter Gerst]
**** Fix not in array context on non-power-of-two slices, msg2946. [Yu Sheng Lin]
* Verilator 4.016 2016-06-16

View File

@ -411,7 +411,8 @@ private:
condp->deleteTree();
}
else if (!lvalue
&& !VN_IS(nodep->backp(), ArraySel)) { // Too complicated and slow if mid-multidimension
// Making a scalar would break if we're making an array
&& !VN_IS(nodep->dtypep()->skipRefp(), NodeArrayDType)) {
// ARRAYSEL(...) -> COND(LT(bit<maxbit), ARRAYSEL(...), {width{1'bx}})
AstNRelinker replaceHandle;
nodep->unlinkFrBack(&replaceHandle);

View File

@ -17,16 +17,8 @@ module t (/*AUTOARG*/
int A [7][1], B [8][1];
int a [1], b [1];
always_ff @(posedge clk) begin
`ifdef verilator // msg2946
`define WORK_AROUND
`endif
`ifdef WORK_AROUND
a <= A[0];
b <= B[crc[2:0]];
`else
a <= A[crc[2:0]];
b <= B[0];
`endif
b <= B[crc[2:0]];
end
wire [63:0] result = {a[0], b[0]};
@ -67,7 +59,7 @@ module t (/*AUTOARG*/
$write("[%0t] cyc==%0d crc=%x sum=%x\n",$time, cyc, crc, sum);
if (crc !== 64'hc77bb9b3784ea091) $stop;
// What checksum will we end up with (above print should match)
`define EXPECTED_SUM 64'had01cfb7e84da129
`define EXPECTED_SUM 64'h619f75c3a6d948bd
if (sum !== `EXPECTED_SUM) $stop;
$write("*-* All Finished *-*\n");
$finish;