Fix per-bit array output connection error, bug414.

This commit is contained in:
Wilson Snyder 2013-02-02 18:33:10 -05:00
parent 5dd3221759
commit 6e6f1045b8
3 changed files with 12 additions and 4 deletions

View File

@ -30,6 +30,8 @@ indicates the contributor was also the author of the fix; Thanks!
**** Fix segfault on multidimensional dotted arrays, bug607. [Jie Xu]
**** Fix per-bit array output connection error, bug414. [Jan Egil Ruud]
**** Fix package logic var compile error.
**** Fix enums with X values.

View File

@ -198,6 +198,7 @@ private:
AstNode* exprp = nodep->exprp()->unlinkFrBack();
bool inputPin = nodep->modVarp()->isInput();
if (!inputPin && !exprp->castVarRef()
&& !exprp->castConcat() // V3Const will collapse the SEL with the one we're about to make
&& !exprp->castSel()) { // V3Const will collapse the SEL with the one we're about to make
nodep->v3error("Unsupported: Per-bit array instantiations with output connections to non-wires.");
// Note spec allows more complicated matches such as slices and such

View File

@ -9,8 +9,8 @@ module t (/*AUTOARG*/
);
input clk;
wire [17:10] bitout;
wire [27:24] short_bitout;
wire [19:10] bitout;
wire [29:24] short_bitout;
wire [7:0] allbits;
wire [15:0] twobits;
@ -37,6 +37,11 @@ module t (/*AUTOARG*/
.twobits (twobits),
.bitout (bitout[17:10]));
sub
i_sub6 [7:4] (.allbits (allbits),
.twobits (twobits[15:8]),
.bitout ({bitout[18+:2],short_bitout[28+:2]}));
integer cyc=0;
reg [63:0] crc;
reg [63:0] sum;
@ -44,7 +49,7 @@ module t (/*AUTOARG*/
// Signals under test
assign allbits = crc[7:0];
assign twobits = crc[15:0];
wire [63:0] result = {52'h0, short_bitout, bitout};
wire [63:0] result = {48'h0, short_bitout, bitout};
// Test loop
always @ (posedge clk) begin
@ -68,7 +73,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'h0bf9559ce1f98425
`define EXPECTED_SUM 64'ha1da9ff8082a4ff6
if (sum !== `EXPECTED_SUM) $stop;
$write("*-* All Finished *-*\n");
$finish;