Collect analog branches into islands.

Discipline islands all along were intended to carry collections of
analog branches, as well as the current switch modeling support.
This commit is contained in:
Stephen Williams 2008-11-09 15:32:50 -08:00
parent 988fc70368
commit 0da27a2f45
7 changed files with 31 additions and 24 deletions

View File

@ -678,7 +678,7 @@ void NetTaskDef::dump(ostream&o, unsigned ind) const
void NetTran::dump_node(ostream&o, unsigned ind) const
{
o << setw(ind) << "" << type_ << " " << name()
<< " island " << island;
<< " island " << get_island();
if (type_ == IVL_SW_TRAN_VP) {
o << " width=" << vector_width()
<< " part=" << part_width()

View File

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

View File

@ -1,5 +1,5 @@
#ifndef __ivl_target_priv_H
#define __ivl_target_H
#define __ivl_target_priv_H
/*
* Copyright (c) 2008 Stephen Williams (steve@icarus.com)
*
@ -33,10 +33,10 @@
* have disciplines and do not belong to islands.
*/
class discipline_t;
class ivl_discipline_s;
struct ivl_island_s {
discipline_t*discipline;
ivl_discipline_s*discipline;
// user accessible flags. They are initially false, always.
vector<bool> flags;
};

View File

@ -78,7 +78,7 @@ unsigned NetTran::part_offset() const
return off_;
}
void join_island(NetObj*obj)
void join_island(NetPins*obj)
{
IslandBranch*branch = dynamic_cast<IslandBranch*> (obj);
@ -88,7 +88,7 @@ void join_island(NetObj*obj)
// If this is a branch, but already given to an island, then
// stop.
if (branch->island)
if (branch->island_)
return;
list<NetObj*> uncommitted_neighbors;
@ -110,31 +110,32 @@ void join_island(NetObj*obj)
if (tmp == obj)
continue;
// If tmb is not a branch, then skip it.
// If tmp is not a branch, then skip it.
IslandBranch*tmp_branch = dynamic_cast<IslandBranch*> (tmp);
if (tmp_branch == 0)
continue;
// If that is an uncommitted branch, then save
// If tmp is an uncommitted branch, then save
// it. When I finally choose an island for self,
// these branches will be scanned so that they join
// this island as well.
if (tmp_branch->island == 0) {
if (tmp_branch->island_ == 0) {
uncommitted_neighbors.push_back(tmp);
continue;
}
ivl_assert(*obj, branch->island==0 || branch->island==tmp_branch->island);
ivl_assert(*obj, branch->island_==0 || branch->island_==tmp_branch->island_);
// We found an existing island to join. Join it
// now. Keep scanning in order to find more neighbors.
if (branch->island == 0) {
if (branch->island_ == 0) {
if (debug_elaborate)
cerr << obj->get_fileline() << ": debug: "
<< "Join branch to existing island." << endl;
branch->island = tmp_branch->island;
branch->island_ = tmp_branch->island_;
ivl_assert(*obj, branch->island_->discipline == tmp_branch->island_->discipline);
} else if (branch->island != tmp_branch->island) {
} else if (branch->island_ != tmp_branch->island_) {
cerr << obj->get_fileline() << ": internal error: "
<< "Oops, Found 2 neighboring islands." << endl;
ivl_assert(*obj, 0);
@ -144,9 +145,9 @@ void join_island(NetObj*obj)
// If after all that we did not find an island to join, then
// start the island not and join it.
if (branch->island == 0) {
branch->island = new ivl_island_s;
branch->island->discipline = 0;
if (branch->island_ == 0) {
branch->island_ = new ivl_island_s;
branch->island_->discipline = branch->discipline_;
if (debug_elaborate)
cerr << obj->get_fileline() << ": debug: "
<< "Create new island for this branch" << endl;

View File

@ -243,7 +243,7 @@ NetNode::~NetNode()
}
NetBranch::NetBranch(ivl_discipline_t dis)
: NetPins(2), discipline_(dis)
: NetPins(2), IslandBranch(dis)
{
pin(0).set_dir(Link::PASSIVE);
pin(1).set_dir(Link::PASSIVE);

View File

@ -55,6 +55,7 @@ class NetEvent;
class NetNet;
class NetNode;
class NetObj;
class NetPins;
class NetProc;
class NetProcTop;
class NetRelease;
@ -74,7 +75,7 @@ struct functor_t;
ostream& operator << (ostream&o, ivl_variable_type_t val);
extern void join_island(NetObj*obj);
extern void join_island(NetPins*obj);
class NetPins : public LineInfo {
@ -154,10 +155,15 @@ class NetObj : public NetPins, public Attrib {
class IslandBranch {
public:
IslandBranch() : island(0) { }
IslandBranch(ivl_discipline_t dis =0) : island_(0), discipline_(dis) { }
public:
struct ivl_island_s* island;
ivl_island_t get_island() const { return island_; }
friend void join_island(NetPins*);
private:
ivl_island_t island_;
ivl_discipline_t discipline_;
};
/*
@ -168,7 +174,7 @@ class IslandBranch {
* potential. Pin(1) is the sink of flow and the minus (or ground) of
* potential.
*/
class NetBranch : public NetPins {
class NetBranch : public NetPins, public IslandBranch {
public:
explicit NetBranch(ivl_discipline_t dis);
@ -176,7 +182,6 @@ class NetBranch : public NetPins {
~NetBranch();
private:
ivl_discipline_t discipline_;
perm_string name_;
};

View File

@ -1051,7 +1051,7 @@ bool dll_target::tran(const NetTran*net)
obj->offset = 0;
obj->name = net->name();
obj->scope = find_scope(des_, net->scope());
obj->island = net->island;
obj->island = net->get_island();
assert(obj->scope);
assert(obj->island);