OpenASIP 2.2
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
ProximMachineStateWindow Class Reference

#include <ProximMachineStateWindow.hh>

Inheritance diagram for ProximMachineStateWindow:
Inheritance graph
Collaboration diagram for ProximMachineStateWindow:
Collaboration graph

Public Types

enum  {
  COMMAND_ZOOM_IN = 20000 , COMMAND_ZOOM_OUT , COMMAND_TOGGLE_UNIT_INFO , COMMAND_TOGGLE_MOVES ,
  COMMAND_TOGGLE_UTILIZATIONS , COMMAND_EXPORT
}
 

Public Member Functions

 ProximMachineStateWindow (ProximMainFrame *parent, int id)
 
virtual ~ProximMachineStateWindow ()
 
virtual void reset ()
 
void setMachine (TTAMachine::Machine *machine)
 
void setStatusText (std::string status)
 
void appendUtilizationData (std::string text)
 
void appendDetails (std::string text)
 
void clearDetails ()
 

Private Types

enum  {
  ID_MACHINE_CANVAS = 10000 , ID_UTILIZATION_WINDOW , ID_TITLE , ID_DETAILS ,
  ID_LINE , ID_LABEL_UTILIZATION , ID_UTILIZATION , ID_SPLITTER
}
 

Private Member Functions

void onMachineLoaded (const SimulatorEvent &event)
 
void onProgramLoaded (const SimulatorEvent &event)
 
void onSimulationStop (const SimulatorEvent &event)
 
void createContents ()
 
void onZoom (wxCommandEvent &event)
 
void setUtilizationHighlights ()
 
void addMoves ()
 
void onToggleMoves (wxCommandEvent &event)
 
void onToggleUtilizations (wxCommandEvent &event)
 
void onToggleUnitInfo (wxCommandEvent &event)
 
void onUpdateUIEvent (wxUpdateUIEvent &event)
 
void onExport (wxCommandEvent &event)
 

Private Attributes

MachineCanvascanvas_
 Machine visualization canvas.
 
SimulatorFrontendsimulator_
 Simulator instance which contains the registers to display.
 
wxBoxSizer * sizer_
 Toplevel sizer for the window widgets.
 
wxStatusBar * statusbar_
 Statusbar of the window.
 
bool showMoves_
 Tells if the moves are displayed or not.
 
bool showUtilizations_
 Tells if the machine part utilizations are displayed or not.
 
wxTextCtrl * detailsCtrl_
 Utilziation window where to display utilization data of the components.
 
wxTextCtrl * utilizationCtrl_
 

Static Private Attributes

static const int MINIMUM_PANE_WIDTH = 150
 Minimum width for the splitter window panes.
 
static const int INITIAL_DETAILS_PANE_WIDTH = 200
 Initial width for the component detail pane.
 

Additional Inherited Members

- Protected Member Functions inherited from ProximSimulatorWindow
 ProximSimulatorWindow (ProximMainFrame *mainFrame, wxWindowID id=-1, wxPoint pos=wxDefaultPosition, wxSize size=wxDefaultSize, long style=wxTAB_TRAVERSAL)
 
virtual ~ProximSimulatorWindow ()
 

Detailed Description

Proxim subwindow which displays the simulated machine state.

This window listens to SimulatorEvents and updates the window contents automatically.

Definition at line 56 of file ProximMachineStateWindow.hh.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
COMMAND_ZOOM_IN 
COMMAND_ZOOM_OUT 
COMMAND_TOGGLE_UNIT_INFO 
COMMAND_TOGGLE_MOVES 
COMMAND_TOGGLE_UTILIZATIONS 
COMMAND_EXPORT 

Definition at line 68 of file ProximMachineStateWindow.hh.

◆ anonymous enum

anonymous enum
private

Constructor & Destructor Documentation

◆ ProximMachineStateWindow()

ProximMachineStateWindow::ProximMachineStateWindow ( ProximMainFrame parent,
int  id 
)

Constructor.

Parameters
parentParent window of the window.
idWindow identifier.

Definition at line 94 of file ProximMachineStateWindow.cc.

