Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / sam / cpus / vonk / ss / api / memsync / src / TsoEdge.cc
CommitLineData
920dae64
AT
1// ========== Copyright Header Begin ==========================================
2//
3// OpenSPARC T2 Processor File: TsoEdge.cc
4// Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
5// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
6//
7// The above named program is free software; you can redistribute it and/or
8// modify it under the terms of the GNU General Public
9// License version 2 as published by the Free Software Foundation.
10//
11// The above named program is distributed in the hope that it will be
12// useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14// General Public License for more details.
15//
16// You should have received a copy of the GNU General Public
17// License along with this work; if not, write to the Free Software
18// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
19//
20// ========== Copyright Header End ============================================
21/************************************************************************
22**
23** Copyright (C) 2002, Sun Microsystems, Inc.
24**
25** Sun considers its source code as an unpublished, proprietary
26** trade secret and it is available only under strict license provisions.
27** This copyright notice is placed here only to protect Sun in the event
28** the source is deemed a published work. Disassembly, decompilation,
29** or other means of reducing the object code to human readable form
30** is prohibited by the license agreement under which this code is
31** provided to the user or company in possession of this copy."
32**
33*************************************************************************/
34#include "TsoEdge.h"
35#include <sstream>
36
37using namespace std;
38using namespace Tso;
39////////////////////////////////////////////////
40
41TsoEdge::TsoEdge()
42{
43}
44
45////////////////////////////////////////////////
46
47TsoEdge::TsoEdge( const TsoEdge & orig )
48{
49 type_ = orig.type_;
50 src_ = orig.src_;
51 dst_ = orig.dst_;
52}
53
54////////////////////////////////////////////////
55
56TsoEdge::~TsoEdge()
57{
58}
59
60////////////////////////////////////////////////
61
62const TsoEdge &
63TsoEdge::operator=( const TsoEdge & rhs )
64{
65
66 return *this;
67}
68
69////////////////////////////////////////////////
70
71bool
72TsoEdge::operator==( const TsoEdge & rhs ) const
73{
74 return false;
75}
76
77////////////////////////////////////////////////
78
79string
80TsoEdge::toString() const
81{
82 ostringstream os;
83
84 return os.str();
85}
86
87TsoEdge*
88TsoEdge::addEdge (enum EDGE_TYPE type, TsoNode* src, TsoNode* dst)
89{
90 list<TsoEdge*>::iterator ii;
91 TsoEdge* edge;
92
93 ii = findEdge(src, dst, type);
94 if ((ii != src->outEnd())) {
95 return *ii; // find same type edge between these two nodes
96 }
97
98 edge = new TsoEdge();
99
100 edge->type_= type;
101 edge->src_= src;
102 edge->dst_= dst;
103
104 src->outPushFront(edge); // add this edge pointer to src's out edge group
105 dst->inPushFront(edge); // add this edge pointer to dst's in edge group
106
107 return edge;
108}
109
110list<TsoEdge*>::iterator
111TsoEdge::findEdge (TsoNode* src, TsoNode* dst, enum EDGE_TYPE type)
112{
113 list<TsoEdge*>::iterator ii;
114
115 if (src->outSize() == 0) return src->outEnd();
116
117 for (ii = src->outBegin(); ii != src->outEnd(); ii++) {
118 if (((*ii)->dst_ == dst) && ((*ii)->getType() == type)) {
119 return ii;
120 }
121 }
122
123 return src->outEnd();
124}