OpenASIP 2.2
Loading...
Searching...
No Matches
ProximBusDetailsCmd.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 ProximBusDetailsCmd.cc
26 *
27 * Implementation of ProximBusDetailsCmd 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>
36#include "ProximToolbox.hh"
37#include "Bus.hh"
39#include "Conversion.hh"
40#include "ProximConstants.hh"
41#include "MachineState.hh"
42#include "BusState.hh"
43#include "UtilizationStats.hh"
44
45using std::string;
46using namespace TTAMachine;
47
48/**
49 * The Constructor.
50 *
51 * @param bus Bus to display.
52 */
56
57
58/**
59 * The Destructor.
60 */
63
64/**
65 * Executes the command.
66 */
67bool
69
70 string busName = bus_.name();
71
74 const UtilizationStats& stats =
76
77 // Append component type and name to the details widget.
79 machineWin->appendDetails(busName + "\n\n");
80
81 // Append registers to the details widget.
82 const BusState& busState = machineState.busState(busName);
83 int busValue = busState.value().sIntWordValue();
85 machineWin->appendDetails(Conversion::toString(busValue) + "\n");
86
87 // Append utlization statistics.
88 ClockCycleCount writes = stats.busWrites(busName);
89 machineWin->appendUtilizationData(
92
94 double percent = 0;
95 if (cycles > 0) {
96 percent = (100.0 * writes) / cycles;
97 }
98 machineWin->appendUtilizationData(
99 " (" + Conversion::toString(percent) + "%)");
100
101 return true;
102}
CycleCount ClockCycleCount
Alias for ClockCycleCount.
static std::string toString(const T &source)
BusState & busState(const std::string &name)
ProximBusDetailsCmd(const TTAMachine::Bus &bus)
const TTAMachine::Bus & bus_
Bus to display.
static const std::string MACH_WIN_BUS_LABEL
Label precing bus names in the machine state window.
static const std::string MACH_WIN_BUS_WRITES_LABEL
Label for the machine state window bus write count..
static const std::string MACH_WIN_BUS_VALUE_LABEL
Label for the machine state window bus value.
void appendDetails(std::string text)
void appendUtilizationData(std::string text)
static TracedSimulatorFrontend * frontend()
static ProximMachineStateWindow * machineStateWindow()
virtual const SimValue & value() const
SIntWord sIntWordValue() const
Definition SimValue.cc:944
const UtilizationStats & utilizationStatistics(int core=-1)
ClockCycleCount cycleCount() const
MachineState & machineState(int core=-1)
virtual TCEString name() const
ClockCycleCount busWrites(const std::string &busName) const