Fix queue `[$-i]` select as reference argument (#5411)
Signed-off-by: Krzysztof Bieganski <kbieganski@antmicro.com>
This commit is contained in:
parent
5cb6f370e9
commit
d896f1ff08
|
|
@ -493,7 +493,7 @@ class TaskVisitor final : public VNVisitor {
|
|||
|| VN_IS(pinp, ArraySel)) {
|
||||
refArgOk = true;
|
||||
} else if (const AstCMethodHard* const cMethodp = VN_CAST(pinp, CMethodHard)) {
|
||||
refArgOk = cMethodp->name() == "at";
|
||||
refArgOk = cMethodp->name() == "at" || cMethodp->name() == "atBack";
|
||||
}
|
||||
if (refArgOk) {
|
||||
if (AstVarRef* const varrefp = VN_CAST(pinp, VarRef)) {
|
||||
|
|
|
|||
|
|
@ -3677,10 +3677,11 @@ class WidthVisitor final : public VNVisitor {
|
|||
}
|
||||
void methodCallQueue(AstMethodCall* nodep, AstQueueDType* adtypep) {
|
||||
AstCMethodHard* newp = nullptr;
|
||||
if (nodep->name() == "at") { // Created internally for []
|
||||
if (nodep->name() == "at" || nodep->name() == "atBack") { // Created internally for []
|
||||
methodOkArguments(nodep, 1, 1);
|
||||
methodCallLValueRecurse(nodep, nodep->fromp(), VAccess::WRITE);
|
||||
newp = new AstCMethodHard{nodep->fileline(), nodep->fromp()->unlinkFrBack(), "at"};
|
||||
newp = new AstCMethodHard{nodep->fileline(), nodep->fromp()->unlinkFrBack(),
|
||||
nodep->name()};
|
||||
newp->dtypeFrom(adtypep->subDTypep());
|
||||
} else if (nodep->name() == "num" // function int num()
|
||||
|| nodep->name() == "size") {
|
||||
|
|
|
|||
|
|
@ -9,8 +9,13 @@ module t(/*AUTOARG*/);
|
|||
int q[$];
|
||||
int r;
|
||||
|
||||
function void set_val(ref int lhs, input int rhs);
|
||||
lhs = rhs;
|
||||
endfunction
|
||||
|
||||
initial begin
|
||||
q = { 20, 30, 40 };
|
||||
q = { 20, 50, 40 };
|
||||
set_val(q[$-1], 30);
|
||||
|
||||
r = q[$];
|
||||
if (r != 40) $stop;
|
||||
|
|
|
|||
Loading…
Reference in New Issue