2012-04-13 03:08:20 +02:00
|
|
|
// -*- mode: C++; c-file-style: "cc-mode" -*-
|
2006-08-26 13:35:28 +02:00
|
|
|
//*************************************************************************
|
|
|
|
|
// DESCRIPTION: Verilator: Graph algorithm base class
|
|
|
|
|
//
|
2019-11-08 04:33:59 +01:00
|
|
|
// Code available from: https://verilator.org
|
2006-08-26 13:35:28 +02:00
|
|
|
//
|
|
|
|
|
//*************************************************************************
|
|
|
|
|
//
|
2023-01-01 16:18:39 +01:00
|
|
|
// Copyright 2003-2023 by Wilson Snyder. This program is free software; you
|
2020-03-21 16:24:24 +01:00
|
|
|
// can redistribute it and/or modify it under the terms of either the GNU
|
2009-05-04 23:07:57 +02:00
|
|
|
// Lesser General Public License Version 3 or the Perl Artistic License
|
|
|
|
|
// Version 2.0.
|
2020-03-21 16:24:24 +01:00
|
|
|
// SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
|
2006-08-26 13:35:28 +02:00
|
|
|
//
|
|
|
|
|
//*************************************************************************
|
2019-10-05 02:17:11 +02:00
|
|
|
|
2021-03-04 03:57:07 +01:00
|
|
|
#ifndef VERILATOR_V3GRAPHALG_H_
|
|
|
|
|
#define VERILATOR_V3GRAPHALG_H_
|
2018-10-14 19:43:24 +02:00
|
|
|
|
2006-12-18 20:20:45 +01:00
|
|
|
#include "config_build.h"
|
|
|
|
|
#include "verilatedos.h"
|
2006-08-26 13:35:28 +02:00
|
|
|
|
|
|
|
|
#include "V3Global.h"
|
|
|
|
|
#include "V3Graph.h"
|
|
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
|
// Algorithms - common class
|
|
|
|
|
// For internal use, most graph algorithms use this as a base class
|
|
|
|
|
|
2018-07-10 03:32:10 +02:00
|
|
|
template <class T_Graph = V3Graph> // Or sometimes const V3Graph
|
2020-11-19 03:32:16 +01:00
|
|
|
class GraphAlg VL_NOT_FINAL {
|
2006-08-26 13:35:28 +02:00
|
|
|
protected:
|
2021-11-26 23:55:36 +01:00
|
|
|
T_Graph* const m_graphp; // Graph we're operating upon
|
|
|
|
|
const V3EdgeFuncP m_edgeFuncp; // Function that says we follow this edge
|
2018-07-10 01:15:46 +02:00
|
|
|
// CONSTRUCTORS
|
2018-07-10 03:32:10 +02:00
|
|
|
GraphAlg(T_Graph* graphp, V3EdgeFuncP edgeFuncp)
|
2020-08-16 15:55:36 +02:00
|
|
|
: m_graphp{graphp}
|
|
|
|
|
, m_edgeFuncp{edgeFuncp} {}
|
2020-11-17 01:56:16 +01:00
|
|
|
~GraphAlg() = default;
|
2018-07-10 01:15:46 +02:00
|
|
|
// METHODS
|
2022-09-16 14:17:38 +02:00
|
|
|
bool followEdge(V3GraphEdge* edgep) { return (edgep->weight() && (m_edgeFuncp)(edgep)); }
|
2006-08-26 13:35:28 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
|
|
2019-05-19 22:13:13 +02:00
|
|
|
#endif // Guard
|