Add sorry messages for missing array methods

This commit is contained in:
Cary R 2021-01-07 22:26:14 -08:00
parent 89eabdfa35
commit 5442f3fee7
3 changed files with 153 additions and 3 deletions

View File

@ -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<const netstring_t*>(par_type)) {
const NetECString*par_string = dynamic_cast<const NetECString*>(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;
}
}

View File

@ -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()) {

35
parse.y
View File

@ -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