The array properties can be available in a constant context

For most arrays the various properties are available as constant
values and can be evaluated in the compiler.
This commit is contained in:
Cary R 2016-09-11 14:24:27 -07:00
parent 3c9b39846c
commit c706c5dd90
1 changed files with 12 additions and 0 deletions

View File

@ -1549,6 +1549,18 @@ NetExpr* PECallFunction::elaborate_sfunc_(Design*des, NetScope*scope,
bool need_const = NEED_CONST & flags;
/* These functions can work in a constant context with a signal expression. */
if ((nparms == 1) && (dynamic_cast<PEIdent*>(parms_[0]))) {
if (strcmp(name, "$dimensions") == 0) need_const = false;
else if (strcmp(name, "$high") == 0) need_const = false;
else if (strcmp(name, "$increment") == 0) need_const = false;
else if (strcmp(name, "$left") == 0) need_const = false;
else if (strcmp(name, "$low") == 0) need_const = false;
else if (strcmp(name, "$right") == 0) need_const = false;
else if (strcmp(name, "$size") == 0) need_const = false;
else if (strcmp(name, "$unpacked_dimensions") == 0) need_const = false;
}
unsigned parm_errors = 0;
unsigned missing_parms = 0;
for (unsigned idx = 0 ; idx < nparms ; idx += 1) {