SystemVerilog: honor with-clause for class queue min/max
Route class queue-property min/max calls with `with (...)` through predicate-based locator elaboration so filtered extrema behave consistently with queue and darray locator semantics. Made-with: Cursor
This commit is contained in:
parent
0cd7205585
commit
c189cc2642
13
elab_expr.cc
13
elab_expr.cc
|
|
@ -3838,6 +3838,19 @@ NetExpr* PECallFunction::elaborate_expr_method_(Design*des, NetScope*scope,
|
|||
des->errors += 1;
|
||||
return 0;
|
||||
}
|
||||
if (with_expr_) {
|
||||
if (!parms_.empty()) {
|
||||
cerr << get_fileline() << ": error: array locator "
|
||||
<< "`with` clause cannot be combined with a "
|
||||
<< "method argument." << endl;
|
||||
des->errors += 1;
|
||||
return 0;
|
||||
}
|
||||
return elab_queue_locator_with_predicate(
|
||||
des, scope, *this, with_expr_, prop,
|
||||
element_type, static_cast<ivl_type_t>(queue),
|
||||
method_name);
|
||||
}
|
||||
NetESFunc*sys_expr = new NetESFunc(
|
||||
method_name == "min" ? "$ivl_queue_method$min"
|
||||
: "$ivl_queue_method$max",
|
||||
|
|
|
|||
|
|
@ -49,6 +49,10 @@ module test;
|
|||
`check(r[0], 1);
|
||||
`check(r[1], 1);
|
||||
|
||||
r = c.q.max() with (item < 7);
|
||||
`check(r.size, 1);
|
||||
`check(r[0], 6);
|
||||
|
||||
r = c.q.max();
|
||||
`check(r.size, 2);
|
||||
`check(r[0], 7);
|
||||
|
|
|
|||
Loading…
Reference in New Issue