Check system/user tasks for always_comb/ff/latch synth.

This commit is contained in:
Cary R 2017-12-27 23:07:29 -08:00
parent 7d11fa662e
commit 932241ee87
2 changed files with 42 additions and 3 deletions

View File

@ -24,6 +24,7 @@
# include <typeinfo>
# include <cstdlib>
# include <climits>
# include <cstring>
# include "compiler.h"
# include "netlist.h"
# include "netmisc.h"
@ -3077,6 +3078,10 @@ bool NetProc::check_synth(ivl_process_type_t /* pr_type */,
return false;
}
// FIXME: User function calls still need to be checked (NetEUFunc).
// : Non-constant system functions need a warning (NetESFunc).
// : Constant functions should already be elaborated.
/* By default assign elements can be synthesized. */
bool NetAssignBase::check_synth(ivl_process_type_t /* pr_type */,
const NetScope* /* scope */ ) const
@ -3438,9 +3443,40 @@ bool NetScope::check_synth(ivl_process_type_t pr_type,
return result;
}
// FIXME: User task and function calls still need to be checked.
// : System task enables should be ignored and constant system functions
// : should also be okay. Non-constant system functions are an error.
bool NetSTask::check_synth(ivl_process_type_t pr_type,
const NetScope* /* scope */) const
{
if (strcmp(name(), "$ivl_darray_method$delete") == 0) {
cerr << get_fileline() << ": warning: Dynamic array "
"delete method cannot be synthesized "
<< get_process_type_as_string(pr_type) << endl;
} else {
cerr << get_fileline() << ": warning: System task ("
<< name() << ") cannot be synthesized "
<< get_process_type_as_string(pr_type) << endl;
}
return false;
}
bool NetTaskDef::check_synth(ivl_process_type_t pr_type,
const NetScope* scope) const
{
const NetScope *tscope = this->scope();
if (! tscope->is_auto()) {
cerr << tscope->get_def_file() << ":"
<< tscope->get_def_lineno()
<< ": warning: user task (" << tscope->basename()
<< ") must be automatic to be synthesized "
<< get_process_type_as_string(pr_type) << endl;
}
return proc_->check_synth(pr_type, scope);
}
bool NetUTask::check_synth(ivl_process_type_t pr_type,
const NetScope* scope) const
{
return task()->task_def()->check_synth(pr_type, scope);
}
bool NetWhile::check_synth(ivl_process_type_t pr_type,
const NetScope* scope) const

View File

@ -3744,6 +3744,7 @@ class NetSTask : public NetProc {
virtual void nex_output(NexusSet&);
virtual bool emit_proc(struct target_t*) const;
virtual void dump(ostream&, unsigned ind) const;
virtual bool check_synth(ivl_process_type_t pr_type, const NetScope*scope) const;
virtual bool evaluate_function(const LineInfo&loc,
map<perm_string,LocalVar>&ctx) const;
@ -3774,6 +3775,7 @@ class NetTaskDef : public NetBaseDef {
void dump(ostream&, unsigned) const;
DelayType delay_type(bool print_delay=false) const;
virtual bool check_synth(ivl_process_type_t pr_type, const NetScope*scope) const;
private: // not implemented
NetTaskDef(const NetTaskDef&);
@ -3891,6 +3893,7 @@ class NetUTask : public NetProc {
virtual bool emit_proc(struct target_t*) const;
virtual void dump(ostream&, unsigned ind) const;
virtual DelayType delay_type(bool print_delay=false) const;
virtual bool check_synth(ivl_process_type_t pr_type, const NetScope*scope) const;
private:
NetScope*task_;