95 :
96 ProximSimulatorWindow(parent, id, wxDefaultPosition, wxSize(800,600)),
97 showMoves_(true), showUtilizations_(true),
98 detailsCtrl_(NULL), utilizationCtrl_(NULL) {
99
101
102 SetSizeHints(400, 300);
103
104 simulator_ = wxGetApp().simulation()->frontend();
105
110
112 const_cast<Machine*>(&ProximToolbox::machine());
113
115
116 if (showUtilizations_) {
118 }
119
120 }
121}
TTAMachine::Machine * machine
the architecture definition of the estimated processor
void setMachine(TTAMachine::Machine *machine)
wxTextCtrl * detailsCtrl_
Utilziation window where to display utilization data of the components.
bool showMoves_
Tells if the moves are displayed or not.
bool showUtilizations_
Tells if the machine part utilizations are displayed or not.
MachineCanvas * canvas_
Machine visualization canvas.
SimulatorFrontend * simulator_
Simulator instance which contains the registers to display.
static const TTAMachine::Machine & machine()
bool hasSimulationEnded() const
bool isSimulationInitialized() const
bool isSimulationStopped() const
bool isSimulationRunning() const

References machine, and ProximToolbox::machine().

Here is the call graph for this function:

◆ ~ProximMachineStateWindow()

ProximMachineStateWindow::~ProximMachineStateWindow ( )
virtual

Destructor.

Definition at line 127 of file ProximMachineStateWindow.cc.

127 {
128}

Member Function Documentation

◆ addMoves()

void ProximMachineStateWindow::addMoves ( )
private

Adds active moves to be drawn on the canvas.

Definition at line 358 of file ProximMachineStateWindow.cc.

358 {
359
361
362 const TTAProgram::Instruction& instruction =
363 simulator_->program().instructionAt(address);
364
366 for (int i = 0; i < instruction.moveCount(); i++) {
367
368 // Check that the move wasn't squashed by a guard.
369 const ExecutableInstruction& lastInstruction =
371
372 if (lastInstruction.moveSquashed(i)) {
373 continue;
374 }
375
376 // Move not squashed, add move to be drawn on the canvas.
377 TTAProgram::Move& move = instruction.move(i);
378 const Bus* bus = &move.bus();
379 const Port* source = NULL;
380 const Port* target = NULL;
381 if (move.source().isFUPort() || move.source().isGPR()) {
382 source = &move.source().port();
383 }
384 if (move.destination().isFUPort() || move.destination().isGPR()) {
385 target = &move.destination().port();
386 }
387 canvas_->addMove(bus, source, target);
388 }
389
390}
UInt32 InstructionAddress
Definition BaseType.hh:175
bool moveSquashed(std::size_t moveIndex) const
void addMove(const TTAMachine::Bus *bus, const TTAMachine::Port *source, const TTAMachine::Port *target)
const ExecutableInstruction & lastExecInstruction() const
virtual InstructionAddress lastExecutedInstruction(int coreId=-1) const
const TTAProgram::Program & program() const
Move & move(int i) const
Terminal & source() const
Definition Move.cc:302
Terminal & destination() const
Definition Move.cc:323
const TTAMachine::Bus & bus() const
Definition Move.cc:373
Instruction & instructionAt(InstructionAddress address) const
Definition Program.cc:374
virtual bool isGPR() const
Definition Terminal.cc:107
virtual const TTAMachine::Port & port() const
Definition Terminal.cc:378
virtual bool isFUPort() const
Definition Terminal.cc:118

References MachineCanvas::addMove(), TTAProgram::Move::bus(), canvas_, MachineCanvas::clearMoves(), TTAProgram::Move::destination(), TTAProgram::Program::instructionAt(), TTAProgram::Terminal::isFUPort(), TTAProgram::Terminal::isGPR(), SimulatorFrontend::lastExecInstruction(), SimulatorFrontend::lastExecutedInstruction(), TTAProgram::Instruction::move(), TTAProgram::Instruction::moveCount(), ExecutableInstruction::moveSquashed(), TTAProgram::Terminal::port(), SimulatorFrontend::program(), simulator_, and TTAProgram::Move::source().

Referenced by onSimulationStop(), and onToggleMoves().

Here is the call graph for this function:

◆ appendDetails()

void ProximMachineStateWindow::appendDetails ( std::string  text)

Appends text to the component details widget.

Parameters
textText to append.

Definition at line 479 of file ProximMachineStateWindow.cc.

479 {
480 wxString data = WxConversion::toWxString(text);
481 detailsCtrl_->AppendText(data);
482}
static wxString toWxString(const std::string &source)

References detailsCtrl_, and WxConversion::toWxString().

