OpenASIP 2.2
Loading...
Searching...
No Matches
ProximRFDetailsCmd.cc
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 ProximRFDetailsCmd.cc
26 *
27 * Implementation of ProximRFDetailsCmd class.
28 *
29 * @author Veli-Pekka Jääskeläinen 2005 (vjaaskel-no.spam-cs.tut.fi)
30 * @note rating: red
31 */
32
33#include <string>
34#include "ProximRFDetailsCmd.hh"
36#include "ProximToolbox.hh"
37#include "RegisterFile.hh"
39#include "Conversion.hh"
40#include "ProximConstants.hh"
41#include "MachineState.hh"
42#include "PortState.hh"
43#include "RegisterFileState.hh"
44#include "UtilizationStats.hh"
45
46using std::string;
47using namespace TTAMachine;
48
49/**
50 * The Constructor.
51 *
52 * @param rf Register file to display.
53 */
57
58
59/**
60 * The Destructor.
61 */
64
65/**
66 * Executes the command.
67 */
68bool
70
71 string rfName = rf_.name();
72
75
76 const UtilizationStats& stats =
78
79 // Append component type and name to the details widget.
81 machineWin->appendDetails(rfName + "\n\n");
82
83 // Append registers to the details widget.
84 machineWin->appendDetails(
86 RegisterFileState& rfState = machineState.registerFileState(rfName);
87 for (unsigned i = 0; i < rfState.registerCount(); i++) {
88 machineWin->appendDetails(" " + Conversion::toString(i) + ":\t");
89 int registerValue = rfState.registerState(i).value().unsignedValue();
90 machineWin->appendDetails(Conversion::toString(registerValue) + "\n");
91 }
92
93 // Append register access statistics to the utilization widget.
94 machineWin->appendUtilizationData("Register access statistics:\n\n");
95
96 int usedRegCount = 0;
97 for (unsigned i = 0; i < rfState.registerCount(); i++) {
98 ClockCycleCount readCount = stats.registerReads(rfName, i);
99 ClockCycleCount writeCount = stats.registerWrites(rfName, i);
100 if (readCount > 0 || writeCount > 0) {
101 usedRegCount++;
102 }
103 machineWin->appendUtilizationData(
104 Conversion::toString(i) + + ": " +
105 Conversion::toString(readCount) + " reads, " +
106 Conversion::toString(writeCount) + " writes.\n");
107 }
108
109 machineWin->appendUtilizationData(
110 "\nTotal of " + Conversion::toString(usedRegCount) +
111 " registers used.");
112
113 return true;
114}
CycleCount ClockCycleCount
Alias for ClockCycleCount.
static std::string toString(const T &source)
RegisterFileState & registerFileState(const std::string &name)
static const std::string MACH_WIN_RF_LABEL
Label precing register file names in the machine state window.
static const std::string MACH_WIN_REGISTERS_TITLE
Title for the machine state window register file register list.
void appendDetails(std::string text)
void appendUtilizationData(std::string text)
const TTAMachine::RegisterFile & rf_
Register file to display.
ProximRFDetailsCmd(const TTAMachine::RegisterFile &rf)
static TracedSimulatorFrontend * frontend()
static ProximMachineStateWindow * machineStateWindow()
virtual RegisterState & registerState(int index)
virtual std::size_t registerCount() const
virtual const SimValue & value() const
unsigned int unsignedValue() const
Definition SimValue.cc:919
const UtilizationStats & utilizationStatistics(int core=-1)
MachineState & machineState(int core=-1)
virtual TCEString name() const
ClockCycleCount registerReads(const std::string &rfName, int registerIndex) const
ClockCycleCount registerWrites(const std::string &rfName, int registerIndex) const