OpenASIP  2.0
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>
34 #include "ProximBusDetailsCmd.hh"
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 
45 using std::string;
46 using namespace TTAMachine;
47 
48 /**
49  * The Constructor.
50  *
51  * @param bus Bus to display.
52  */
54  ComponentCommand(), bus_(bus) {
55 }
56 
57 
58 /**
59  * The Destructor.
60  */
62 }
63 
64 /**
65  * Executes the command.
66  */
67 bool
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(
91  machineWin->appendUtilizationData(Conversion::toString(writes));
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 }
ProximToolbox::frontend
static TracedSimulatorFrontend * frontend()
Definition: ProximToolbox.cc:223
TTAMachine::Component::name
virtual TCEString name() const
Definition: MachinePart.cc:125
ProximBusDetailsCmd::ProximBusDetailsCmd
ProximBusDetailsCmd(const TTAMachine::Bus &bus)
Definition: ProximBusDetailsCmd.cc:53
ProximMachineStateWindow.hh
TTAMachine::Bus
Definition: Bus.hh:53
ProximMachineStateWindow::appendDetails
void appendDetails(std::string text)
Definition: ProximMachineStateWindow.cc:479
ProximMachineStateWindow
Definition: ProximMachineStateWindow.hh:56
BusState
Definition: BusState.hh:48
ProximConstants::MACH_WIN_BUS_WRITES_LABEL
static const std::string MACH_WIN_BUS_WRITES_LABEL
Label for the machine state window bus write count..
Definition: ProximConstants.hh:224
Conversion::toString
static std::string toString(const T &source)
ProximBusDetailsCmd.hh
ProximToolbox.hh
RegisterState::value
virtual const SimValue & value() const
Definition: RegisterState.cc:92
ProximConstants::MACH_WIN_BUS_LABEL
static const std::string MACH_WIN_BUS_LABEL
Label precing bus names in the machine state window.
Definition: ProximConstants.hh:216
MachineState
Definition: MachineState.hh:61
MachineState::busState
BusState & busState(const std::string &name)
Definition: MachineState.cc:116
Conversion.hh
SimulatorFrontend::utilizationStatistics
const UtilizationStats & utilizationStatistics(int core=-1)
Definition: SimulatorFrontend.cc:2155
BusState.hh
ProximBusDetailsCmd::~ProximBusDetailsCmd
virtual ~ProximBusDetailsCmd()
Definition: ProximBusDetailsCmd.cc:61
UtilizationStats::busWrites
ClockCycleCount busWrites(const std::string &busName) const
Definition: UtilizationStats.cc:192
ProximConstants::MACH_WIN_BUS_VALUE_LABEL
static const std::string MACH_WIN_BUS_VALUE_LABEL
Label for the machine state window bus value.
Definition: ProximConstants.hh:222
Bus.hh
ComponentCommand
Definition: ComponentCommand.hh:46
ProximMachineStateWindow::appendUtilizationData
void appendUtilizationData(std::string text)
Definition: ProximMachineStateWindow.cc:467
SimValue::sIntWordValue
SIntWord sIntWordValue() const
Definition: SimValue.cc:944
ProximBusDetailsCmd::Do
virtual bool Do()
Definition: ProximBusDetailsCmd.cc:68
ProximToolbox::machineStateWindow
static ProximMachineStateWindow * machineStateWindow()
Definition: ProximToolbox.cc:123
UtilizationStats.hh
TracedSimulatorFrontend.hh
SimulatorFrontend::cycleCount
ClockCycleCount cycleCount() const
Definition: SimulatorFrontend.cc:1194
ProximBusDetailsCmd::bus_
const TTAMachine::Bus & bus_
Bus to display.
Definition: ProximBusDetailsCmd.hh:53
ProximConstants.hh
SimulatorFrontend::machineState
MachineState & machineState(int core=-1)
Definition: SimulatorFrontend.cc:2138
MachineState.hh
ClockCycleCount
CycleCount ClockCycleCount
Alias for ClockCycleCount.
Definition: SimulatorConstants.hh:57
TTAMachine
Definition: Assembler.hh:48
UtilizationStats
Definition: UtilizationStats.hh:50