Referenced by ProximBusDetailsCmd::Do(), ProximFUDetailsCmd::Do(), ProximFUPortDetailsCmd::Do(), ProximIUDetailsCmd::Do(), ProximRFDetailsCmd::Do(), and ProximSocketDetailsCmd::Do().

Here is the call graph for this function:

◆ appendUtilizationData()

void ProximMachineStateWindow::appendUtilizationData ( std::string  text)

Appends text to the component utilization widget.

Parameters
textText to append.

Definition at line 467 of file ProximMachineStateWindow.cc.

467 {
468 wxString data = WxConversion::toWxString(text);
469 utilizationCtrl_->AppendText(data);
470}

References WxConversion::toWxString(), and utilizationCtrl_.

Referenced by ProximBusDetailsCmd::Do(), ProximFUDetailsCmd::Do(), ProximIUDetailsCmd::Do(), ProximRFDetailsCmd::Do(), and ProximSocketDetailsCmd::Do().

Here is the call graph for this function:

◆ clearDetails()

void ProximMachineStateWindow::clearDetails ( )

Clears data in the component details pane.

Definition at line 488 of file ProximMachineStateWindow.cc.

488 {
489 detailsCtrl_->Clear();
490 utilizationCtrl_->Clear();
491}

References detailsCtrl_, and utilizationCtrl_.

Referenced by ProximMachineCanvasTool::onMouseEvent(), and onSimulationStop().

◆ createContents()

void ProximMachineStateWindow::createContents ( )
private

Creates the window contents.

Code generated by wxWidgets.

Definition at line 199 of file ProximMachineStateWindow.cc.

