OpenASIP 2.2
Loading...
Searching...
No Matches
ProximIUDetailsCmd.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 ProximIUDetailsCmd.cc
26 *
27 * Implementation of ProximIUDetailsCmd 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 "ProximIUDetailsCmd.hh"
36#include "ProximToolbox.hh"
37#include "ImmediateUnit.hh"
39#include "Conversion.hh"
40#include "ProximConstants.hh"
41#include "MachineState.hh"
43#include "UtilizationStats.hh"
44
45using std::string;
46using namespace TTAMachine;
47
48/**
49 * The Constructor.
50 *
51 * @param iu Immediate unit to display.
52 */
56
57
58/**
59 * The Destructor.
60 */
63
64/**
65 * Executes the command.
66 */
67bool
69
70 string iuName = iu_.name();
71
74
75 const UtilizationStats& stats =
77
78 // Append component type and name to the details widget.
80 machineWin->appendDetails(iuName + "\n\n");
81
82 // Append registers to the details widget.
83 machineWin->appendDetails(
85 LongImmediateUnitState& iuState =
86 machineState.longImmediateUnitState(iuName);
87
88 for (int i = 0; i < iuState.immediateRegisterCount(); i++) {
89 machineWin->appendDetails(" " + Conversion::toString(i) + ":\t");
90 int immValue = iuState.registerValue(i).sIntWordValue();
91 machineWin->appendDetails(Conversion::toString(immValue) + "\n");
92 }
93
94 // Append register access statistics to the utilization widget.
95 machineWin->appendUtilizationData("Register access statistics:\n\n");
96
97 int usedRegCount = 0;
98 for (int i = 0; i < iuState.immediateRegisterCount(); i++) {
99 ClockCycleCount reads = stats.registerReads(iuName, i);
100 ClockCycleCount writes = stats.registerWrites(iuName, i);
101 if (reads > 0 || writes > 0) {
102 usedRegCount++;
103 }
104 machineWin->appendUtilizationData(
105 Conversion::toString(i) + + ": " +
106 Conversion::toString(reads) + " reads, " +
107 Conversion::toString(writes) + " writes.\n");
108 }
109
110 machineWin->appendUtilizationData(
111 "\nTotal of " + Conversion::toString(usedRegCount) +
112 " registers used.");
113
114 return true;
115}
CycleCount ClockCycleCount
Alias for ClockCycleCount.
static std::string toString(const T &source)
virtual int immediateRegisterCount() const
virtual SimValue & registerValue(int index)
LongImmediateUnitState & longImmediateUnitState(const std::string &name)
static const std::string MACH_WIN_IMMEDIATES_TITLE
Title for the machine state window immediate unit immediates list.
static const std::string MACH_WIN_IU_LABEL
Label precing immediate unit names in the machine state window.
const TTAMachine::ImmediateUnit & iu_
Immediate unit to display.
ProximIUDetailsCmd(const TTAMachine::ImmediateUnit &iu)
void appendDetails(std::string text)
void appendUtilizationData(std::string text)
static TracedSimulatorFrontend * frontend()
static ProximMachineStateWindow * machineStateWindow()
SIntWord sIntWordValue() const
Definition SimValue.cc:944
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