vhdlpp: Basic loop support (loop..end loop).

This commit is contained in:
Maciej Suminski 2016-01-07 16:14:41 +01:00
parent b4d5248c67
commit 79f38b8c56
4 changed files with 22 additions and 3 deletions

View File

@ -1660,7 +1660,6 @@ loop_statement
BasicLoopStatement* tmp = new BasicLoopStatement(loop_name, $3); BasicLoopStatement* tmp = new BasicLoopStatement(loop_name, $3);
FILE_NAME(tmp, @2); FILE_NAME(tmp, @2);
sorrymsg(@1, "Loop statements are not supported.\n");
$$ = tmp; $$ = tmp;
}; };

View File

@ -273,6 +273,8 @@ class BasicLoopStatement : public LoopStatement {
~BasicLoopStatement(); ~BasicLoopStatement();
int elaborate(Entity*ent, ScopeBase*scope); int elaborate(Entity*ent, ScopeBase*scope);
int emit(ostream&out, Entity*ent, ScopeBase*scope);
void write_to_stream(std::ostream&fd);
void dump(ostream&out, int indent) const; void dump(ostream&out, int indent) const;
}; };

View File

@ -212,9 +212,9 @@ int WhileLoopStatement::elaborate(Entity*ent, ScopeBase*scope)
return errors; return errors;
} }
int BasicLoopStatement::elaborate(Entity*, ScopeBase*) int BasicLoopStatement::elaborate(Entity*ent, ScopeBase*scope)
{ {
return 0; return elaborate_substatements(ent, scope);
} }
int ReportStmt::elaborate(Entity*ent, ScopeBase*scope) int ReportStmt::elaborate(Entity*ent, ScopeBase*scope)

View File

@ -477,6 +477,24 @@ int ForLoopStatement::emit_runtime_(ostream&out, Entity*ent, ScopeBase*scope)
return errors; return errors;
} }
int BasicLoopStatement::emit(ostream&out, Entity*ent, ScopeBase*scope)
{
int errors = 0;
out << "forever begin" << endl;
errors += emit_substatements(out, ent, scope);
out << "end" << endl;
return errors;
}
void BasicLoopStatement::write_to_stream(std::ostream&fd)
{
fd << "loop" << endl;
write_to_stream_substatements(fd);
fd << "end loop;" << endl;
}
int ReportStmt::emit(ostream&out, Entity*ent, ScopeBase*scope) int ReportStmt::emit(ostream&out, Entity*ent, ScopeBase*scope)
{ {
out << "$display(\"** "; out << "$display(\"** ";