vhdlpp: 'wait for' statement.
This commit is contained in:
parent
d6ff1946f9
commit
68f8007fc4
|
|
@ -359,7 +359,7 @@ static void touchup_interface_for_functions(std::list<InterfacePort*>*ports)
|
||||||
%type <sequ> sequential_statement if_statement signal_assignment signal_assignment_statement
|
%type <sequ> sequential_statement if_statement signal_assignment signal_assignment_statement
|
||||||
%type <sequ> case_statement procedure_call procedure_call_statement
|
%type <sequ> case_statement procedure_call procedure_call_statement
|
||||||
%type <sequ> loop_statement variable_assignment variable_assignment_statement
|
%type <sequ> loop_statement variable_assignment variable_assignment_statement
|
||||||
%type <sequ> assertion_statement report_statement return_statement
|
%type <sequ> assertion_statement report_statement return_statement wait_for_statement
|
||||||
|
|
||||||
%type <range> range
|
%type <range> range
|
||||||
%type <range_list> range_list index_constraint
|
%type <range_list> range_list index_constraint
|
||||||
|
|
@ -2201,6 +2201,7 @@ sequential_statement
|
||||||
| return_statement { $$ = $1; }
|
| return_statement { $$ = $1; }
|
||||||
| report_statement { $$ = $1; }
|
| report_statement { $$ = $1; }
|
||||||
| assertion_statement { $$ = $1; }
|
| assertion_statement { $$ = $1; }
|
||||||
|
| wait_for_statement { $$ = $1; }
|
||||||
| K_null ';' { $$ = 0; }
|
| K_null ';' { $$ = 0; }
|
||||||
| error ';'
|
| error ';'
|
||||||
{ errormsg(@1, "Syntax error in sequential statement.\n");
|
{ errormsg(@1, "Syntax error in sequential statement.\n");
|
||||||
|
|
@ -2631,6 +2632,14 @@ variable_declaration /* IEEE 1076-2008 P6.4.2.4 */
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
wait_for_statement
|
||||||
|
: K_wait K_for expression ';'
|
||||||
|
{ WaitForStmt*tmp = new WaitForStmt($3);
|
||||||
|
FILE_NAME(tmp, @1);
|
||||||
|
$$ = tmp;
|
||||||
|
}
|
||||||
|
;
|
||||||
|
|
||||||
waveform
|
waveform
|
||||||
: waveform_elements
|
: waveform_elements
|
||||||
{ $$ = $1; }
|
{ $$ = $1; }
|
||||||
|
|
|
||||||
|
|
@ -284,3 +284,8 @@ AssertStmt::AssertStmt(Expression*condition, const char*msg, ReportStmt::severit
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string AssertStmt::default_msg_ = std::string("Assertion violation.");
|
const std::string AssertStmt::default_msg_ = std::string("Assertion violation.");
|
||||||
|
|
||||||
|
WaitForStmt::WaitForStmt(Expression*delay)
|
||||||
|
: delay_(delay)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -308,4 +308,17 @@ class AssertStmt : public ReportStmt {
|
||||||
static const std::string default_msg_;
|
static const std::string default_msg_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class WaitForStmt : public SequentialStmt {
|
||||||
|
public:
|
||||||
|
WaitForStmt(Expression*delay);
|
||||||
|
|
||||||
|
void dump(ostream&out, int indent) const;
|
||||||
|
int elaborate(Entity*ent, ScopeBase*scope);
|
||||||
|
int emit(ostream&out, Entity*entity, ScopeBase*scope);
|
||||||
|
void write_to_stream(std::ostream&fd);
|
||||||
|
|
||||||
|
private:
|
||||||
|
Expression*delay_;
|
||||||
|
};
|
||||||
|
|
||||||
#endif /* IVL_sequential_H */
|
#endif /* IVL_sequential_H */
|
||||||
|
|
|
||||||
|
|
@ -180,3 +180,10 @@ void AssertStmt::dump(ostream&out, int indent) const
|
||||||
cond_->dump(out, indent+3);
|
cond_->dump(out, indent+3);
|
||||||
ReportStmt::dump(out, indent+3);
|
ReportStmt::dump(out, indent+3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WaitForStmt::dump(ostream&out, int indent) const
|
||||||
|
{
|
||||||
|
out << setw(indent) << "" << "WaitForStmt at file=" << get_fileline() << endl;
|
||||||
|
out << setw(indent+3) << "" << "delay: ";
|
||||||
|
delay_->dump(out, indent+3);
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -197,3 +197,8 @@ int AssertStmt::elaborate(Entity*ent, ScopeBase*scope)
|
||||||
{
|
{
|
||||||
return cond_->elaborate_expr(ent, scope, 0);
|
return cond_->elaborate_expr(ent, scope, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int WaitForStmt::elaborate(Entity*ent, ScopeBase*scope)
|
||||||
|
{
|
||||||
|
return delay_->elaborate_expr(ent, scope, 0);
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -512,3 +512,20 @@ void AssertStmt::write_to_stream(std::ostream&fd)
|
||||||
fd << std::endl;
|
fd << std::endl;
|
||||||
ReportStmt::write_to_stream(fd);
|
ReportStmt::write_to_stream(fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int WaitForStmt::emit(ostream&out, Entity*ent, ScopeBase*scope)
|
||||||
|
{
|
||||||
|
int errors = 0;
|
||||||
|
|
||||||
|
out << "#(";
|
||||||
|
errors += delay_->emit(out, ent, scope);
|
||||||
|
out << ")";
|
||||||
|
|
||||||
|
return errors;
|
||||||
|
}
|
||||||
|
|
||||||
|
void WaitForStmt::write_to_stream(std::ostream&fd)
|
||||||
|
{
|
||||||
|
fd << "wait for ";
|
||||||
|
delay_->write_to_stream(fd);
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue