diff --git a/vhdlpp/debug.cc b/vhdlpp/debug.cc index 69311a24f..8f8eafb08 100644 --- a/vhdlpp/debug.cc +++ b/vhdlpp/debug.cc @@ -21,6 +21,7 @@ # include "entity.h" # include "architec.h" # include "expression.h" +# include "parse_types.h" # include "vsignal.h" # include "vtype.h" # include @@ -339,3 +340,9 @@ void ExpUNot::dump(ostream&out, int indent) const out << setw(indent) << "" << "not() at " << get_fileline() << endl; dump_operand1(out, indent+4); } + +void named_expr_t::dump(ostream&out, int indent) const +{ + out << setw(indent) << "" << name_ << "=>"; + expr_->dump(out, indent); +} diff --git a/vhdlpp/parse.y b/vhdlpp/parse.y index 9cacb7dba..6a51ffea4 100644 --- a/vhdlpp/parse.y +++ b/vhdlpp/parse.y @@ -218,7 +218,7 @@ const VType*parse_type_by_name(perm_string name) %type sequence_of_statements if_statement_else %type sequential_statement if_statement signal_assignment_statement -%type case_statement +%type case_statement procedure_call procedure_call_statement %type case_statement_alternative %type case_statement_alternative_list @@ -1194,6 +1194,32 @@ primary_unit | package_declaration ; +procedure_call + : IDENTIFIER + { + ProcedureCall* tmp = new ProcedureCall(lex_strings.make($1)); + sorrymsg(@1, "Procedure calls are not supported.\n"); + $$ = tmp; + } + | IDENTIFIER '(' association_list ')' + { + ProcedureCall* tmp = new ProcedureCall(lex_strings.make($1), $3); + sorrymsg(@1, "Procedure calls are not supported.\n"); + $$ = tmp; + } + | IDENTIFIER '(' error ')' + { + errormsg(@1, "Errors in procedure call.\n"); + yyerrok; + delete[]$1; + $$ = 0; + }; + +procedure_call_statement + : IDENTIFIER ':' procedure_call { $$ = $3; } + | procedure_call { $$ = $1; } + ; + process_statement : IDENTIFIER ':' K_postponed_opt K_process process_sensitivity_list_opt K_is_opt @@ -1363,6 +1389,7 @@ sequential_statement : if_statement { $$ = $1; } | signal_assignment_statement { $$ = $1; } | case_statement { $$ = $1; } + | procedure_call_statement { $$ = $1; } ; shift_expression : simple_expression { $$ = $1; } ; diff --git a/vhdlpp/parse_types.h b/vhdlpp/parse_types.h index 48af8654b..74c1e8ff1 100644 --- a/vhdlpp/parse_types.h +++ b/vhdlpp/parse_types.h @@ -20,7 +20,7 @@ */ # include "StringHeap.h" -class Expression; +# include "expression.h" class named_expr_t { @@ -29,6 +29,7 @@ class named_expr_t { perm_string name() const { return name_; } Expression* expr() const { return expr_; } + void dump(ostream&out, int indent) const; private: perm_string name_; Expression* expr_; diff --git a/vhdlpp/sequential.cc b/vhdlpp/sequential.cc index e879568d8..b5c6b0a96 100644 --- a/vhdlpp/sequential.cc +++ b/vhdlpp/sequential.cc @@ -133,3 +133,22 @@ CaseSeqStmt::CaseStmtAlternative::CaseStmtAlternative(Expression* exp, list* param_list) +: name_(name), param_list_(param_list) +{ +} + +ProcedureCall::~ProcedureCall() +{ + while(param_list_->size() > 0) { + named_expr_t* cur = param_list_->front(); + param_list_->pop_front(); + delete cur; + } +} diff --git a/vhdlpp/sequential.h b/vhdlpp/sequential.h index cccaca9d5..3b5caab0c 100644 --- a/vhdlpp/sequential.h +++ b/vhdlpp/sequential.h @@ -20,6 +20,7 @@ */ # include "LineInfo.h" +# include "parse_types.h" # include class Architecture; @@ -134,4 +135,18 @@ class CaseSeqStmt : public SequentialStmt { Expression* cond_; std::list alt_; }; + +class ProcedureCall : public SequentialStmt { + public: + ProcedureCall(perm_string name); + ProcedureCall(perm_string name, std::list* param_list); + ~ProcedureCall(); + + int elaborate(Entity*ent, Architecture*arc); + int emit(ostream&out, Entity*entity, Architecture*arc); + void dump(ostream&out, int indent) const; + private: + perm_string name_; + std::list* param_list_; +}; #endif diff --git a/vhdlpp/sequential_debug.cc b/vhdlpp/sequential_debug.cc index 703c7c6c9..fe78df513 100644 --- a/vhdlpp/sequential_debug.cc +++ b/vhdlpp/sequential_debug.cc @@ -99,3 +99,13 @@ void CaseSeqStmt::CaseStmtAlternative::dump(ostream& out, int indent) const ; cur != stmts_.end(); ++cur) (*cur)->dump(out, indent+1); } + +void ProcedureCall::dump(ostream& out, int indent) const +{ + out << setw(indent) << "" << "ProcedureCall at file=" << get_fileline() << endl; + out << setw(indent+2) << "" << name_ << "("; + for(list::const_iterator it = param_list_->begin(); + it != param_list_->end(); ++it) + (*it)->dump(out, indent); + out << ")" << endl; +} diff --git a/vhdlpp/sequential_elaborate.cc b/vhdlpp/sequential_elaborate.cc index e6f72180c..9fdb48647 100644 --- a/vhdlpp/sequential_elaborate.cc +++ b/vhdlpp/sequential_elaborate.cc @@ -88,3 +88,8 @@ int SignalSeqAssignment::elaborate(Entity*ent, Architecture*arc) return errors; } + +int ProcedureCall::elaborate(Entity*, Architecture*) +{ + return 0; +} diff --git a/vhdlpp/sequential_emit.cc b/vhdlpp/sequential_emit.cc index ede823246..97761b56d 100644 --- a/vhdlpp/sequential_emit.cc +++ b/vhdlpp/sequential_emit.cc @@ -98,3 +98,11 @@ int SignalSeqAssignment::emit(ostream&out, Entity*ent, Architecture*arc) return errors; } + +int ProcedureCall::emit(ostream&out, Entity*, Architecture*) +{ + out << " // " << get_fileline() << ": internal error: " + << "I don't know how to emit this sequential statement! " + << "type=" << typeid(*this).name() << endl; + return 1; +}