2008-06-10 01:25:10 +00:00
|
|
|
|
// -*- C++ -*-
|
2006-08-26 11:35:28 +00:00
|
|
|
|
//*************************************************************************
|
|
|
|
|
// DESCRIPTION: Verilator: Graph algorithm base class
|
|
|
|
|
//
|
2008-04-25 12:14:27 +00:00
|
|
|
|
// Code available from: http://www.veripool.org/verilator
|
2006-08-26 11:35:28 +00:00
|
|
|
|
//
|
|
|
|
|
// AUTHORS: Wilson Snyder with Paul Wasson, Duane Gabli
|
|
|
|
|
//
|
|
|
|
|
//*************************************************************************
|
|
|
|
|
//
|
2010-01-06 02:15:06 +00:00
|
|
|
|
// Copyright 2003-2010 by Wilson Snyder. This program is free software; you can
|
2006-08-26 11:35:28 +00:00
|
|
|
|
// redistribute it and/or modify it under the terms of either the GNU
|
2009-05-04 21:07:57 +00:00
|
|
|
|
// Lesser General Public License Version 3 or the Perl Artistic License
|
|
|
|
|
// Version 2.0.
|
2006-08-26 11:35:28 +00:00
|
|
|
|
//
|
|
|
|
|
// Verilator 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.
|
|
|
|
|
//
|
|
|
|
|
//*************************************************************************
|
|
|
|
|
|
|
|
|
|
#ifndef _V3GRAPHALG_H_
|
|
|
|
|
#define _V3GRAPHALG_H_ 1
|
2006-12-18 19:20:45 +00:00
|
|
|
|
#include "config_build.h"
|
|
|
|
|
#include "verilatedos.h"
|
2006-08-26 11:35:28 +00:00
|
|
|
|
|
|
|
|
|
#include "V3Global.h"
|
|
|
|
|
#include "V3Graph.h"
|
|
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
|
// Algorithms - common class
|
|
|
|
|
// For internal use, most graph algorithms use this as a base class
|
|
|
|
|
|
|
|
|
|
class GraphAlg {
|
|
|
|
|
protected:
|
|
|
|
|
V3Graph* m_graphp; // Graph we're operating upon
|
|
|
|
|
V3EdgeFuncP m_edgeFuncp; // Function that says we follow this edge
|
|
|
|
|
|
|
|
|
|
inline bool followEdge(V3GraphEdge* edgep) {
|
|
|
|
|
return (edgep->weight() && (m_edgeFuncp)(edgep));
|
|
|
|
|
}
|
|
|
|
|
GraphAlg(V3Graph* graphp, V3EdgeFuncP edgeFuncp)
|
|
|
|
|
: m_graphp(graphp), m_edgeFuncp(edgeFuncp) {}
|
|
|
|
|
~GraphAlg() {}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
|
|
|
|
|
|
#endif // Guard
|