199 {
200
201 sizer_ = new wxBoxSizer(wxVERTICAL);
202
203 wxSplitterWindow* splitter = new wxSplitterWindow(
204 this, ID_SPLITTER, wxDefaultPosition, wxSize(800,600),
205 wxSP_BORDER|wxSP_3D|wxCLIP_CHILDREN);
206
207 wxPanel* left = new wxPanel(splitter, -1);
208 wxPanel* right = new wxPanel(splitter, -1);
209
210 // Splitter window left hand pane sizer.
211 wxFlexGridSizer* leftSizer = new wxFlexGridSizer(1, 0, 0);
212 leftSizer->AddGrowableCol(0);
213 leftSizer->AddGrowableRow(1);
214 leftSizer->AddGrowableRow(4);
215
216 wxStaticText* title = new wxStaticText(
218 wxDefaultPosition, wxDefaultSize, 0);
219
220 detailsCtrl_ = new wxTextCtrl(
221 left, ID_DETAILS, wxT(""), wxDefaultPosition, wxSize(80,40),
222 wxTE_MULTILINE|wxTE_READONLY|wxVSCROLL|wxHSCROLL);
223
224 wxStaticLine* line = new wxStaticLine(
225 left, ID_LINE, wxDefaultPosition, wxSize(20,-1), wxLI_HORIZONTAL);
226
227 wxStaticText* utilizationTitle = new wxStaticText(
230 wxDefaultSize, 0);
231
232 utilizationCtrl_ = new wxTextCtrl(
233 left, ID_UTILIZATION, wxT(""), wxDefaultPosition, wxSize(80,40),
234 wxTE_MULTILINE|wxTE_READONLY|wxVSCROLL|wxHSCROLL);
235
236 leftSizer->Add(title, 0, wxGROW|wxALL, 5);
237 leftSizer->Add(detailsCtrl_, 0, wxGROW|wxALL, 5);
238 leftSizer->Add(line, 0, wxGROW|wxALL, 5);
239 leftSizer->Add(utilizationTitle, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
240 leftSizer->Add(utilizationCtrl_, 0, wxGROW|wxALL, 5);
241 left->SetSizer(leftSizer);
242
243
244 // Splitter window right hand pane sizer.
245 wxFlexGridSizer* rightSizer = new wxFlexGridSizer(1, 0, 0);
246 rightSizer->AddGrowableCol(0);
247 rightSizer->AddGrowableRow(0);
249 statusbar_ = new wxStatusBar(right, -1);
250 rightSizer->Add(canvas_, 0, wxGROW|wxALL, 5);
251 rightSizer->Add(statusbar_, 0, wxGROW|wxALL, 5);
252 right->SetSizer(rightSizer);
253
254 // Set sizers and split the window.
255 splitter->SetMinimumPaneSize(MINIMUM_PANE_WIDTH);
256 splitter->SplitVertically(left, right);
257 splitter->SetSashPosition(INITIAL_DETAILS_PANE_WIDTH);
258
259 sizer_->Add(splitter, 1, wxGROW);
260 SetSizer(sizer_);
261
262 // Create tool for the canvas.
264 canvas_->setTool(canvasTool);
265}
void setTool(MachineCanvasTool *tool)
static const wxString MACH_WIN_DETAILS_TITLE
Execution count title for the machine state window.
static const wxString MACH_WIN_UTILIZATION_TITLE
Execution count title for the machine state window.
wxBoxSizer * sizer_
Toplevel sizer for the window widgets.
static const int MINIMUM_PANE_WIDTH
Minimum width for the splitter window panes.
static const int INITIAL_DETAILS_PANE_WIDTH
Initial width for the component detail pane.
wxStatusBar * statusbar_
Statusbar of the window.

References canvas_, detailsCtrl_, ID_DETAILS, ID_LABEL_UTILIZATION, ID_LINE, ID_SPLITTER, ID_TITLE, ID_UTILIZATION, INITIAL_DETAILS_PANE_WIDTH, ProximConstants::MACH_WIN_DETAILS_TITLE, ProximConstants::MACH_WIN_UTILIZATION_TITLE, MINIMUM_PANE_WIDTH, MachineCanvas::setTool(), sizer_, statusbar_, and utilizationCtrl_.

Here is the call graph for this function:

◆ onExport()

void ProximMachineStateWindow::onExport ( wxCommandEvent &  event)
private

Displays a dialog for saving machine figure in a file.

Definition at line 498 of file ProximMachineStateWindow.cc.

498 {
499
500 wxString message = _T("Export processor figure.");
501 wxString defaultDir = _T(".");
502 wxString defaultFile= _T("");
503#if wxCHECK_VERSION(3, 0, 0)
504 wxString fileTypes = _T("Scalable Vector Graphics (.svg)|*.svg|");
505#else
506 wxString fileTypes = _T("Encapsulated Postscript (.eps)|*.eps;*.epsi|");
507#endif
508 fileTypes.Append(_T("Portable Network Graphics (.png)|*.png"));
509
510 wxFileDialog dialog(
511 this, message, defaultDir, defaultFile, fileTypes,
512 wxSAVE | wxOVERWRITE_PROMPT);
513
514 if (dialog.ShowModal() == wxID_CANCEL) {
515 return;
516 }
517
518 std::string filename = WxConversion::toString(dialog.GetPath());
519 std::string extension = FileSystem::fileExtension(filename);
520 std::string creator = "TTA Processor Simulator (Proxim)";
521 std::string title = "Processor Simulation";
522
523#if wxCHECK_VERSION(3, 0, 0)
524 if (extension == ".svg") {
525 if (!canvas_->saveSVG(filename)) {
526#else
527 if (extension == ".eps" || extension == ".epsi") {
528 if (!canvas_->saveEPS(filename, title, creator)) {
529#endif
530 wxString message = _T("Error saving file '");
531 message.Append(dialog.GetPath());
532 message.Append(_T("'."));
533 ErrorDialog errorDialog(this, message);
534 errorDialog.ShowModal();
535 }
536 } else if (extension == ".png") {
537 if (!canvas_->savePNG(filename)) {
538 wxString message = _T("Error saving file '");
539 message.Append(dialog.GetPath());
540 message.Append(_T("'."));
541 ErrorDialog errorDialog(this, message);
542 errorDialog.ShowModal();
543 }
544 } else {
545 wxString message = _T("File type with extension '");
546 message.Append(WxConversion::toWxString(extension));
547 message.Append(_T("' is not supported."));
548 ErrorDialog dialog(this, message);
549 dialog.ShowModal();
550 }
551}
static std::string fileExtension(const std::string &fileName)
bool savePNG(const std::string &filename)
bool saveEPS(const std::string &filename, const std::string &title, const std::string &creator="")
static std::string toString(const wxString &source)

References canvas_, FileSystem::fileExtension(), MachineCanvas::saveEPS(), MachineCanvas::savePNG(), WxConversion::toString(), and WxConversion::toWxString().

Here is the call graph for this function:

◆ onMachineLoaded()

void ProximMachineStateWindow::onMachineLoaded ( const SimulatorEvent event)
private

◆ onProgramLoaded()

void ProximMachineStateWindow::onProgramLoaded ( const SimulatorEvent event)
private

Event handler which is called when a new program is loaded in the simulator.

Definition at line 135 of file ProximMachineStateWindow.cc.

135 {
137 const_cast<Machine*>(&simulator_->machine());
139}
const TTAMachine::Machine & machine() const

References canvas_, SimulatorFrontend::machine(), machine, MachineCanvas::setMachine(), and simulator_.

Here is the call graph for this function:

◆ onSimulationStop()

void ProximMachineStateWindow::onSimulationStop ( const SimulatorEvent event)
private

Event handler for simulation stop.

Refreshes the register values.

Definition at line 159 of file ProximMachineStateWindow.cc.

159 {
160
161 // Store pointer to the selected machine part.
162 const MachinePart* selection = NULL;
163 if (canvas_->selection() != NULL) {
164 selection = canvas_->selection()->model();
165 }
166
168 clearDetails();
169
170 if (showMoves_) {
171 addMoves();
172 }
173 if (showUtilizations_) {
175 }
176
177 canvas_->Refresh();
178
179 // Reselect & display details of the previously selected machine part.
180 Request statusRequest(Request::DETAILS_REQUEST);
181 if (selection != NULL) {
182 EditPart * part = canvas_->findEditPart(selection);
183 if (part != NULL && part->canHandle(&statusRequest)) {
184 canvas_->select(part);
185 ComponentCommand* command = part->performRequest(&statusRequest);
186 command->Do();
187 delete command;
188 }
189 }
190}
virtual bool Do()=0
bool canHandle(Request *request) const
Definition EditPart.cc:316
ComponentCommand * performRequest(Request *request) const
Definition EditPart.cc:297
TTAMachine::MachinePart * model() const
EditPart * selection()
void select(EditPart *part)
EditPart * findEditPart(int x, int y)
@ DETAILS_REQUEST
Detailed info request.
Definition Request.hh:53

References addMoves(), EditPart::canHandle(), canvas_, clearDetails(), MachineCanvas::clearSelection(), Request::DETAILS_REQUEST, ComponentCommand::Do(), MachineCanvas::findEditPart(), EditPart::model(), EditPart::performRequest(), MachineCanvas::select(), MachineCanvas::selection(), setUtilizationHighlights(), showMoves_, and showUtilizations_.

Here is the call graph for this function:

◆ onToggleMoves()

void ProximMachineStateWindow::onToggleMoves ( wxCommandEvent &  event)
private

Toggles the move display on and off.

Definition at line 411 of file ProximMachineStateWindow.cc.

411 {
413 if (showMoves_) {
414 addMoves();
415 } else {
417 }
418 canvas_->Refresh();
419}

References addMoves(), canvas_, MachineCanvas::clearMoves(), and showMoves_.

Here is the call graph for this function:

◆ onToggleUnitInfo()

void ProximMachineStateWindow::onToggleUnitInfo ( wxCommandEvent &  event)
private

Toggles the unit info string display on and off.

Definition at line 396 of file ProximMachineStateWindow.cc.

396 {
397
398 OptionValue& showInfo = canvas_->options().optionValue(
400
401 showInfo.setBoolValue(!showInfo.isFlagOn());
403
404}
static const std::string SHOW_UNIT_INFO_STRING
Option name for the unit info string visibility flag.
MachineCanvasOptions & options()
virtual void setBoolValue(bool)
virtual bool isFlagOn() const
OptionValue & optionValue(const string &name, int index=0)
Definition Options.cc:115

References canvas_, OptionValue::isFlagOn(), MachineCanvas::options(), Options::optionValue(), OptionValue::setBoolValue(), MachineCanvasOptions::SHOW_UNIT_INFO_STRING, and MachineCanvas::updateMachine().

Here is the call graph for this function:

◆ onToggleUtilizations()

void ProximMachineStateWindow::onToggleUtilizations ( wxCommandEvent &  event)
private

Toggles the utilization display on and off.

Definition at line 425 of file ProximMachineStateWindow.cc.

425 {
426
428
430 if (showUtilizations_ && frontend != NULL) {
432 } else {
434 }
435 canvas_->Refresh();
436}
static TracedSimulatorFrontend * frontend()

References canvas_, MachineCanvas::clearHighlights(), ProximToolbox::frontend(), setUtilizationHighlights(), and showUtilizations_.

Here is the call graph for this function:

◆ onUpdateUIEvent()

void ProximMachineStateWindow::onUpdateUIEvent ( wxUpdateUIEvent &  event)
private

Event handler for meni item UI update events.

Parameters
eventUpdate event to handle.

Definition at line 445 of file ProximMachineStateWindow.cc.

445 {
446
447 if (event.GetId() == COMMAND_TOGGLE_MOVES) {
448 event.Check(showMoves_);
449 } else if (event.GetId() == COMMAND_TOGGLE_UTILIZATIONS) {
450 event.Check(showUtilizations_);
451 } else if (event.GetId() == COMMAND_TOGGLE_UNIT_INFO) {
452 OptionValue& showInfo = canvas_->options().optionValue(
454 event.Check(showInfo.isFlagOn());
455 } else {
456 event.Skip();
457 }
458}

References canvas_, COMMAND_TOGGLE_MOVES, COMMAND_TOGGLE_UNIT_INFO, COMMAND_TOGGLE_UTILIZATIONS, OptionValue::isFlagOn(), MachineCanvas::options(), Options::optionValue(), MachineCanvasOptions::SHOW_UNIT_INFO_STRING, showMoves_, and showUtilizations_.

Here is the call graph for this function:

◆ onZoom()

void ProximMachineStateWindow::onZoom ( wxCommandEvent &  event)
private

Handles zoom menu item events.

Parameters
eventMenu event to handle.

Definition at line 286 of file ProximMachineStateWindow.cc.

286 {
287
288 // Zoom in.
289 if (event.GetId() == COMMAND_ZOOM_IN) {
290 canvas_->zoomIn();
291 }
292
293 // Zoom out.
294 if (event.GetId() == COMMAND_ZOOM_OUT) {
295 canvas_->zoomOut();
296 }
297}

References canvas_, COMMAND_ZOOM_IN, COMMAND_ZOOM_OUT, MachineCanvas::zoomIn(), and MachineCanvas::zoomOut().

Here is the call graph for this function:

◆ reset()

void ProximMachineStateWindow::reset ( )
virtual

Resets the machine displayed on the canvas when the machine is unloaded in the simulator.

Reimplemented from ProximSimulatorWindow.

Definition at line 147 of file ProximMachineStateWindow.cc.

147 {
148 canvas_->setMachine(NULL);
149}

References canvas_, and MachineCanvas::setMachine().

Here is the call graph for this function:

◆ setMachine()

void ProximMachineStateWindow::setMachine ( TTAMachine::Machine machine)

◆ setStatusText()

void ProximMachineStateWindow::setStatusText ( std::string  status)

Sets the status line text.

Parameters
statusStatus text to set.

Definition at line 274 of file ProximMachineStateWindow.cc.

274 {
275 wxString text = WxConversion::toWxString(status);
276 statusbar_->SetStatusText(text);
277}

References statusbar_, and WxConversion::toWxString().

Referenced by ProximComponentStatusCmd::Do(), and ProximMachineCanvasTool::onMouseEvent().

Here is the call graph for this function:

◆ setUtilizationHighlights()

void ProximMachineStateWindow::setUtilizationHighlights ( )
private

Sets machine part highlights based on part utilizations.

Definition at line 304 of file ProximMachineStateWindow.cc.

304 {
305
307
308 Machine* machine = const_cast<Machine*>(&ProximToolbox::machine());
309
310 const UtilizationStats& stats =
312
314
315 // Highlight buses.
316 const Machine::BusNavigator& busNavigator = machine->busNavigator();
317 for (int i = 0; i < busNavigator.count(); i++) {
318 ClockCycleCount writes =
319 stats.busWrites(busNavigator.item(i)->name());
320 double utilization = static_cast<double>(writes) / cycles;
321 unsigned value = unsigned(utilization * 255);
322 canvas_->highlight(busNavigator.item(i), wxColour(value, 0, 0));
323 }
324
325 // Highlight sockets.
326 const Machine::SocketNavigator& socketNavigator =
328
329 for (int i = 0; i < socketNavigator.count(); i++) {
330 ClockCycleCount writes =
331 stats.socketWrites(socketNavigator.item(i)->name());
332 double utilization = static_cast<double>(writes) / cycles;
333 unsigned value = 255 - unsigned(utilization * 255);
334 wxColour colour = wxColour(255, value, value);
335 canvas_->highlight(socketNavigator.item(i), colour);
336 }
337
338 // Highlight function units.
339 const Machine::FunctionUnitNavigator& fuNavigator =
341
342 for (int i = 0; i < fuNavigator.count(); i++) {
343 ClockCycleCount writes =
344 stats.triggerCount(fuNavigator.item(i)->name());
345 double utilization = static_cast<double>(writes) / cycles;
346 unsigned value = 255 - unsigned(utilization * 255);
347 wxColour colour = wxColour(255, value, value);
348 canvas_->highlight(fuNavigator.item(i), colour);
349 }
350
351}
CycleCount ClockCycleCount
Alias for ClockCycleCount.
void highlight(TTAMachine::MachinePart *model, const wxColour &colour)
const UtilizationStats & utilizationStatistics(int core=-1)
ClockCycleCount cycleCount() const
ComponentType * item(int index) const
virtual FunctionUnitNavigator functionUnitNavigator() const
Definition Machine.cc:380
virtual SocketNavigator socketNavigator() const
Definition Machine.cc:368
virtual BusNavigator busNavigator() const
Definition Machine.cc:356
ClockCycleCount busWrites(const std::string &busName) const
ClockCycleCount triggerCount(const std::string &fuName) const
ClockCycleCount socketWrites(const std::string &socketName) const

References TTAMachine::Machine::busNavigator(), UtilizationStats::busWrites(), canvas_, MachineCanvas::clearHighlights(), TTAMachine::Machine::Navigator< ComponentType >::count(), SimulatorFrontend::cycleCount(), ProximToolbox::frontend(), TTAMachine::Machine::functionUnitNavigator(), MachineCanvas::highlight(), TTAMachine::Machine::Navigator< ComponentType >::item(), machine, ProximToolbox::machine(), TTAMachine::Machine::socketNavigator(), UtilizationStats::socketWrites(), UtilizationStats::triggerCount(), and SimulatorFrontend::utilizationStatistics().

Referenced by onSimulationStop(), and onToggleUtilizations().

Here is the call graph for this function:

Member Data Documentation

◆ canvas_

MachineCanvas* ProximMachineStateWindow::canvas_
private

◆ detailsCtrl_

wxTextCtrl* ProximMachineStateWindow::detailsCtrl_
private

Utilziation window where to display utilization data of the components.

Definition at line 119 of file ProximMachineStateWindow.hh.

Referenced by appendDetails(), clearDetails(), and createContents().

◆ INITIAL_DETAILS_PANE_WIDTH

const int ProximMachineStateWindow::INITIAL_DETAILS_PANE_WIDTH = 200
staticprivate

Initial width for the component detail pane.

Definition at line 125 of file ProximMachineStateWindow.hh.

Referenced by createContents().

◆ MINIMUM_PANE_WIDTH

const int ProximMachineStateWindow::MINIMUM_PANE_WIDTH = 150
staticprivate

Minimum width for the splitter window panes.

Definition at line 123 of file ProximMachineStateWindow.hh.

Referenced by createContents().

◆ showMoves_

bool ProximMachineStateWindow::showMoves_
private

Tells if the moves are displayed or not.

Definition at line 113 of file ProximMachineStateWindow.hh.

Referenced by onSimulationStop(), onToggleMoves(), and onUpdateUIEvent().

◆ showUtilizations_

bool ProximMachineStateWindow::showUtilizations_
private

Tells if the machine part utilizations are displayed or not.

Definition at line 115 of file ProximMachineStateWindow.hh.

Referenced by onSimulationStop(), onToggleUtilizations(), and onUpdateUIEvent().

◆ simulator_

SimulatorFrontend* ProximMachineStateWindow::simulator_
private

Simulator instance which contains the registers to display.

Definition at line 94 of file ProximMachineStateWindow.hh.

Referenced by addMoves(), and onProgramLoaded().

◆ sizer_

wxBoxSizer* ProximMachineStateWindow::sizer_
private

Toplevel sizer for the window widgets.

Definition at line 96 of file ProximMachineStateWindow.hh.

Referenced by createContents().

◆ statusbar_

wxStatusBar* ProximMachineStateWindow::statusbar_
private

Statusbar of the window.

Definition at line 98 of file ProximMachineStateWindow.hh.

Referenced by createContents(), and setStatusText().

◆ utilizationCtrl_

wxTextCtrl* ProximMachineStateWindow::utilizationCtrl_
private

The documentation for this class was generated from the following files: