From 5442f3fee735578703b7a075c86cdd06afd74e4b Mon Sep 17 00:00:00 2001 From: Cary R Date: Thu, 7 Jan 2021 22:26:14 -0800 Subject: [PATCH] Add sorry messages for missing array methods --- elab_expr.cc | 96 ++++++++++++++++++++++++++++++++++++++++++++++++++-- elaborate.cc | 25 ++++++++++++++ parse.y | 35 ++++++++++++++++++- 3 files changed, 153 insertions(+), 3 deletions(-) diff --git a/elab_expr.cc b/elab_expr.cc index 3458e5471..de82f31df 100644 --- a/elab_expr.cc +++ b/elab_expr.cc @@ -1354,7 +1354,7 @@ unsigned PECallFunction::test_width_method_(Design*des, NetScope*scope, cerr << get_fileline() << ": " << __func__ << ": " << "net->net_type()=" << *net->net_type() << endl; } - + const netdarray_t*use_darray = 0; if (net != 0) @@ -2934,7 +2934,7 @@ NetExpr* PECallFunction::elaborate_expr_method_par_(Design*, NetScope*scope, // expression is a constant string, it should be able to calculate the // result at compile time. if (dynamic_cast(par_type)) { - + const NetECString*par_string = dynamic_cast(par); ivl_assert(*par, par_string); string par_value = par_string->value().as_string(); @@ -4349,6 +4349,98 @@ NetExpr* PEIdent::elaborate_expr(Design*des, NetScope*scope, fun->parm(0, arg); return fun; + } else if (member_comp.name == "find") { + cerr << get_fileline() << ": sorry: 'find()' " + "array location method is not currently " + "implemented." << endl; + des->errors += 1; + return 0; + } else if (member_comp.name == "find_index") { + cerr << get_fileline() << ": sorry: 'find_index()' " + "array location method is not currently " + "implemented." << endl; + des->errors += 1; + return 0; + } else if (member_comp.name == "find_first") { + cerr << get_fileline() << ": sorry: 'find_first()' " + "array location method is not currently " + "implemented." << endl; + des->errors += 1; + return 0; + } else if (member_comp.name == "find_first_index") { + cerr << get_fileline() << ": sorry: 'find_first_index()' " + "array location method is not currently " + "implemented." << endl; + des->errors += 1; + return 0; + } else if (member_comp.name == "find_last") { + cerr << get_fileline() << ": sorry: 'find_last()' " + "array location method is not currently " + "implemented." << endl; + des->errors += 1; + return 0; + } else if (member_comp.name == "find_last_index") { + cerr << get_fileline() << ": sorry: 'find_last_index()' " + "array location method is not currently " + "implemented." << endl; + des->errors += 1; + return 0; + } else if (member_comp.name == "min") { + cerr << get_fileline() << ": sorry: 'min()' " + "array location method is not currently " + "implemented." << endl; + des->errors += 1; + return 0; + } else if (member_comp.name == "max") { + cerr << get_fileline() << ": sorry: 'max()' " + "array location method is not currently " + "implemented." << endl; + des->errors += 1; + return 0; + } else if (member_comp.name == "unique") { + cerr << get_fileline() << ": sorry: 'unique()' " + "array location method is not currently " + "implemented." << endl; + des->errors += 1; + return 0; + } else if (member_comp.name == "unique_index") { + cerr << get_fileline() << ": sorry: 'unique_index()' " + "array location method is not currently " + "implemented." << endl; + des->errors += 1; + return 0; +// FIXME: Check this is a real or integral type. + } else if (member_comp.name == "sum") { + cerr << get_fileline() << ": sorry: 'sum()' " + "array reduction method is not currently " + "implemented." << endl; + des->errors += 1; + return 0; + } else if (member_comp.name == "product") { + cerr << get_fileline() << ": sorry: 'product()' " + "array reduction method is not currently " + "implemented." << endl; + des->errors += 1; + return 0; +// FIXME: Check this is only an integral type. + } else if (member_comp.name == "and") { + cerr << get_fileline() << ": sorry: 'and()' " + "array reduction method is not currently " + "implemented." << endl; + des->errors += 1; + return 0; + } else if (member_comp.name == "or") { + cerr << get_fileline() << ": sorry: 'or()' " + "array reduction method is not currently " + "implemented." << endl; + des->errors += 1; + return 0; + } else if (member_comp.name == "xor") { + cerr << get_fileline() << ": sorry: 'xor()' " + "array reduction method is not currently " + "implemented." << endl; + des->errors += 1; + return 0; } } diff --git a/elaborate.cc b/elaborate.cc index c972d3260..2eb0161e1 100644 --- a/elaborate.cc +++ b/elaborate.cc @@ -3816,6 +3816,31 @@ NetProc* PCallTask::elaborate_method_(Design*des, NetScope*scope, IVL_VT_BOOL, 32, true, method_name, "$size"); + else if (method_name=="reverse") { + cerr << get_fileline() << ": sorry: 'reverse()' " + "array sorting method is not currently supported." + << endl; + des->errors += 1; + return 0; + } else if (method_name=="sort") { + cerr << get_fileline() << ": sorry: 'sort()' " + "array sorting method is not currently supported." + << endl; + des->errors += 1; + return 0; + } else if (method_name=="rsort") { + cerr << get_fileline() << ": sorry: 'rsort()' " + "array sorting method is not currently supported." + << endl; + des->errors += 1; + return 0; + } else if (method_name=="shuffle") { + cerr << get_fileline() << ": sorry: 'shuffle()' " + "array sorting method is not currently supported." + << endl; + des->errors += 1; + return 0; + } } if (net->queue_type()) { diff --git a/parse.y b/parse.y index caa9abcc0..46e641057 100644 --- a/parse.y +++ b/parse.y @@ -3851,6 +3851,39 @@ expr_primary $$ = tmp; delete $1; } + /* These are array methods that cannot be matched with the above rule */ + | hierarchy_identifier '.' K_and + { pform_name_t * nm = $1; + nm->push_back(name_component_t(lex_strings.make("and"))); + PEIdent*tmp = pform_new_ident(@1, *nm); + FILE_NAME(tmp, @1); + $$ = tmp; + delete nm; + } + | hierarchy_identifier '.' K_or + { pform_name_t * nm = $1; + nm->push_back(name_component_t(lex_strings.make("or"))); + PEIdent*tmp = pform_new_ident(@1, *nm); + FILE_NAME(tmp, @1); + $$ = tmp; + delete nm; + } + | hierarchy_identifier '.' K_unique + { pform_name_t * nm = $1; + nm->push_back(name_component_t(lex_strings.make("unique"))); + PEIdent*tmp = pform_new_ident(@1, *nm); + FILE_NAME(tmp, @1); + $$ = tmp; + delete nm; + } + | hierarchy_identifier '.' K_xor + { pform_name_t * nm = $1; + nm->push_back(name_component_t(lex_strings.make("xor"))); + PEIdent*tmp = pform_new_ident(@1, *nm); + FILE_NAME(tmp, @1); + $$ = tmp; + delete nm; + } | PACKAGE_IDENTIFIER K_SCOPE_RES hierarchy_identifier { $$ = pform_package_ident(@2, $1, $3); @@ -5524,7 +5557,7 @@ net_type This is used by parameter_assign, which is found to the right of the param_type in various rules. */ -param_type : data_type_or_implicit { param_data_type = $1; } +param_type : data_type_or_implicit { param_data_type = $1; } /* parameter and localparam assignment lists are broken into separate BNF so that I can call slightly different parameter