Bring branches forward as far as the emit method and target_t.

This commit is contained in:
Stephen Williams 2008-11-09 17:11:04 -08:00
parent 0da27a2f45
commit 25201954d3
7 changed files with 51 additions and 0 deletions

View File

@ -136,6 +136,13 @@ ostream& operator <<(ostream&o, struct __ScopePathManip marg)
return o;
}
void NetBranch::dump(ostream&o, unsigned ind) const
{
o << setw(ind) << "" << "branch ...";
o << " island=" << get_island();
o << " // " << get_fileline() << endl;
}
void NetDelaySrc::dump(ostream&o, unsigned ind) const
{
o << setw(ind) << "" << "specify delay";
@ -1511,6 +1518,13 @@ void Design::dump(ostream&o) const
} while (cur != nodes_->node_next_);
}
o << "ELABORATED BRANCHES:" << endl;
if (branches_) {
for (NetBranch*cur = branches_ ; cur ; cur = cur->next_)
cur->dump(o, 0);
}
o << "ELABORATED PROCESSES:" << endl;
// Dump the processes.

View File

@ -1253,6 +1253,7 @@ NetExpr* PECallFunction::elaborate_access_func_(Design*des, NetScope*scope,
branch = new NetBranch(dis);
branch->set_line(*this);
des->add_branch(branch);
connect(branch->pin(0), sig->pin(0));
join_island(branch);

View File

@ -455,6 +455,11 @@ int Design::emit(struct target_t*tgt) const
}
bool branches_rc = true;
for (NetBranch*cur = branches_ ; cur ; cur = cur->next_) {
branches_rc = tgt->branch(cur) && branches_rc;
}
// emit task and function definitions
bool tasks_rc = true;
for (list<NetScope*>::const_iterator scope = root_scopes_.begin();
@ -477,6 +482,8 @@ int Design::emit(struct target_t*tgt) const
return -2;
if (proc_rc == false)
return -3;
if (branches_rc == false)
return -4;
return rc;
}

View File

@ -38,6 +38,7 @@
Design:: Design()
: errors(0), nodes_(0), procs_(0), aprocs_(0), lcounter_(0)
{
branches_ = 0;
procs_idx_ = 0;
des_precision_ = 0;
nodes_functor_cur_ = 0;
@ -758,6 +759,12 @@ void Design::del_node(NetNode*net)
net->design_ = 0;
}
void Design::add_branch(NetBranch*bra)
{
bra->next_ = branches_;
branches_ = bra;
}
void Design::add_process(NetProcTop*pro)
{
pro->next_ = procs_;

View File

@ -181,8 +181,13 @@ class NetBranch : public NetPins, public IslandBranch {
explicit NetBranch(ivl_discipline_t dis, perm_string name);
~NetBranch();
void dump(ostream&, unsigned) const;
private:
perm_string name_;
// The design class uses this member to list the branches.
friend class Design;
NetBranch*next_;
};
class Link {
@ -859,6 +864,7 @@ class NetScope : public Attrib {
NetNet::Type default_nettype_;
NetEvent *events_;
typedef std::map<perm_string,NetNet*>::const_iterator signals_map_iter_t;
std::map <perm_string,NetNet*> signals_map_;
perm_string module_name_;
@ -3871,6 +3877,9 @@ class Design {
void add_node(NetNode*);
void del_node(NetNode*);
// BRANCHES
void add_branch(NetBranch*);
// PROCESSES
void add_process(NetProcTop*);
void add_process(NetAnalogTop*);
@ -3901,6 +3910,9 @@ class Design {
NetNode*nodes_functor_cur_;
NetNode*nodes_functor_nxt_;
// List the branches in the design.
NetBranch*branches_;
// List the processes in the design.
NetProcTop*procs_;
NetProcTop*procs_idx_;

View File

@ -32,6 +32,13 @@ void target_t::scope(const NetScope*)
{
}
bool target_t::branch(const NetBranch*obj)
{
cerr << obj->get_fileline() << ": error: target (" << typeid(*this).name()
<< "): Unhandled branch." << endl;
return false;
}
void target_t::event(const NetEvent*ev)
{
cerr << ev->get_fileline() << ": error: target (" << typeid(*this).name()

View File

@ -63,6 +63,9 @@ struct target_t {
virtual void signal(const NetNet*) =0;
virtual bool signal_paths(const NetNet*);
/* Analog branches */
virtual bool branch(const NetBranch*);
/* Output a defined task. */
virtual void task_def(const NetScope*);
virtual bool func_def(const NetScope*);