From c706c5dd90906ccf44db4e77cfe36901eb39123f Mon Sep 17 00:00:00 2001 From: Cary R Date: Sun, 11 Sep 2016 14:24:27 -0700 Subject: [PATCH] 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. --- elab_expr.cc | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/elab_expr.cc b/elab_expr.cc index e48fc5206..84754cc46 100644 --- a/elab_expr.cc +++ b/elab_expr.cc @@ -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(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) {