From 27b58a7f939ae2793b6dbfcbcaec9578013d6725 Mon Sep 17 00:00:00 2001 From: Stephen Williams Date: Sun, 15 May 2011 08:57:19 -0700 Subject: [PATCH] Reorganize architecture debug methods. --- vhdlpp/Makefile.in | 3 +- vhdlpp/architec.h | 3 ++ vhdlpp/architec_debug.cc | 73 ++++++++++++++++++++++++++++++++++++ vhdlpp/architec_elaborate.cc | 5 +++ vhdlpp/debug.cc | 43 --------------------- 5 files changed, 83 insertions(+), 44 deletions(-) create mode 100644 vhdlpp/architec_debug.cc diff --git a/vhdlpp/Makefile.in b/vhdlpp/Makefile.in index cb30cc97c..3622fd413 100644 --- a/vhdlpp/Makefile.in +++ b/vhdlpp/Makefile.in @@ -62,8 +62,9 @@ M = StringHeap.o LineInfo.o O = main.o architec.o architec_elaborate.o compiler.o entity.o entity_elaborate.o \ expression.o package.o scope.o sequential.o vsignal.o vtype.o vtype_elaborate.o \ lexor.o lexor_keyword.o parse.o \ - parse_misc.o library.o vhdlreal.o vhdlint.o debug.o \ + parse_misc.o library.o vhdlreal.o vhdlint.o \ architec_emit.o entity_emit.o expression_emit.o vtype_emit.o \ + debug.o architec_debug.o \ $M all: dep vhdlpp@EXEEXT@ diff --git a/vhdlpp/architec.h b/vhdlpp/architec.h index d032c8826..858b3e760 100644 --- a/vhdlpp/architec.h +++ b/vhdlpp/architec.h @@ -128,6 +128,9 @@ class ProcessStatement : public Architecture::Statement { ProcessStatement(perm_string iname); ~ProcessStatement(); + virtual int elaborate(Entity*ent, Architecture*arc); + virtual void dump(ostream&out, int indent =0) const; + private: perm_string iname_; diff --git a/vhdlpp/architec_debug.cc b/vhdlpp/architec_debug.cc new file mode 100644 index 000000000..020328800 --- /dev/null +++ b/vhdlpp/architec_debug.cc @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2011 Stephen Williams (steve@icarus.com) + * + * This source code is free software; you can redistribute it + * and/or modify it in source code form under the terms of the GNU + * General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +# include "architec.h" +# include "expression.h" +# include +# include +# include + +void Architecture::dump(ostream&out, perm_string of_entity, int indent) const +{ + out << setw(indent) << "" << "architecture " << name_ + << " of entity " << of_entity + << " file=" << get_fileline() << endl; + + dump_scope(out); + + for (list::const_iterator cur = statements_.begin() + ; cur != statements_.end() ; ++cur) { + (*cur)->dump(out, indent+3); + } +} + +void Architecture::Statement::dump(ostream&out, int indent) const +{ + out << setw(indent) << "" << "Architecture::Statement at file=" << get_fileline() << endl; +} + +void ComponentInstantiation::dump(ostream&out, int indent) const +{ + out << setw(indent) << "" << "Component Instantiation file=" << get_fileline() << endl; + + for (map::const_iterator cur = port_map_.begin() + ; cur != port_map_.end() ; ++cur) { + out << setw(indent+2) <<""<< cur->first << " => ..." << endl; + cur->second->dump(out, indent+6); + } + +} + +void SignalAssignment::dump(ostream&out, int indent) const +{ + out << setw(indent) << "" << "SignalAssignment file=" << get_fileline() << endl; + lval_->dump(out, indent+1); + out << setw(indent+2) << "" << "<= ..." << endl; + + for (list::const_iterator cur = rval_.begin() + ; cur != rval_.end() ; ++cur) { + (*cur)->dump(out, indent+2); + } +} + +void ProcessStatement::dump(ostream&out, int indent) const +{ + out << setw(indent) << "" << "ProcessStatement name_=" << iname_ + << " file=" << get_fileline() << endl; +} diff --git a/vhdlpp/architec_elaborate.cc b/vhdlpp/architec_elaborate.cc index 89e062051..fcd403ee5 100644 --- a/vhdlpp/architec_elaborate.cc +++ b/vhdlpp/architec_elaborate.cc @@ -68,3 +68,8 @@ int ComponentInstantiation::elaborate(Entity*ent, Architecture*arc) return errors; } + +int ProcessStatement::elaborate(Entity*ent, Architecture*arc) +{ + return 0; +} diff --git a/vhdlpp/debug.cc b/vhdlpp/debug.cc index 99496474b..6ca175f0e 100644 --- a/vhdlpp/debug.cc +++ b/vhdlpp/debug.cc @@ -122,25 +122,6 @@ void Entity::dump(ostream&out, int indent) const } } -void Architecture::dump(ostream&out, perm_string of_entity, int indent) const -{ - out << setw(indent) << "" << "architecture " << name_ - << " of entity " << of_entity - << " file=" << get_fileline() << endl; - - dump_scope(out); - - for (list::const_iterator cur = statements_.begin() - ; cur != statements_.end() ; ++cur) { - (*cur)->dump(out, indent+3); - } -} - -void Architecture::Statement::dump(ostream&out, int indent) const -{ - out << setw(indent) << "" << "Architecture::Statement at file=" << get_fileline() << endl; -} - void Signal::dump(ostream&out, int indent) const { out << setw(indent) << "" << "signal " << name_ << " is "; @@ -151,30 +132,6 @@ void Signal::dump(ostream&out, int indent) const out << endl; } -void SignalAssignment::dump(ostream&out, int indent) const -{ - out << setw(indent) << "" << "SignalAssignment file=" << get_fileline() << endl; - lval_->dump(out, indent+1); - out << setw(indent+2) << "" << "<= ..." << endl; - - for (list::const_iterator cur = rval_.begin() - ; cur != rval_.end() ; ++cur) { - (*cur)->dump(out, indent+2); - } -} - -void ComponentInstantiation::dump(ostream&out, int indent) const -{ - out << setw(indent) << "" << "Component Instantiation file=" << get_fileline() << endl; - - for (map::const_iterator cur = port_map_.begin() - ; cur != port_map_.end() ; ++cur) { - out << setw(indent+2) <<""<< cur->first << " => ..." << endl; - cur->second->dump(out, indent+6); - } - -} - void Expression::dump(ostream&out, int indent) const { out << setw(indent) << "" << "Expression [" << typeid(*this).name() << "]"