2011-01-24 05:26:27 +01:00
|
|
|
/*
|
|
|
|
|
* 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
|
2012-08-29 03:41:23 +02:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2011-01-24 05:26:27 +01:00
|
|
|
* Picture Elements, Inc., 777 Panoramic Way, Berkeley, CA 94704.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
# include "entity.h"
|
|
|
|
|
# include "architec.h"
|
2011-01-30 02:27:30 +01:00
|
|
|
# include "expression.h"
|
2011-07-05 15:46:21 +02:00
|
|
|
# include "parse_types.h"
|
2013-05-06 04:05:46 +02:00
|
|
|
# include "sequential.h"
|
2011-03-22 17:16:20 +01:00
|
|
|
# include "vsignal.h"
|
2011-02-14 01:37:10 +01:00
|
|
|
# include "vtype.h"
|
2011-01-24 05:26:27 +01:00
|
|
|
# include <fstream>
|
|
|
|
|
# include <iomanip>
|
2011-01-30 02:27:30 +01:00
|
|
|
# include <typeinfo>
|
2011-01-24 05:26:27 +01:00
|
|
|
|
|
|
|
|
static ostream& operator << (ostream&out, port_mode_t that)
|
|
|
|
|
{
|
|
|
|
|
switch (that) {
|
|
|
|
|
case PORT_NONE:
|
|
|
|
|
out << "NO-PORT";
|
|
|
|
|
break;
|
|
|
|
|
case PORT_IN:
|
|
|
|
|
out << "IN";
|
|
|
|
|
break;
|
|
|
|
|
case PORT_OUT:
|
|
|
|
|
out << "OUT";
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
out << "PORT-????";
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
return out;
|
|
|
|
|
}
|
|
|
|
|
|
2011-04-18 02:19:09 +02:00
|
|
|
void dump_design_entities(ostream&file)
|
2011-01-24 05:26:27 +01:00
|
|
|
{
|
|
|
|
|
for (map<perm_string,Entity*>::iterator cur = design_entities.begin()
|
|
|
|
|
; cur != design_entities.end() ; ++cur) {
|
|
|
|
|
cur->second->dump(file);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2011-10-16 02:41:48 +02:00
|
|
|
void ComponentBase::dump_generics(ostream&out, int indent) const
|
|
|
|
|
{
|
|
|
|
|
if (parms_.empty()) {
|
|
|
|
|
out << setw(indent) << "" << "No generics" << endl;
|
|
|
|
|
} else {
|
|
|
|
|
out << setw(indent) << "" << "GENERICS:" << endl;
|
|
|
|
|
for (vector<InterfacePort*>::const_iterator cur = parms_.begin()
|
|
|
|
|
; cur != parms_.end() ; ++cur) {
|
|
|
|
|
InterfacePort*item = *cur;
|
|
|
|
|
out << setw(indent+2) << "" << item->name
|
|
|
|
|
<< " : " << item->mode
|
|
|
|
|
<< ", type=";
|
|
|
|
|
if (item->type)
|
|
|
|
|
item->type->show(out);
|
|
|
|
|
else
|
|
|
|
|
out << "<nil>";
|
|
|
|
|
out << ", file=" << item->get_fileline() << endl;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2011-04-06 17:27:58 +02:00
|
|
|
void ComponentBase::dump_ports(ostream&out, int indent) const
|
2011-01-24 05:26:27 +01:00
|
|
|
{
|
2011-07-29 02:07:49 +02:00
|
|
|
if (ports_.empty()) {
|
2011-04-06 17:27:58 +02:00
|
|
|
out << setw(indent) << "" << "No ports" << endl;
|
2011-01-24 05:26:27 +01:00
|
|
|
} else {
|
2011-04-06 17:27:58 +02:00
|
|
|
out << setw(indent) << "" << "PORTS:" << endl;
|
2011-02-03 04:59:20 +01:00
|
|
|
for (vector<InterfacePort*>::const_iterator cur = ports_.begin()
|
|
|
|
|
; cur != ports_.end() ; ++cur) {
|
2011-01-24 05:26:27 +01:00
|
|
|
InterfacePort*item = *cur;
|
2011-04-06 17:27:58 +02:00
|
|
|
out << setw(indent+2) << "" << item->name
|
2011-01-24 05:26:27 +01:00
|
|
|
<< " : " << item->mode
|
2011-02-14 04:01:21 +01:00
|
|
|
<< ", type=";
|
|
|
|
|
if (item->type)
|
|
|
|
|
item->type->show(out);
|
|
|
|
|
else
|
|
|
|
|
out << "<nil>";
|
|
|
|
|
out << ", file=" << item->get_fileline() << endl;
|
2011-01-24 05:26:27 +01:00
|
|
|
}
|
|
|
|
|
}
|
2011-03-22 17:16:20 +01:00
|
|
|
}
|
|
|
|
|
|
2011-04-14 03:30:00 +02:00
|
|
|
void Scope::dump_scope(ostream&out) const
|
|
|
|
|
{
|
2011-04-18 02:19:09 +02:00
|
|
|
// Dump types
|
2013-05-13 04:17:12 +02:00
|
|
|
out << " -- imported types" << endl;
|
|
|
|
|
for (map<perm_string,const VType*>::const_iterator cur = use_types_.begin()
|
|
|
|
|
; cur != use_types_.end() ; ++cur) {
|
2011-04-18 02:19:09 +02:00
|
|
|
out << " " << cur->first << ": ";
|
|
|
|
|
cur->second->show(out);
|
|
|
|
|
out << endl;
|
|
|
|
|
}
|
2013-05-13 04:17:12 +02:00
|
|
|
out << " -- Types from this scope" << endl;
|
|
|
|
|
for (map<perm_string,const VType*>::const_iterator cur = cur_types_.begin()
|
|
|
|
|
; cur != cur_types_.end() ; ++cur) {
|
Use separate containers for current and previous scopes
This patch introduces in ScopeBase separate containers
for declarations coming from the current scope and from
the previous scopes.
Until now, in one scope, all objects were kept in an stl map.
When a scope was created inside other scopes, a shallow
copy of the map was made. This solution was nice for
name shadowing (in new scopes, when a name was
encountered, the old objects were overridden by a new
one), but didn't allow for distinguishing where the objects
were allocated. As a result, it is impossible to know who
the owner is and who should delete them.
In this commit ScopeBase gets two containers: for old
and new objects. If a ScopeBase is made from another
ScopeBase object, all objects from the copied object
go to an old_XXX container, where XXX depends on the
type of the copied objects. When a ScopeBase object
is deleted, the objects from new_XXX are deleted and
the ones from old_XXX are not touched.
This patch adds some complexity to the internals
of ScopeBase, but leaves its interface unchanged.
2011-07-20 16:34:36 +02:00
|
|
|
out << " " << cur->first << ": ";
|
|
|
|
|
cur->second->show(out);
|
|
|
|
|
out << endl;
|
|
|
|
|
}
|
2011-04-18 02:19:09 +02:00
|
|
|
|
|
|
|
|
// Dump constants
|
2013-05-13 04:17:12 +02:00
|
|
|
out << " -- imported constants" << endl;
|
|
|
|
|
for (map<perm_string,const_t*>::const_iterator cur = use_constants_.begin()
|
|
|
|
|
; cur != use_constants_.end() ; ++cur) {
|
2011-04-18 02:19:09 +02:00
|
|
|
out << " constant " << cur->first << " = ";
|
|
|
|
|
out << endl;
|
|
|
|
|
}
|
2013-05-13 04:17:12 +02:00
|
|
|
out << " -- Constants from this scope" << endl;
|
|
|
|
|
for (map<perm_string,const_t*>::const_iterator cur = cur_constants_.begin()
|
|
|
|
|
; cur != cur_constants_.end() ; ++cur) {
|
Use separate containers for current and previous scopes
This patch introduces in ScopeBase separate containers
for declarations coming from the current scope and from
the previous scopes.
Until now, in one scope, all objects were kept in an stl map.
When a scope was created inside other scopes, a shallow
copy of the map was made. This solution was nice for
name shadowing (in new scopes, when a name was
encountered, the old objects were overridden by a new
one), but didn't allow for distinguishing where the objects
were allocated. As a result, it is impossible to know who
the owner is and who should delete them.
In this commit ScopeBase gets two containers: for old
and new objects. If a ScopeBase is made from another
ScopeBase object, all objects from the copied object
go to an old_XXX container, where XXX depends on the
type of the copied objects. When a ScopeBase object
is deleted, the objects from new_XXX are deleted and
the ones from old_XXX are not touched.
This patch adds some complexity to the internals
of ScopeBase, but leaves its interface unchanged.
2011-07-20 16:34:36 +02:00
|
|
|
out << " constant " << cur->first << " = ";
|
|
|
|
|
out << endl;
|
|
|
|
|
}
|
2011-04-18 02:19:09 +02:00
|
|
|
// Dump signal declarations
|
2013-05-13 04:17:12 +02:00
|
|
|
out << " -- Signals" << endl;
|
Use separate containers for current and previous scopes
This patch introduces in ScopeBase separate containers
for declarations coming from the current scope and from
the previous scopes.
Until now, in one scope, all objects were kept in an stl map.
When a scope was created inside other scopes, a shallow
copy of the map was made. This solution was nice for
name shadowing (in new scopes, when a name was
encountered, the old objects were overridden by a new
one), but didn't allow for distinguishing where the objects
were allocated. As a result, it is impossible to know who
the owner is and who should delete them.
In this commit ScopeBase gets two containers: for old
and new objects. If a ScopeBase is made from another
ScopeBase object, all objects from the copied object
go to an old_XXX container, where XXX depends on the
type of the copied objects. When a ScopeBase object
is deleted, the objects from new_XXX are deleted and
the ones from old_XXX are not touched.
This patch adds some complexity to the internals
of ScopeBase, but leaves its interface unchanged.
2011-07-20 16:34:36 +02:00
|
|
|
for (map<perm_string,Signal*>::const_iterator cur = old_signals_.begin()
|
|
|
|
|
; cur != old_signals_.end() ; ++cur) {
|
|
|
|
|
if (cur->second)
|
|
|
|
|
cur->second->dump(out, 3);
|
|
|
|
|
else
|
|
|
|
|
out << " signal " << cur->first.str() << ": ???" << endl;
|
|
|
|
|
}
|
|
|
|
|
for (map<perm_string,Signal*>::const_iterator cur = new_signals_.begin()
|
|
|
|
|
; cur != new_signals_.end() ; ++cur) {
|
|
|
|
|
if (cur->second)
|
|
|
|
|
cur->second->dump(out, 3);
|
|
|
|
|
else
|
|
|
|
|
out << " signal " << cur->first.str() << ": ???" << endl;
|
2013-05-06 04:05:46 +02:00
|
|
|
}
|
|
|
|
|
// Dump subprograms
|
2013-05-19 02:36:29 +02:00
|
|
|
out << " -- Imported Subprograms" << endl;
|
|
|
|
|
for (map<perm_string,Subprogram*>::const_iterator cur = use_subprograms_.begin()
|
|
|
|
|
; cur != use_subprograms_.end() ; ++cur) {
|
2013-05-06 04:05:46 +02:00
|
|
|
out << " subprogram " << cur->first << " is" << endl;
|
|
|
|
|
cur->second->dump(out);
|
|
|
|
|
out << " end subprogram " << cur->first << endl;
|
|
|
|
|
}
|
2013-05-19 02:36:29 +02:00
|
|
|
out << " -- Subprograms from this scope" << endl;
|
|
|
|
|
for (map<perm_string,Subprogram*>::const_iterator cur = cur_subprograms_.begin()
|
|
|
|
|
; cur != cur_subprograms_.end() ; ++cur) {
|
2013-05-06 04:05:46 +02:00
|
|
|
out << " subprogram " << cur->first << " is" << endl;
|
|
|
|
|
cur->second->dump(out);
|
|
|
|
|
out << " end subprogram " << cur->first << endl;
|
2011-04-18 02:19:09 +02:00
|
|
|
}
|
2011-04-14 03:30:00 +02:00
|
|
|
// Dump component declarations
|
2013-05-13 04:17:12 +02:00
|
|
|
out << " -- Components" << endl;
|
Use separate containers for current and previous scopes
This patch introduces in ScopeBase separate containers
for declarations coming from the current scope and from
the previous scopes.
Until now, in one scope, all objects were kept in an stl map.
When a scope was created inside other scopes, a shallow
copy of the map was made. This solution was nice for
name shadowing (in new scopes, when a name was
encountered, the old objects were overridden by a new
one), but didn't allow for distinguishing where the objects
were allocated. As a result, it is impossible to know who
the owner is and who should delete them.
In this commit ScopeBase gets two containers: for old
and new objects. If a ScopeBase is made from another
ScopeBase object, all objects from the copied object
go to an old_XXX container, where XXX depends on the
type of the copied objects. When a ScopeBase object
is deleted, the objects from new_XXX are deleted and
the ones from old_XXX are not touched.
This patch adds some complexity to the internals
of ScopeBase, but leaves its interface unchanged.
2011-07-20 16:34:36 +02:00
|
|
|
for (map<perm_string,ComponentBase*>::const_iterator cur = old_components_.begin()
|
|
|
|
|
; cur != old_components_.end() ; ++cur) {
|
2011-04-14 03:30:00 +02:00
|
|
|
out << " component " << cur->first << " is" << endl;
|
2011-10-16 02:41:48 +02:00
|
|
|
cur->second->dump_generics(out);
|
2011-04-14 03:30:00 +02:00
|
|
|
cur->second->dump_ports(out);
|
|
|
|
|
out << " end component " << cur->first << endl;
|
|
|
|
|
}
|
Use separate containers for current and previous scopes
This patch introduces in ScopeBase separate containers
for declarations coming from the current scope and from
the previous scopes.
Until now, in one scope, all objects were kept in an stl map.
When a scope was created inside other scopes, a shallow
copy of the map was made. This solution was nice for
name shadowing (in new scopes, when a name was
encountered, the old objects were overridden by a new
one), but didn't allow for distinguishing where the objects
were allocated. As a result, it is impossible to know who
the owner is and who should delete them.
In this commit ScopeBase gets two containers: for old
and new objects. If a ScopeBase is made from another
ScopeBase object, all objects from the copied object
go to an old_XXX container, where XXX depends on the
type of the copied objects. When a ScopeBase object
is deleted, the objects from new_XXX are deleted and
the ones from old_XXX are not touched.
This patch adds some complexity to the internals
of ScopeBase, but leaves its interface unchanged.
2011-07-20 16:34:36 +02:00
|
|
|
for (map<perm_string,ComponentBase*>::const_iterator cur = new_components_.begin()
|
2013-05-06 04:05:46 +02:00
|
|
|
; cur != new_components_.end() ; ++cur) {
|
|
|
|
|
out << " component " << cur->first << " is" << endl;
|
|
|
|
|
cur->second->dump_generics(out);
|
|
|
|
|
cur->second->dump_ports(out);
|
|
|
|
|
out << " end component " << cur->first << endl;
|
Use separate containers for current and previous scopes
This patch introduces in ScopeBase separate containers
for declarations coming from the current scope and from
the previous scopes.
Until now, in one scope, all objects were kept in an stl map.
When a scope was created inside other scopes, a shallow
copy of the map was made. This solution was nice for
name shadowing (in new scopes, when a name was
encountered, the old objects were overridden by a new
one), but didn't allow for distinguishing where the objects
were allocated. As a result, it is impossible to know who
the owner is and who should delete them.
In this commit ScopeBase gets two containers: for old
and new objects. If a ScopeBase is made from another
ScopeBase object, all objects from the copied object
go to an old_XXX container, where XXX depends on the
type of the copied objects. When a ScopeBase object
is deleted, the objects from new_XXX are deleted and
the ones from old_XXX are not touched.
This patch adds some complexity to the internals
of ScopeBase, but leaves its interface unchanged.
2011-07-20 16:34:36 +02:00
|
|
|
}
|
2011-04-14 03:30:00 +02:00
|
|
|
}
|
|
|
|
|
|
2011-04-06 17:27:58 +02:00
|
|
|
void Entity::dump(ostream&out, int indent) const
|
2011-03-22 17:16:20 +01:00
|
|
|
{
|
2011-04-06 17:27:58 +02:00
|
|
|
out << setw(indent) << "" << "entity " << get_name()
|
2011-03-22 17:16:20 +01:00
|
|
|
<< " file=" << get_fileline() << endl;
|
2011-04-06 17:27:58 +02:00
|
|
|
dump_ports(out, indent+2);
|
2011-01-24 05:26:27 +01:00
|
|
|
|
|
|
|
|
for (map<perm_string,Architecture*>::const_iterator cur = arch_.begin()
|
|
|
|
|
; cur != arch_.end() ; ++cur) {
|
2011-04-06 17:27:58 +02:00
|
|
|
cur->second->dump(out, get_name(), indent);
|
2011-01-24 05:26:27 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2011-08-18 05:19:15 +02:00
|
|
|
void SigVarBase::dump(ostream&out, int indent) const
|
2011-03-22 17:16:20 +01:00
|
|
|
{
|
2011-08-18 05:19:15 +02:00
|
|
|
out << setw(indent) << "" << "signal/variable " << name_ << " is ";
|
2011-04-18 02:19:09 +02:00
|
|
|
if (type_)
|
|
|
|
|
out << *type_;
|
|
|
|
|
else
|
|
|
|
|
out << "?NO TYPE?";
|
|
|
|
|
out << endl;
|
2011-03-22 17:16:20 +01:00
|
|
|
}
|
|
|
|
|
|
2011-01-30 02:27:30 +01:00
|
|
|
void Expression::dump(ostream&out, int indent) const
|
|
|
|
|
{
|
|
|
|
|
out << setw(indent) << "" << "Expression [" << typeid(*this).name() << "]"
|
|
|
|
|
<< " at " << get_fileline()<< endl;
|
|
|
|
|
}
|
|
|
|
|
|
2011-09-04 02:11:55 +02:00
|
|
|
void ExpAggregate::dump(ostream&out, int indent) const
|
|
|
|
|
{
|
|
|
|
|
out << setw(indent) << "" << "Aggregate expression at " << get_fileline() << endl;
|
|
|
|
|
|
|
|
|
|
for (size_t idx = 0 ; idx < elements_.size() ; idx += 1)
|
|
|
|
|
elements_[idx]->dump(out, indent+2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ExpAggregate::element_t::dump(ostream&out, int indent) const
|
|
|
|
|
{
|
|
|
|
|
out << setw(indent) << "" << "choices:" << endl;
|
|
|
|
|
for (size_t idx = 0 ; idx < fields_.size() ; idx += 1)
|
|
|
|
|
fields_[idx]->dump(out, indent+4);
|
|
|
|
|
|
|
|
|
|
out << setw(indent) << "" << "expression:" << endl;
|
|
|
|
|
val_->dump(out, indent+4);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ExpAggregate::choice_t::dump(ostream&out, int indent) const
|
|
|
|
|
{
|
|
|
|
|
if (others()) {
|
|
|
|
|
out << setw(indent) << "" << "=> others" << endl;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2012-04-01 01:29:40 +02:00
|
|
|
if (expr_.get()) {
|
2011-09-04 02:11:55 +02:00
|
|
|
expr_->dump(out, indent);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2012-04-01 01:29:40 +02:00
|
|
|
if (range_.get()) {
|
|
|
|
|
range_->dump(out, indent);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2011-09-04 02:11:55 +02:00
|
|
|
out << setw(indent) << "" << "?choice_t?" << endl;
|
|
|
|
|
}
|
|
|
|
|
|
2011-05-09 01:40:35 +02:00
|
|
|
void ExpAttribute::dump(ostream&out, int indent) const
|
|
|
|
|
{
|
|
|
|
|
out << setw(indent) << "" << "Attribute " << name_
|
|
|
|
|
<< " at " << get_fileline() << endl;
|
|
|
|
|
base_->dump(out, indent+4);
|
|
|
|
|
}
|
|
|
|
|
|
2011-02-21 02:03:46 +01:00
|
|
|
void ExpBinary::dump_operands(ostream&out, int indent) const
|
|
|
|
|
{
|
|
|
|
|
operand1_->dump(out, indent);
|
|
|
|
|
operand2_->dump(out, indent);
|
2011-02-20 02:47:30 +01:00
|
|
|
}
|
|
|
|
|
|
2011-06-05 22:58:54 +02:00
|
|
|
void ExpBitstring::dump(ostream&out, int indent) const
|
|
|
|
|
{
|
|
|
|
|
out << setw(indent) << "" << "Bit string " << value_.size()
|
|
|
|
|
<< "b\"";
|
|
|
|
|
for (size_t idx = value_.size() ; idx > 0 ; idx -= 1) {
|
|
|
|
|
out << value_[idx-1];
|
|
|
|
|
}
|
2011-06-12 19:51:31 +02:00
|
|
|
out << "\"" << endl;
|
2011-06-05 22:58:54 +02:00
|
|
|
}
|
|
|
|
|
|
2011-05-09 01:40:35 +02:00
|
|
|
void ExpCharacter::dump(ostream&out, int indent) const
|
|
|
|
|
{
|
|
|
|
|
out << setw(indent) << "" << "Character '" << value_ << "'"
|
|
|
|
|
<< " at " << get_fileline() << endl;
|
|
|
|
|
}
|
|
|
|
|
|
2011-06-12 19:51:31 +02:00
|
|
|
void ExpConditional::dump(ostream&out, int indent) const
|
|
|
|
|
{
|
|
|
|
|
out << setw(indent) << "" << "Conditional expression at "<< get_fileline() << endl;
|
|
|
|
|
out << setw(indent) << "" << " when:" << endl;
|
|
|
|
|
cond_->dump(out, indent+4);
|
|
|
|
|
|
|
|
|
|
out << setw(indent) << "" << " do:" << endl;
|
|
|
|
|
for (list<Expression*>::const_iterator cur = true_clause_.begin()
|
|
|
|
|
; cur != true_clause_.end() ; ++cur) {
|
|
|
|
|
(*cur)->dump(out, indent+4);
|
|
|
|
|
}
|
|
|
|
|
|
2012-03-24 18:23:50 +01:00
|
|
|
for (list<else_t*>::const_iterator cur = else_clause_.begin()
|
2011-06-12 19:51:31 +02:00
|
|
|
; cur != else_clause_.end() ; ++cur) {
|
2012-03-24 18:23:50 +01:00
|
|
|
(*cur)->dump(out, indent);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ExpConditional::else_t::dump(ostream&out, int indent) const
|
|
|
|
|
{
|
|
|
|
|
out << setw(indent) << "" << "when:" << endl;
|
|
|
|
|
if (cond_) cond_->dump(out, indent+4);
|
|
|
|
|
out << setw(indent) << "" << "do:" << endl;
|
|
|
|
|
for (list<Expression*>::const_iterator cur = true_clause_.begin()
|
|
|
|
|
; cur != true_clause_.end() ; ++cur) {
|
2011-06-12 19:51:31 +02:00
|
|
|
(*cur)->dump(out, indent+4);
|
|
|
|
|
}
|
2012-03-24 18:23:50 +01:00
|
|
|
|
2011-06-12 19:51:31 +02:00
|
|
|
}
|
|
|
|
|
|
2011-05-28 19:49:33 +02:00
|
|
|
void ExpEdge::dump(ostream&out, int indent) const
|
|
|
|
|
{
|
|
|
|
|
out << setw(indent) << "";
|
|
|
|
|
switch (fun_) {
|
|
|
|
|
case NEGEDGE:
|
|
|
|
|
out << "negedge ";
|
|
|
|
|
break;
|
|
|
|
|
case ANYEDGE:
|
|
|
|
|
out << "ANYedge ";
|
|
|
|
|
break;
|
|
|
|
|
case POSEDGE:
|
|
|
|
|
out << "posedge ";
|
|
|
|
|
}
|
|
|
|
|
out << "at " << get_fileline() << endl;
|
|
|
|
|
dump_operand1(out, indent+3);
|
|
|
|
|
}
|
|
|
|
|
|
2011-08-29 00:30:45 +02:00
|
|
|
void ExpFunc::dump(ostream&out, int indent) const
|
|
|
|
|
{
|
|
|
|
|
out << setw(indent) << "" << "function " << name_
|
|
|
|
|
<< " has " << argv_.size() << " arguments:" << endl;
|
|
|
|
|
for (size_t idx = 0 ; idx < argv_.size() ; idx += 1) {
|
|
|
|
|
argv_[idx]->dump(out, indent+2);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2011-02-14 04:01:21 +01:00
|
|
|
void ExpInteger::dump(ostream&out, int indent) const
|
|
|
|
|
{
|
2011-02-21 02:03:46 +01:00
|
|
|
out << setw(indent) << "" << "Integer " << value_
|
|
|
|
|
<< " at " << get_fileline() << endl;
|
2011-02-14 04:01:21 +01:00
|
|
|
}
|
|
|
|
|
|
2011-01-30 02:27:30 +01:00
|
|
|
void ExpLogical::dump(ostream&out, int indent) const
|
|
|
|
|
{
|
|
|
|
|
const char*fun_name = "?";
|
|
|
|
|
switch (fun_) {
|
|
|
|
|
case AND:
|
|
|
|
|
fun_name = "AND";
|
|
|
|
|
break;
|
|
|
|
|
case OR:
|
|
|
|
|
fun_name = "OR";
|
|
|
|
|
break;
|
|
|
|
|
case NAND:
|
|
|
|
|
fun_name = "NAND";
|
|
|
|
|
break;
|
|
|
|
|
case NOR:
|
|
|
|
|
fun_name = "NOR";
|
|
|
|
|
break;
|
|
|
|
|
case XOR:
|
|
|
|
|
fun_name = "XOR";
|
|
|
|
|
break;
|
|
|
|
|
case XNOR:
|
|
|
|
|
fun_name = "XNOR";
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
out << setw(indent) << "" << "Logical " << fun_name
|
|
|
|
|
<< " at " << get_fileline() << endl;
|
2011-02-21 02:03:46 +01:00
|
|
|
dump_operands(out, indent+4);
|
2011-01-30 02:27:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ExpName::dump(ostream&out, int indent) const
|
|
|
|
|
{
|
|
|
|
|
out << setw(indent) << "" << "ExpName(\"" << name_ << "\")"
|
|
|
|
|
<< " at " << get_fileline() << endl;
|
2012-04-01 01:29:40 +02:00
|
|
|
if (prefix_.get())
|
|
|
|
|
prefix_->dump(out, indent+8);
|
2011-03-27 21:01:58 +02:00
|
|
|
if (index_)
|
|
|
|
|
index_->dump(out, indent+6);
|
2011-08-22 01:52:18 +02:00
|
|
|
if (lsb_)
|
|
|
|
|
lsb_->dump(out, indent+6);
|
2011-01-24 05:26:27 +01:00
|
|
|
}
|
2011-02-21 02:03:46 +01:00
|
|
|
|
2011-05-15 20:07:42 +02:00
|
|
|
void ExpNameALL::dump(ostream&out, int indent) const
|
|
|
|
|
{
|
|
|
|
|
out << setw(indent) << "" << "ExpNameALL at " << get_fileline() << endl;
|
|
|
|
|
}
|
|
|
|
|
|
2011-05-09 01:40:35 +02:00
|
|
|
void ExpRelation::dump(ostream&out, int indent) const
|
|
|
|
|
{
|
|
|
|
|
out << setw(indent) << "" << "Relation ";
|
|
|
|
|
switch (fun_) {
|
|
|
|
|
case EQ:
|
|
|
|
|
out << "=";
|
|
|
|
|
break;
|
|
|
|
|
case LT:
|
|
|
|
|
out << "<";
|
|
|
|
|
break;
|
|
|
|
|
case GT:
|
|
|
|
|
out << ">";
|
|
|
|
|
break;
|
|
|
|
|
case NEQ:
|
|
|
|
|
out << "/=";
|
|
|
|
|
break;
|
|
|
|
|
case LE:
|
|
|
|
|
out << "<=";
|
|
|
|
|
break;
|
|
|
|
|
case GE:
|
|
|
|
|
out << ">=";
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
out << endl;
|
|
|
|
|
dump_operands(out, indent+4);
|
|
|
|
|
}
|
|
|
|
|
|
2011-07-05 12:03:30 +02:00
|
|
|
void ExpString::dump(ostream&out, int indent) const
|
|
|
|
|
{
|
|
|
|
|
out << setw(indent) << "" << "String \"";
|
|
|
|
|
for(vector<char>::const_iterator it = value_.begin();
|
|
|
|
|
it != value_.end(); ++it)
|
|
|
|
|
out << *it;
|
|
|
|
|
out << "\""
|
|
|
|
|
<< " at " << get_fileline() << endl;
|
|
|
|
|
}
|
|
|
|
|
|
2011-02-21 02:03:46 +01:00
|
|
|
void ExpUAbs::dump(ostream&out, int indent) const
|
|
|
|
|
{
|
|
|
|
|
out << setw(indent) << "" << "abs() at " << get_fileline() << endl;
|
|
|
|
|
dump_operand1(out, indent+4);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ExpUnary::dump_operand1(ostream&out, int indent) const
|
|
|
|
|
{
|
|
|
|
|
operand1_->dump(out, indent);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ExpUNot::dump(ostream&out, int indent) const
|
|
|
|
|
{
|
|
|
|
|
out << setw(indent) << "" << "not() at " << get_fileline() << endl;
|
|
|
|
|
dump_operand1(out, indent+4);
|
|
|
|
|
}
|
2011-07-05 15:46:21 +02:00
|
|
|
|
|
|
|
|
void named_expr_t::dump(ostream&out, int indent) const
|
|
|
|
|
{
|
|
|
|
|
out << setw(indent) << "" << name_ << "=>";
|
|
|
|
|
expr_->dump(out, indent);
|
|
|
|
|
}
|
2011-07-05 18:31:54 +02:00
|
|
|
|
2011-11-05 23:55:17 +01:00
|
|
|
void prange_t::dump(ostream&out, int indent) const
|
2011-07-05 18:31:54 +02:00
|
|
|
{
|
|
|
|
|
left_->dump(out, indent);
|
|
|
|
|
out << setw(indent) << "" << (direction_ ? "downto" : "to");
|
|
|
|
|
right_->dump(out, indent);
|
|
|
|
|
}
|
2012-09-01 23:51:04 +02:00
|
|
|
|
|
|
|
|
ostream& Expression::dump_inline(ostream&out) const
|
|
|
|
|
{
|
|
|
|
|
out << typeid(*this).name();
|
|
|
|
|
return out;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ostream& ExpInteger::dump_inline(ostream&out) const
|
|
|
|
|
{
|
|
|
|
|
out << value_;
|
|
|
|
|
return out;
|
|
|
|
|
}
|
2013-05-06 04:05:46 +02:00
|
|
|
|
|
|
|
|
void Subprogram::dump(ostream&fd) const
|
|
|
|
|
{
|
|
|
|
|
fd << " " << name_;
|
|
|
|
|
|
|
|
|
|
if (ports_->empty()) {
|
|
|
|
|
fd << "()";
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
fd << "(";
|
|
|
|
|
|
|
|
|
|
list<InterfacePort*>::const_iterator cur = ports_->begin();
|
|
|
|
|
InterfacePort*curp = *cur;
|
|
|
|
|
fd << curp->name << ":";
|
|
|
|
|
curp->type->show(fd);
|
|
|
|
|
|
|
|
|
|
for (++ cur ; cur != ports_->end() ; ++ cur) {
|
|
|
|
|
curp = *cur;
|
|
|
|
|
fd << "; " << curp->name << ":";
|
|
|
|
|
curp->type->show(fd);
|
|
|
|
|
}
|
|
|
|
|
fd << ")";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fd << " return ";
|
|
|
|
|
return_type_->show(fd);
|
|
|
|
|
fd << endl;
|
|
|
|
|
|
|
|
|
|
if (statements_== 0 || statements_->empty()) {
|
|
|
|
|
fd << " <no definition>" << endl;
|
|
|
|
|
} else {
|
|
|
|
|
for (list<SequentialStmt*>::const_iterator cur = statements_->begin()
|
|
|
|
|
; cur != statements_->end() ; ++cur) {
|
|
|
|
|
SequentialStmt*curp = *cur;
|
|
|
|
|
curp->dump(fd, 8);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|