forked from github/verilator
Support unpacked array .sum and .product.
This commit is contained in:
parent
feb1e2bd48
commit
070bcddf5a
2
Changes
2
Changes
@ -7,6 +7,8 @@ The contributors that suggested a given feature are shown in []. Thanks!
|
||||
|
||||
**** Support $isunbounded and parameter $. (#2104)
|
||||
|
||||
**** Support unpacked array .sum and .product.
|
||||
|
||||
**** Fix FST tracing of little bit endian signals. [Geza Lore]
|
||||
|
||||
**** Fix +: and -: on unpacked arrays. (#2304) [engr248]
|
||||
|
@ -1944,6 +1944,7 @@ private:
|
||||
}
|
||||
} else if (VN_IS(fromDtp, EnumDType) //
|
||||
|| VN_IS(fromDtp, AssocArrayDType) //
|
||||
|| VN_IS(fromDtp, UnpackArrayDType) //
|
||||
|| VN_IS(fromDtp, DynArrayDType) //
|
||||
|| VN_IS(fromDtp, QueueDType) //
|
||||
|| VN_IS(fromDtp, BasicDType)) {
|
||||
@ -2420,7 +2421,7 @@ private:
|
||||
nodep->dtypeSetSigned32(); // Guess on error
|
||||
}
|
||||
void methodCallUnpack(AstMethodCall* nodep, AstUnpackArrayDType* adtypep) {
|
||||
enum { UNKNOWN = 0, ARRAY_OR, ARRAY_AND, ARRAY_XOR } methodId;
|
||||
enum { UNKNOWN = 0, ARRAY_OR, ARRAY_AND, ARRAY_XOR, ARRAY_SUM, ARRAY_PRODUCT } methodId;
|
||||
|
||||
methodId = UNKNOWN;
|
||||
if (nodep->name() == "or") {
|
||||
@ -2429,6 +2430,10 @@ private:
|
||||
methodId = ARRAY_AND;
|
||||
} else if (nodep->name() == "xor") {
|
||||
methodId = ARRAY_XOR;
|
||||
} else if (nodep->name() == "sum") {
|
||||
methodId = ARRAY_SUM;
|
||||
} else if (nodep->name() == "product") {
|
||||
methodId = ARRAY_PRODUCT;
|
||||
}
|
||||
|
||||
if (methodId) {
|
||||
@ -2445,6 +2450,8 @@ private:
|
||||
case ARRAY_OR: newp = new AstOr(fl, newp, selector); break;
|
||||
case ARRAY_AND: newp = new AstAnd(fl, newp, selector); break;
|
||||
case ARRAY_XOR: newp = new AstXor(fl, newp, selector); break;
|
||||
case ARRAY_SUM: newp = new AstAdd(fl, newp, selector); break;
|
||||
case ARRAY_PRODUCT: newp = new AstMul(fl, newp, selector); break;
|
||||
default: nodep->v3fatalSrc("bad case");
|
||||
}
|
||||
}
|
||||
|
@ -13,14 +13,16 @@ module t (/*AUTOARG*/
|
||||
);
|
||||
input clk;
|
||||
|
||||
logic [2:0] foo [1:0];
|
||||
logic [3:0] foo [1:0];
|
||||
initial begin
|
||||
foo[0] = 3'b101;
|
||||
foo[1] = 3'b011;
|
||||
foo[0] = 4'b0101;
|
||||
foo[1] = 4'b0011;
|
||||
|
||||
`checkh(foo.or, 3'b111);
|
||||
`checkh(foo.and, 3'b001);
|
||||
`checkh(foo.xor, 3'b110);
|
||||
`checkh(foo.or, 4'b0111);
|
||||
`checkh(foo.and, 4'b0001);
|
||||
`checkh(foo.xor, 4'b0110);
|
||||
`checkh(foo.sum, 4'b1000);
|
||||
`checkh(foo.product, 4'b1111);
|
||||
|
||||
$write("*-* All Finished *-*\n");
|
||||
$finish;
|
||||
|
Loading…
Reference in New Issue
Block a user