Check to see that always_comb/ff/latch do not have delays/events

This commit is contained in:
Cary R 2017-12-05 22:09:05 -08:00
parent 39c14edb76
commit cb0ffd734e
3 changed files with 38 additions and 0 deletions

View File

@ -6136,6 +6136,38 @@ bool Design::check_proc_delay() const
cerr << pr->get_fileline() << ": : A runtime"
<< " infinite loop may be possible." << endl;
}
// The always_comb/ff/latch blocks have special delay
// rules that need to be checked.
if ((pr->type() == IVL_PR_ALWAYS_COMB) ||
(pr->type() == IVL_PR_ALWAYS_FF) ||
(pr->type() == IVL_PR_ALWAYS_LATCH)) {
const NetEvWait *wait = dynamic_cast<const NetEvWait*> (pr->statement());
if (! wait) {
// The always_comb/latch have an event wait
// added automatically by the compiler.
assert(pr->type() == IVL_PR_ALWAYS_FF);
cerr << pr->get_fileline() << ": error: the "
<< "first statement of an always_ff must "
<< "be an event control." << endl;
result_flag = false;
} else if (wait->statement()->delay_type() != NO_DELAY) {
cerr << pr->get_fileline() << ": error: there "
<< "must ";
if (pr->type() == IVL_PR_ALWAYS_FF) {
cerr << "only be a single event control "
<< "and no blocking delays in an "
<< "always_ff process.";
} else {
cerr << "be no event controls or blocking "
<< "delays in an always_comb/latch "
<< "process.";
}
cerr << endl;
result_flag = false;
}
}
}
/* If this is a final block it must not have a delay,

View File

@ -442,3 +442,8 @@ NetProc* NetEvWait::statement()
{
return statement_;
}
const NetProc* NetEvWait::statement() const
{
return statement_;
}

View File

@ -3406,6 +3406,7 @@ class NetEvWait : public NetProc {
inline bool has_t0_trigger() const { return has_t0_trigger_; };
NetProc*statement();
const NetProc*statement() const;
virtual bool emit_proc(struct target_t*) const;
bool emit_recurse(struct target_t*) const;