mirror of
https://github.com/verilator/verilator.git
synced 2025-04-05 12:12:39 +00:00
Fix non-constant replication in concats (#5171)
Signed-off-by: Arkadiusz Kozdra <akozdra@antmicro.com>
This commit is contained in:
parent
d4c3e35f97
commit
e9f59e44a5
@ -581,8 +581,13 @@ class WidthVisitor final : public VNVisitor {
|
|||||||
<< vdtypep->prettyDTypeNameQ() << " data type");
|
<< vdtypep->prettyDTypeNameQ() << " data type");
|
||||||
}
|
}
|
||||||
|
|
||||||
iterateCheckSizedSelf(nodep, "LHS", nodep->lhsp(), SELF, BOTH);
|
if (vdtypep && vdtypep->isString()) {
|
||||||
iterateCheckSizedSelf(nodep, "RHS", nodep->rhsp(), SELF, BOTH);
|
iterateCheckString(nodep, "LHS", nodep->lhsp(), BOTH);
|
||||||
|
iterateCheckString(nodep, "RHS", nodep->rhsp(), BOTH);
|
||||||
|
} else {
|
||||||
|
iterateCheckSizedSelf(nodep, "LHS", nodep->lhsp(), SELF, BOTH);
|
||||||
|
iterateCheckSizedSelf(nodep, "RHS", nodep->rhsp(), SELF, BOTH);
|
||||||
|
}
|
||||||
nodep->dtypeSetLogicUnsized(nodep->lhsp()->width() + nodep->rhsp()->width(),
|
nodep->dtypeSetLogicUnsized(nodep->lhsp()->width() + nodep->rhsp()->width(),
|
||||||
nodep->lhsp()->widthMin() + nodep->rhsp()->widthMin(),
|
nodep->lhsp()->widthMin() + nodep->rhsp()->widthMin(),
|
||||||
VSigning::UNSIGNED);
|
VSigning::UNSIGNED);
|
||||||
@ -773,7 +778,12 @@ class WidthVisitor final : public VNVisitor {
|
|||||||
nodep->v3warn(E_UNSUPPORTED, "Unsupported: Replication to form "
|
nodep->v3warn(E_UNSUPPORTED, "Unsupported: Replication to form "
|
||||||
<< vdtypep->prettyDTypeNameQ() << " data type");
|
<< vdtypep->prettyDTypeNameQ() << " data type");
|
||||||
}
|
}
|
||||||
iterateCheckSizedSelf(nodep, "LHS", nodep->srcp(), SELF, BOTH);
|
if (vdtypep && vdtypep->isString()) {
|
||||||
|
iterateCheckString(nodep, "LHS", nodep->srcp(), BOTH);
|
||||||
|
} else {
|
||||||
|
iterateCheckSizedSelf(nodep, "LHS", nodep->srcp(), SELF, BOTH);
|
||||||
|
}
|
||||||
|
|
||||||
if ((vdtypep && vdtypep->isString()) || nodep->srcp()->isString()) {
|
if ((vdtypep && vdtypep->isString()) || nodep->srcp()->isString()) {
|
||||||
AstNode* const newp
|
AstNode* const newp
|
||||||
= new AstReplicateN{nodep->fileline(), nodep->srcp()->unlinkFrBack(),
|
= new AstReplicateN{nodep->fileline(), nodep->srcp()->unlinkFrBack(),
|
||||||
@ -6731,11 +6741,11 @@ class WidthVisitor final : public VNVisitor {
|
|||||||
(void)underp; // cppcheck
|
(void)underp; // cppcheck
|
||||||
}
|
}
|
||||||
void iterateCheckString(AstNode* nodep, const char* side, AstNode* underp, Stage stage) {
|
void iterateCheckString(AstNode* nodep, const char* side, AstNode* underp, Stage stage) {
|
||||||
|
AstNodeDType* const expDTypep = nodep->findStringDType();
|
||||||
if (stage & PRELIM) {
|
if (stage & PRELIM) {
|
||||||
underp = userIterateSubtreeReturnEdits(underp, WidthVP{SELF, PRELIM}.p());
|
underp = userIterateSubtreeReturnEdits(underp, WidthVP{expDTypep, PRELIM}.p());
|
||||||
}
|
}
|
||||||
if (stage & FINAL) {
|
if (stage & FINAL) {
|
||||||
AstNodeDType* const expDTypep = nodep->findStringDType();
|
|
||||||
underp = iterateCheck(nodep, side, underp, SELF, FINAL, expDTypep, EXTEND_EXP);
|
underp = iterateCheck(nodep, side, underp, SELF, FINAL, expDTypep, EXTEND_EXP);
|
||||||
}
|
}
|
||||||
(void)underp; // cppcheck
|
(void)underp; // cppcheck
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -24,12 +24,12 @@ module t(/*AUTOARG*/
|
|||||||
|
|
||||||
integer cyc = 0;
|
integer cyc = 0;
|
||||||
|
|
||||||
string s;
|
string s, s2;
|
||||||
|
|
||||||
// Test loop
|
// Test loop
|
||||||
always @ (posedge clk) begin
|
always @ (posedge clk) begin
|
||||||
cyc <= cyc + 1;
|
cyc <= cyc + 1;
|
||||||
s = {cyc{"*"}};
|
s = {s2, {cyc{"*"}}};
|
||||||
if (cyc != s.len()) $stop;
|
if (cyc != s.len()) $stop;
|
||||||
if (cyc == 0 && s != "") $stop;
|
if (cyc == 0 && s != "") $stop;
|
||||||
if (cyc == 1 && s != "*") $stop;
|
if (cyc == 1 && s != "*") $stop;
|
||||||
|
@ -541,20 +541,22 @@
|
|||||||
</begin>
|
</begin>
|
||||||
<begin>
|
<begin>
|
||||||
<assign loc="d,53,14,53,15" dtype_id="10">
|
<assign loc="d,53,14,53,15" dtype_id="10">
|
||||||
<concatn loc="d,53,20,53,21" dtype_id="10">
|
<cvtpackstring loc="d,53,20,53,21" dtype_id="10">
|
||||||
<varref loc="d,53,17,53,20" name="t.all" dtype_id="10"/>
|
<concatn loc="d,53,20,53,21" dtype_id="10">
|
||||||
<cvtpackstring loc="d,53,24,53,28" dtype_id="10">
|
<varref loc="d,53,17,53,20" name="t.all" dtype_id="10"/>
|
||||||
<arraysel loc="d,53,24,53,28" dtype_id="10">
|
<cvtpackstring loc="d,53,24,53,28" dtype_id="10">
|
||||||
<varref loc="d,17,12,17,16" name="__Venumtab_enum_name2" dtype_id="16"/>
|
<arraysel loc="d,53,24,53,28" dtype_id="10">
|
||||||
<and loc="d,53,24,53,28" dtype_id="13">
|
<varref loc="d,17,12,17,16" name="__Venumtab_enum_name2" dtype_id="16"/>
|
||||||
<const loc="d,53,24,53,28" name="32'h7" dtype_id="14"/>
|
<and loc="d,53,24,53,28" dtype_id="13">
|
||||||
<ccast loc="d,53,22,53,23" dtype_id="13">
|
<const loc="d,53,24,53,28" name="32'h7" dtype_id="14"/>
|
||||||
<varref loc="d,53,22,53,23" name="t.unnamedblk1.e" dtype_id="13"/>
|
<ccast loc="d,53,22,53,23" dtype_id="13">
|
||||||
</ccast>
|
<varref loc="d,53,22,53,23" name="t.unnamedblk1.e" dtype_id="13"/>
|
||||||
</and>
|
</ccast>
|
||||||
</arraysel>
|
</and>
|
||||||
</cvtpackstring>
|
</arraysel>
|
||||||
</concatn>
|
</cvtpackstring>
|
||||||
|
</concatn>
|
||||||
|
</cvtpackstring>
|
||||||
<varref loc="d,53,10,53,13" name="t.all" dtype_id="10"/>
|
<varref loc="d,53,10,53,13" name="t.all" dtype_id="10"/>
|
||||||
</assign>
|
</assign>
|
||||||
</begin>
|
</begin>
|
||||||
@ -578,10 +580,12 @@
|
|||||||
<varref loc="d,55,7,55,8" name="t.e" dtype_id="11"/>
|
<varref loc="d,55,7,55,8" name="t.e" dtype_id="11"/>
|
||||||
</assign>
|
</assign>
|
||||||
<assign loc="d,56,11,56,12" dtype_id="10">
|
<assign loc="d,56,11,56,12" dtype_id="10">
|
||||||
<concatn loc="d,56,17,56,18" dtype_id="10">
|
<cvtpackstring loc="d,56,17,56,18" dtype_id="10">
|
||||||
<varref loc="d,56,14,56,17" name="t.all" dtype_id="10"/>
|
<concatn loc="d,56,17,56,18" dtype_id="10">
|
||||||
<const loc="d,56,21,56,25" name=""E04"" dtype_id="10"/>
|
<varref loc="d,56,14,56,17" name="t.all" dtype_id="10"/>
|
||||||
</concatn>
|
<const loc="d,56,21,56,25" name=""E04"" dtype_id="10"/>
|
||||||
|
</concatn>
|
||||||
|
</cvtpackstring>
|
||||||
<varref loc="d,56,7,56,10" name="t.all" dtype_id="10"/>
|
<varref loc="d,56,7,56,10" name="t.all" dtype_id="10"/>
|
||||||
</assign>
|
</assign>
|
||||||
<if loc="d,57,10,57,12">
|
<if loc="d,57,10,57,12">
|
||||||
|
Loading…
Reference in New Issue
Block a user