Don't allow non-vectorable arguments to $signed/$unsigned.

This led to an assertion failure in many cases (see br1029).
1364-2012 indicates it is illegal.
This commit is contained in:
Martin Whitaker 2018-05-14 21:30:56 +01:00
parent 5a4e99b0e8
commit 87c01c55c0
2 changed files with 10 additions and 3 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999-2017 Stephen Williams (steve@icarus.com)
* Copyright (c) 1999-2018 Stephen Williams (steve@icarus.com)
* Copyright CERN 2013 / Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
@ -1456,6 +1456,13 @@ NetExpr* PECallFunction::elaborate_sfunc_(Design*des, NetScope*scope,
return 0;
}
if (!type_is_vectorable(expr_type_)) {
cerr << get_fileline() << ": error: The argument to "
<< name << " must be a vector type." << endl;
des->errors += 1;
return 0;
}
if (debug_elaborate) {
cerr << get_fileline() << ": PECallFunction::elaborate_sfunc_: "
<< name << " expression is the argument cast to expr_wid=" << expr_wid << endl;

View File

@ -1,5 +1,5 @@
/*
* Copyright CERN 2016
* Copyright CERN 2016-2018
* @author Maciej Suminski (maciej.suminski@cern.ch)
*
* This source code is free software; you can redistribute it
@ -201,7 +201,7 @@ void preload_std_funcs(void)
args = new list<InterfacePort*>();
args->push_back(new InterfacePort(&primitive_REAL));
register_std_subprogram(new SubprogramBuiltin(perm_string::literal("integer"),
perm_string::literal("$signed"),
perm_string::literal("int'"),
args, &primitive_INTEGER));
/* function std_logic_vector