OpenASIP  2.0
RFAccessTracker.hh
Go to the documentation of this file.
1 /*
2  Copyright (c) 2002-2009 Tampere University.
3 
4  This file is part of TTA-Based Codesign Environment (TCE).
5 
6  Permission is hereby granted, free of charge, to any person obtaining a
7  copy of this software and associated documentation files (the "Software"),
8  to deal in the Software without restriction, including without limitation
9  the rights to use, copy, modify, merge, publish, distribute, sublicense,
10  and/or sell copies of the Software, and to permit persons to whom the
11  Software is furnished to do so, subject to the following conditions:
12 
13  The above copyright notice and this permission notice shall be included in
14  all copies or substantial portions of the Software.
15 
16  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22  DEALINGS IN THE SOFTWARE.
23  */
24 /**
25  * @file RFAccessTracker.hh
26  *
27  * Declaration of RFAccessTracker class.
28  *
29  * @author Pekka Jääskeläinen 2005 (pjaaskel-no.spam-cs.tut.fi)
30  * @note rating: red
31  */
32 
33 #ifndef TTA_RF_ACCESS_TRACKER_HH
34 #define TTA_RF_ACCESS_TRACKER_HH
35 
36 #include <string>
37 #include <map>
38 
39 #include "boost/tuple/tuple.hpp"
40 
41 #include "Listener.hh"
42 #include "Exception.hh"
43 #include "SimulatorConstants.hh"
44 #include "hash_map.hh"
45 
46 class SimulatorFrontend;
47 class InstructionMemory;
48 
49 /**
50  * Tracks concurrent register file accesses.
51  */
52 class RFAccessTracker : public Listener {
53 public:
54  /// type to be used as a key for storing concurrent access info
55  typedef boost::tuple<
56  std::string, /* register file name */
57  std::size_t, /* concurrent writes */
58  std::size_t> /* concurrent reads */ ConcurrentRFAccess;
59  /// concurrent accesses and their counts
60  typedef std::map<ConcurrentRFAccess, ClockCycleCount>
62 
64  SimulatorFrontend& frontend,
65  const InstructionMemory& instructions);
66  virtual ~RFAccessTracker();
67 
68  virtual void handleEvent(int event);
69 
71  const std::string& rfName,
72  std::size_t concurrentWrites,
73  std::size_t concurrentReads) const;
74 
76 
77 private:
78  /// Index for RF accesses in an instruction.
79  typedef hash_map<
80  const char*, /* funame */
81  boost::tuple<std::size_t /* writes */, std::size_t /* reads */> >
83  /// the simulator frontend used to access simulation data
85  /// used to access instruction execution data
87  /// conditional register file accesses are counted in this container
89  /// total (conditional + unconditional) register file accesses are counted
90  /// in this container
92  /// container used in collecting register accesses in an instruction
94 };
95 
96 #endif
Exception.hh
RFAccessTracker::ConcurrentRFAccessIndex
std::map< ConcurrentRFAccess, ClockCycleCount > ConcurrentRFAccessIndex
concurrent accesses and their counts
Definition: RFAccessTracker.hh:61
RFAccessTracker::ConcurrentRFAccess
boost::tuple< std::string, std::size_t, std::size_t > ConcurrentRFAccess
type to be used as a key for storing concurrent access info
Definition: RFAccessTracker.hh:58
Listener
Definition: Listener.hh:40
RFAccessTracker::accessesInInstruction_
RFAccessIndex accessesInInstruction_
container used in collecting register accesses in an instruction
Definition: RFAccessTracker.hh:93
InstructionMemory
Definition: InstructionMemory.hh:54
RFAccessTracker
Definition: RFAccessTracker.hh:52
SimulatorConstants.hh
Listener::handleEvent
virtual void handleEvent()
Definition: Listener.cc:70
RFAccessTracker::concurrentRegisterFileAccessCount
ClockCycleCount concurrentRegisterFileAccessCount(const std::string &rfName, std::size_t concurrentWrites, std::size_t concurrentReads) const
Definition: RFAccessTracker.cc:198
RFAccessTracker::instructionExecutions_
const InstructionMemory & instructionExecutions_
used to access instruction execution data
Definition: RFAccessTracker.hh:86
RFAccessTracker::~RFAccessTracker
virtual ~RFAccessTracker()
Definition: RFAccessTracker.cc:76
hash_map
#define hash_map
Definition: hash_map.hh:68
RFAccessTracker::RFAccessTracker
RFAccessTracker(SimulatorFrontend &frontend, const InstructionMemory &instructions)
Definition: RFAccessTracker.cc:63
RFAccessTracker::frontend_
SimulatorFrontend & frontend_
the simulator frontend used to access simulation data
Definition: RFAccessTracker.hh:84
hash_map.hh
RFAccessTracker::accessDataBase
const ConcurrentRFAccessIndex & accessDataBase() const
Definition: RFAccessTracker.cc:220
RFAccessTracker::conditionalAccesses_
ConcurrentRFAccessIndex conditionalAccesses_
conditional register file accesses are counted in this container
Definition: RFAccessTracker.hh:88
ClockCycleCount
CycleCount ClockCycleCount
Alias for ClockCycleCount.
Definition: SimulatorConstants.hh:57
SimulatorFrontend
Definition: SimulatorFrontend.hh:89
RFAccessTracker::totalAccesses_
ConcurrentRFAccessIndex totalAccesses_
total (conditional + unconditional) register file accesses are counted in this container
Definition: RFAccessTracker.hh:91
RFAccessTracker::RFAccessIndex
hash_map< const char *, boost::tuple< std::size_t, std::size_t > > RFAccessIndex
Index for RF accesses in an instruction.
Definition: RFAccessTracker.hh:82
Listener.hh