OpenASIP 2.2
Loading...
Searching...
No Matches
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
48
49/**
50 * Tracks concurrent register file accesses.
51 */
52class RFAccessTracker : public Listener {
53public:
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
77private:
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
CycleCount ClockCycleCount
Alias for ClockCycleCount.
virtual void handleEvent()
Definition Listener.cc:70
boost::tuple< std::string, std::size_t, std::size_t > ConcurrentRFAccess
type to be used as a key for storing concurrent access info
hash_map< const char *, boost::tuple< std::size_t, std::size_t > > RFAccessIndex
Index for RF accesses in an instruction.
RFAccessIndex accessesInInstruction_
container used in collecting register accesses in an instruction
SimulatorFrontend & frontend_
the simulator frontend used to access simulation data
ClockCycleCount concurrentRegisterFileAccessCount(const std::string &rfName, std::size_t concurrentWrites, std::size_t concurrentReads) const
const ConcurrentRFAccessIndex & accessDataBase() const
ConcurrentRFAccessIndex totalAccesses_
total (conditional + unconditional) register file accesses are counted in this container
ConcurrentRFAccessIndex conditionalAccesses_
conditional register file accesses are counted in this container
std::map< ConcurrentRFAccess, ClockCycleCount > ConcurrentRFAccessIndex
concurrent accesses and their counts
const InstructionMemory & instructionExecutions_
used to access instruction execution data
virtual ~RFAccessTracker()
#define hash_map
Definition hash_map.hh:68