OpenASIP  2.0
OperationDialog.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 OperationDialog.cc
26  *
27  * Implementation of OperationDialog class.
28  *
29  * @author Veli-Pekka Jääskeläinen 2004 (vjaaskel-no.spam-cs.tut.fi)
30  * @note rating: red
31  */
32 
33 #include <list>
34 #include <boost/format.hpp>
35 #include <wx/wx.h>
36 #include <wx/listctrl.h>
37 #include <wx/statline.h>
38 
39 #include "OperationDialog.hh"
40 #include "FunctionUnit.hh"
41 #include "FUPort.hh"
42 #include "WxConversion.hh"
43 #include "HWOperation.hh"
44 #include "ExecutionPipeline.hh"
45 #include "PipelineElement.hh"
46 #include "InformationDialog.hh"
47 #include "WidgetTools.hh"
48 #include "WxConversion.hh"
49 #include "Conversion.hh"
50 #include "GUITextGenerator.hh"
51 #include "ProDeTextGenerator.hh"
52 #include "ContainerTools.hh"
53 #include "WidgetTools.hh"
54 #include "WarningDialog.hh"
55 #include "ProDeConstants.hh"
56 #include "MachineTester.hh"
57 #include "ConfirmDialog.hh"
58 
59 using std::string;
60 using boost::format;
61 using namespace TTAMachine;
62 
64 const wxString OperationDialog::READ_MARK = _T("R");
65 const wxString OperationDialog::WRITE_MARK = _T("W");
66 const wxString OperationDialog::USE_MARK = _T("X");
67 
68 // too long lines to keep doxygen quiet
69 BEGIN_EVENT_TABLE(OperationDialog, wxDialog)
70 
71  EVT_TEXT(ID_NAME, OperationDialog::onName)
72  EVT_TEXT(ID_RESOURCE_NAME, OperationDialog::onName)
73 
76  EVT_CHOICE(ID_PORT, OperationDialog::onBindOperand)
77 
79 
82  EVT_MENU(ID_DELETE_RESOURCE, OperationDialog::onDeleteResource)
83 
86 
87  EVT_GRID_CELL_LEFT_CLICK(OperationDialog::onGridLClick)
88  EVT_GRID_CELL_RIGHT_CLICK(OperationDialog::onGridRClick)
89 
90  EVT_GRID_RANGE_SELECT(OperationDialog::onResourceSelection)
92 
93 
94 /**
95  * The Constructor.
96  *
97  * @param parent Parent window of the dialog.
98  * @param operation Operation to modify.
99  */
101  wxWindow* parent,
102  HWOperation* operation) :
103  wxDialog(
104  parent, -1, _T(""), wxDefaultPosition, wxDefaultSize, wxRESIZE_BORDER),
105  operation_(operation),
106  name_(_T("")),
107  resourceName_(_T("")),
108  latencyText_(NULL) {
109 
110  createContents(this, true, true);
111  initialize();
112  setTexts();
113 }
114 
115 
116 
117 /**
118  * The Destructor.
119  */
121 }
122 
123 
124 /**
125  * Initializes the dialog widgets and some class variables.
126  */
127 void
129 
130  // Name field validators.
131  FindWindow(ID_NAME)->SetValidator(wxTextValidator(wxFILTER_ASCII, &name_));
132  FindWindow(ID_RESOURCE_NAME)->SetValidator(
133  wxTextValidator(wxFILTER_ASCII, &resourceName_));
134 
135  // Set widget pointers.
136  bindList_ = dynamic_cast<wxListCtrl*>(FindWindow(ID_BIND_LIST));
137  resourceGrid_ = dynamic_cast<wxGrid*>(FindWindow(ID_RESOURCE_GRID));
138  usageGrid_ = dynamic_cast<wxGrid*>(FindWindow(ID_OPERAND_GRID));
139  portChoice_ = dynamic_cast<wxChoice*>(FindWindow(ID_PORT));
140  numberControl_ = dynamic_cast<wxSpinCtrl*>(FindWindow(ID_NUMBER));
141 
142  // Operand list.
143  FindWindow(ID_DELETE_OPERAND)->Disable();
144  FindWindow(ID_DELETE_RESOURCE)->Disable();
145 
146  // Resource grid.
147  resourceGrid_->EnableEditing(false);
148  resourceGrid_->SetDefaultCellAlignment(wxALIGN_CENTRE, wxALIGN_CENTRE);
149  resourceGrid_->SetDefaultCellBackgroundColour(
150  wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE));
151  resourceGrid_->SetSelectionBackground(ProDeConstants::WHITE_COLOR);
152  resourceGrid_->SetSelectionForeground(ProDeConstants::BLACK_COLOR);
153  resourceGrid_->DisableDragColSize();
154  resourceGrid_->DisableDragRowSize();
155 
156  // Operand usage grid.
157  usageGrid_->EnableEditing(false);
158  usageGrid_->DisableDragColSize();
159  usageGrid_->DisableDragRowSize();
160  usageGrid_->SetDefaultCellBackgroundColour(ProDeConstants::WHITE_COLOR);
161 
162  latencyText_ = dynamic_cast<wxStaticText*>(FindWindow(ID_LATENCY));
163 }
164 
165 
166 /**
167  * Sets texts for widgets.
168  */
169 void
173 
174  // Dialog title
175  format fmt = prodeTexts->text(
177  SetTitle(WxConversion::toWxString(fmt.str()));
178 
179  // buttons
180  WidgetTools::setLabel(generator, FindWindow(wxID_OK),
182 
183  WidgetTools::setLabel(generator, FindWindow(wxID_CANCEL),
185 
186  WidgetTools::setLabel(generator, FindWindow(ID_HELP),
188 
189  WidgetTools::setLabel(generator, FindWindow(ID_ADD_OPERAND),
191 
192  WidgetTools::setLabel(generator, FindWindow(ID_DELETE_OPERAND),
194 
195  WidgetTools::setLabel(generator, FindWindow(ID_ADD_RESOURCE),
197 
198  WidgetTools::setLabel(generator, FindWindow(ID_DELETE_RESOURCE),
200 
201 
202  // widget labels
203  WidgetTools::setLabel(prodeTexts, FindWindow(ID_LABEL_NAME),
205 
206  WidgetTools::setLabel(prodeTexts, FindWindow(ID_LABEL_PORT),
208 
209  WidgetTools::setLabel(prodeTexts, FindWindow(ID_LABEL_OPERAND),
211 
212  WidgetTools::setLabel(prodeTexts, FindWindow(ID_LABEL_RESOURCE_NAME),
214 
215  // box sizer label
217  WidgetTools::setWidgetLabel(resourceSizer_, fmt.str());
218 
220  WidgetTools::setWidgetLabel(operandSizer_, fmt.str());
221 
223  WidgetTools::setWidgetLabel(usageSizer_, fmt.str());
224 
225  // Create bind list columns.
226  wxListCtrl* bindList =
227  dynamic_cast<wxListCtrl*>(FindWindow(ID_BIND_LIST));
228  fmt = prodeTexts->text(ProDeTextGenerator::TXT_COLUMN_OPERAND);
229  bindList->InsertColumn(0, WxConversion::toWxString(fmt.str()),
230  wxLIST_FORMAT_LEFT, 80);
231  fmt = prodeTexts->text(ProDeTextGenerator::TXT_COLUMN_PORT);
232  bindList->InsertColumn(1, WxConversion::toWxString(fmt.str()),
233  wxLIST_FORMAT_LEFT, 100);
234 }
235 
236 
237 /**
238  * Transfers data from the operation object to the dialog widgets.
239  *
240  * @return true, if the transfer was succesful, false otherwise
241  */
242 bool
244  name_ = WxConversion::toWxString(operation_->name());
245  updateOperandList();
246  updateResourceGrid();
247  updateUsageGrid();
248  return wxDialog::TransferDataToWindow();
249 }
250 
251 
252 /**
253  * Updates the operand bind list.
254  */
255 void
257 
258  ExecutionPipeline* pipeline = operation_->pipeline();
259  for (int cycle = 0; cycle <= pipeline->latency(); cycle++) {
260  // Read operands.
262  pipeline->readOperands(cycle);
263  ExecutionPipeline::OperandSet::const_iterator iter =
264  operands.begin();
265  for (; iter != operands.end(); iter++) {
266  operands_.insert(*iter);
267  }
268  // Written operands.
269  operands = pipeline->writtenOperands(cycle);
270  iter = operands.begin();
271  for (; iter != operands.end(); iter++) {
272  operands_.insert(*iter);
273  }
274  }
275 
276  // Search bound operands.
277  for (int i = 0; i < operation_->parentUnit()->operationPortCount(); i++) {
278  FUPort* port = operation_->parentUnit()->operationPort(i);
279  if (operation_->isBound(*port)) {
280  int operand = operation_->io(*port);
281  operands_.insert(operand);
282  }
283  }
284 
285  // Add operand-port pairs to the operation list.
286  std::set<int>::const_iterator iter = operands_.begin();
287  bindList_->DeleteAllItems();
288  for (; iter != operands_.end(); iter++) {
289  wxString portName = _T("");
290  if (operation_->port(*iter) != NULL) {
291  portName =
292  WxConversion::toWxString(operation_->port(*iter)->name());
293  }
294  bindList_->InsertItem(0, WxConversion::toWxString(*iter));
295  bindList_->SetItem(0, 1, portName);
296  }
297  if (portChoice_->GetCount() > 1) {
298  portChoice_->SetSelection(1);
299  } else {
300  portChoice_->SetSelection(0);
301  }
302  wxListEvent dummy;
303  onOperandSelection(dummy);
304  updateUsageGrid();
305 }
306 
307 
308 /**
309  * Updates the list of pipeline resources.
310  */
311 void
313 
314  int selected = -1;
315 
316  if (resourceGrid_->IsSelection()) {
317  selected = resourceGrid_->GetSelectedRows().Item(0);
318  }
319 
320  if (resourceGrid_->GetNumberCols() > 0) {
321  resourceGrid_->DeleteCols(0, resourceGrid_->GetNumberCols());
322  }
323  if (resourceGrid_->GetNumberRows() > 0) {
324  resourceGrid_->DeleteRows(0, resourceGrid_->GetNumberRows());
325  }
326 
327  ExecutionPipeline* pipeline = operation_->pipeline();
328  FunctionUnit* parent = operation_->parentUnit();
329 
330  resourceGrid_->AppendCols(pipeline->latency() + 50);
331  resourceGrid_->AppendRows(parent->pipelineElementCount());
332 
333  resourceGrid_->EnableEditing(false);
334 
335  // Set column labels (cycle numbers).
336  for (int i = 0; i < pipeline->latency() + 50; i++) {
337  resourceGrid_->SetColLabelValue(i, WxConversion::toWxString(i));
338  resourceGrid_->SetColSize(i, GRID_COLUMN_WIDTH);
339  }
340 
341  // Set row labels (resource names).
342  std::list<string> resources;
343  for (int i = 0; i < parent->pipelineElementCount(); i++) {
344  string label = parent->pipelineElement(i)->name();
345  resources.push_back(label);
346  }
347  resources.sort();
348  int row = 0;
349  std::list<string>::const_iterator iter = resources.begin();
350  for (; iter != resources.end(); iter++) {
351  resourceGrid_->SetRowLabelValue(row, WxConversion::toWxString(*iter));
352  row++;
353  }
354 
355  // add resource uses to the grid
356  for (int cycle = 0; cycle < (pipeline->latency() + 1); cycle++) {
357  row = 0;
358  for (iter = resources.begin(); iter != resources.end(); iter++) {
359  if (pipeline->isResourceUsed((*iter), cycle)) {
360  resourceGrid_->SetCellValue(row, cycle, USE_MARK);
361  }
362  row++;
363  }
364  }
365 
366  // Add resources that are not used
367  newResources_.sort();
368  iter = newResources_.begin();
369  for (; iter != newResources_.end(); iter++) {
370  resourceGrid_->AppendRows();
371  resourceGrid_->SetRowLabelValue(row, WxConversion::toWxString(*iter));
372  row++;
373  }
374 
375  if (selected >= 0) {
376  resourceGrid_->SelectRow(selected);
377  }
378 
379  resourceGrid_->FitInside();
380  updateLatency();
381 }
382 
383 
384 /**
385  * Updates the operand usage grid.
386  *
387  * If a resource is selected in the resource grid, the grid is enabled
388  * for editing and it displays the operand usage only for the selected
389  * resource. If a resource isn't selected, the grid will be disabled,
390  * and it displays summary of the operand use for all resources.
391  */
392 void
394 
395  ExecutionPipeline* pipeline = operation_->pipeline();
396 
397  // Clear grid.
398  if (usageGrid_->GetNumberCols() > 0) {
399  usageGrid_->DeleteCols(0, usageGrid_->GetNumberCols());
400  }
401  if (usageGrid_->GetNumberRows() > 0) {
402  usageGrid_->DeleteRows(0, usageGrid_->GetNumberRows());
403  }
404 
405  usageGrid_->AppendCols(pipeline->latency() + 50);
406  usageGrid_->AppendRows(operands_.size());
407 
408  // Reset row labels to numbers (clear R/W flags).
409  int i = 0;
410  std::set<int>::const_iterator iter = operands_.begin();
411  for (; iter != operands_.end(); iter++) {
412  usageGrid_->SetRowLabelValue(i, WxConversion::toWxString(*iter));
413  i++;
414  }
415 
416  // Update operand uses to the grid
417  for (int cycle = 0; cycle < pipeline->latency() + 50; cycle++) {
418 
419  usageGrid_->SetColSize(cycle, GRID_COLUMN_WIDTH);
420  usageGrid_->SetColLabelValue(
421  cycle, WxConversion::toWxString(cycle));
422 
423  wxColour na = wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE);
424 
425  // Reads
427  pipeline->readOperands(cycle);
428  ExecutionPipeline::OperandSet::const_iterator iter =
429  operands.begin();
430 
431  for (; iter != operands.end(); iter++) {
432  int row = operandRow(*iter);
433  assert(row >= 0);
434  setOperandType(*iter, true);
435  // operand read
436  usageGrid_->SetCellValue(row, cycle, READ_MARK);
437  }
438 
439  // Writes
440  operands = pipeline->writtenOperands(cycle);
441  iter = operands.begin();
442  for (; iter != operands.end(); iter++) {
443  int row = operandRow(*iter);
444  assert(row >= 0);
445  setOperandType(*iter, false);
446  // operand written
447  usageGrid_->SetCellValue(row, cycle, WRITE_MARK);
448  }
449  }
450 
451  usageGrid_->FitInside();
452  updateLatency();
453 }
454 
455 
456 /**
457  * Sets operand row label read/write flag.
458  *
459  * @param operand Operand to set the label to.
460  * @param read True if operand is read, false if written.
461  */
462 void
463 OperationDialog::setOperandType(int operand, bool read) {
464  wxString label = WxConversion::toWxString(operand);
465  label.Append(_T(" ("));
466  if (read) {
467  label.Append(READ_MARK);
468  } else {
469  label.Append(WRITE_MARK);
470  }
471  label.Append(_T(")"));
472  int row = operandRow(operand);
473  assert(row >= 0);
474  usageGrid_->SetRowLabelValue(row , label);
475 }
476 
477 
478 /**
479  * Warns if pipeline resources without usages exist
480  */
481 void
483  ExecutionPipeline* pipeline = operation_->pipeline();
485  for (std::list<string>::const_iterator iter = newResources_.begin();
486  iter != newResources_.end(); iter++) {
487 
488  bool warn = true;
489  for (int cycle = 0; cycle < pipeline->latency(); cycle++) {
490  if (pipeline->isResourceUsed(*iter, cycle)) {
491  warn = false;
492  break;
493  }
494  }
495 
496  if (warn) {
497  format fmt = prodeTexts->text(
499  WarningDialog warning(this, WxConversion::toWxString(fmt.str()
500  + *iter));
501  warning.ShowModal();
502  }
503  }
504 }
505 
506 
507 /**
508  * Returns row nubmer of the operand in the resource usage grid.
509  *
510  * Returns -1 if the operand is not found.
511  *
512  * @param Operand to search.
513  * @return Operand grid row number of the operand.
514  */
515 int
517  int row = 0;
518  std::set<int>::const_iterator iter = operands_.begin();
519  for (; iter != operands_.end(); iter++) {
520  if (*iter == operand) {
521  return row;
522  }
523  row++;
524  }
525  return -1;
526 }
527 
528 /**
529  * Handles the left mouse button event in both grids.
530  *
531  * The event is passed to the grid specific handler.
532  *
533  * @param event The mouse event to handle.
534  */
535 void
536 OperationDialog::onGridLClick(wxGridEvent& event) {
537  if (event.GetId() == ID_RESOURCE_GRID) {
538  onResourceLClick(event);
539  } else if (event.GetId() == ID_OPERAND_GRID) {
540  onOperandLClick(event);
541  }
542 }
543 
544 /**
545  * Handles the right mouse button event in both grids.
546  *
547  * @param event The mouse event to handle.
548  */
549 void
550 OperationDialog::onGridRClick(wxGridEvent& event) {
551  if (event.GetId() == ID_RESOURCE_GRID) {
552  resourceGrid_->ClearSelection();
553  }
554 }
555 
556 
557 /**
558  * Handles left mouse button cliks in the resource grid.
559  *
560  * @param event The mouse event to handle.
561  */
562 void
564 
565  if (event.GetCol() < 0 || event.GetRow() < 0) {
566  return;
567  }
568 
569  ExecutionPipeline* pipeline = operation_->pipeline();
570  int cycle = event.GetCol();
571  string resource = selectedResource();
572 
573  // First click just selects the row.
574  if (selectedResource() != WxConversion::toString(
575  resourceGrid_->GetRowLabelValue(event.GetRow()))) {
576 
577  resourceGrid_->SelectRow(event.GetRow());
578  return;
579  }
580 
581  if (operation_->pipeline()->isResourceUsed(resource, cycle)) {
582  //Try to remove resource use.
583  try {
584  pipeline->removeResourceUse(resource, cycle);
585  } catch (StartTooLate& e) {
587  format fmt = prodeTexts->text(
589  InformationDialog dialog(
590  this, WxConversion::toWxString(fmt.str()));
591  dialog.ShowModal();
592  return;
593  }
594  if (!operation_->parentUnit()->hasPipelineElement(resource)) {
595  newResources_.push_back(resource);
596  }
597  } else {
598  // Try to add resource use.
599  try {
600  pipeline->addResourceUse(resource, cycle, 1);
601  } catch (StartTooLate& e) {
603  format fmt = prodeTexts->text(
605  InformationDialog dialog(
606  this, WxConversion::toWxString(fmt.str()));
607  dialog.ShowModal();
608  return;
609  }
610  ContainerTools::removeValueIfExists(newResources_, resource);
611  }
612  updateResourceGrid();
613  resourceGrid_->SelectRow(event.GetRow());
614 }
615 
616 /**
617  * Handles left mouse button clicks in the operand usage grid.
618  *
619  * @param event The mouse event to handle.
620  */
621 void
622 OperationDialog::onOperandLClick(wxGridEvent& event) {
623 
624  int cycle = event.GetCol();
625 
626  std::set<int>::const_iterator iter = operands_.begin();
627  for (int i = 0; i < event.GetRow(); i++) {
628  assert(iter != operands_.end());
629  iter++;
630  }
631  int operand = *iter;
632  ExecutionPipeline* pipeline = operation_->pipeline();
633 
634 
635  bool read = false;
636  bool written = false;
637 
638  // Check if the operand is already being read.
639  ExecutionPipeline::OperandSet readOperands =
640  pipeline->readOperands(cycle);
641  if (ContainerTools::containsValue(readOperands, operand)) {
642  read = true;
643  }
644  // Check if the operand is already being written.
645  ExecutionPipeline::OperandSet writtenOperands =
646  pipeline->writtenOperands(cycle);
647  if (ContainerTools::containsValue(writtenOperands, operand)) {
648  written = true;
649  }
650 
651  bool toggled = false;
652  if (written == false && read == false) {
653  try {
654  // not used -> read.
655  pipeline->addPortRead(operand, cycle, 1);
656  toggled = true;
657  } catch (StartTooLate& e) {
659  format fmt = prodeTexts->text(
661  InformationDialog dialog(
662  this, WxConversion::toWxString(fmt.str()));
663  dialog.ShowModal();
664  return;
665  } catch (Exception& e) {
666  // do nothing
667  }
668  }
669  if (toggled == false && read == false && written == false) {
670  try {
671  // not used -> written
672  pipeline->addPortWrite(operand, cycle, 1);
673  toggled = true;
674  } catch (Exception& e) {
675  // do nothing
676  }
677  }
678  if (toggled == false && read == true && written == false) {
679  try {
680  // read -> written
681  pipeline->removeOperandUse(operand, cycle);
682  pipeline->addPortWrite(operand, cycle, 1);
683  toggled = true;
684  } catch (StartTooLate& e) {
686  format fmt = prodeTexts->text(
688  InformationDialog dialog(
689  this, WxConversion::toWxString(fmt.str()));
690  dialog.ShowModal();
691  return;
692  } catch (Exception& e) {
693  // do nothing
694  }
695  }
696  if (toggled == false && (read == true || written == true)) {
697  try {
698  // written/read -> not used
699  pipeline->removeOperandUse(operand, cycle);
700  toggled = true;
701  } catch (StartTooLate& e) {
703  format fmt = prodeTexts->text(
705  InformationDialog dialog(
706  this, WxConversion::toWxString(fmt.str()));
707  dialog.ShowModal();
708  return;
709  } catch (Exception& e) {
710  // do nothing
711  }
712  }
713  updateResourceGrid();
714  updateUsageGrid();
715  usageGrid_->MakeCellVisible(event.GetRow(), event.GetCol());
716 }
717 
718 /**
719  * Checks whether name field is empty and disables OK button of the
720  * dialog if it is.
721  */
722 void
723 OperationDialog::onName(wxCommandEvent&) {
724 
725  if (!TransferDataFromWindow()) {
726  assert(false);
727  }
728 
729  // OK-button.
730  wxString trimmedName = name_.Trim(false).Trim(true);
731  if (trimmedName == _T("")) {
732  FindWindow(wxID_OK)->Disable();
733  } else {
734  FindWindow(wxID_OK)->Enable();
735  }
736 
737  // Add resource button.
738  wxString trimmedResourceName = resourceName_.Trim(false).Trim(true);
739  if (trimmedResourceName == _T("")) {
740  FindWindow(ID_ADD_RESOURCE)->Disable();
741  } else {
742  FindWindow(ID_ADD_RESOURCE)->Enable();
743  }
744 }
745 
746 
747 /**
748  * Handles the Add bind button event.
749  *
750  * Adds a bind to the operation according to the number and port selection
751  * widgets.
752  */
753 void
755 
756  int number = numberControl_->GetValue();
757 
758  std::pair<std::set<int>::iterator, bool> result =
759  operands_.insert(number);
760 
761  // Check that the number is not reserved for an operand.
762  if (!result.second) {
764  format fmt = prodeTexts->text(
766  fmt % number;
767  InformationDialog dialog(this, WxConversion::toWxString(fmt.str()));
768  dialog.ShowModal();
769  return;
770  }
771 
772  updateOperandList();
773  numberControl_->SetValue(number + 1);
774 
775 /*
776  } else {
777  }
778 */
779 }
780 
781 
782 /**
783  * Removes the selected bind from the operation.
784  */
785 void
787 
788  ExecutionPipeline* pipeline = operation_->pipeline();
789 
790  string selected = WidgetTools::lcStringSelection(bindList_, 0);
791  if (selected == "") {
792  return;
793  }
794 
795  int operand = Conversion::toInt(selected);
796 
797  // If the selected operand is read or written, a dialog is displayed
798  // that allows user to choose if the operand reads and writes are
799  // also cleared.
800  if (ContainerTools::containsValue(pipeline->readOperands(), operand) ||
801  ContainerTools::containsValue(pipeline->writtenOperands(), operand)) {
802 
804 
805  format msgFmt = prodeTexts->text(
807  msgFmt % operand;
808  ConfirmDialog dialog(this, WxConversion::toWxString(msgFmt.str()));
809 
810  int choice = dialog.ShowModal();
811  if (choice == wxID_YES) {
812  try {
813  for (int c = pipeline->latency() - 1; c >= 0; c--) {
814  pipeline->removeOperandUse(operand, c);
815  }
816  } catch (StartTooLate& e) {
817  format fmt = prodeTexts->text(
819  InformationDialog dialog(
820  this, WxConversion::toWxString(fmt.str()));
821  dialog.ShowModal();
822  return;
823  }
824  } else if (choice != wxID_NO) {
825  return;
826  }
827  }
828 
829  ContainerTools::removeValueIfExists(operands_, operand);
830 
831  FUPort* port = operation_->port(operand);
832  if (port != NULL) {
833  operation_->unbindPort(*port);
834  }
835  updateOperandList();
836 }
837 
838 /**
839  * Event handler for the operand port binding choicer.
840  */
841 void
843 
844  string selected = WidgetTools::lcStringSelection(bindList_, 0);
845  int number = Conversion::toInt(selected);
846 
847  if (portChoice_->GetSelection() > 0) {
848  string portName=
849  WxConversion::toString(portChoice_->GetStringSelection());
850 
851  FUPort* port = operation_->parentUnit()->operationPort(portName);
852  operation_->bindPort(number, *port);
853  } else {
854  FUPort* port = operation_->port(number);
855  if (port != NULL) {
856  operation_->unbindPort(*port);
857  }
858  }
859  updateOperandList();
860 }
861 
862 
863 /**
864  * Handles the bind list item selection events.
865  *
866  * Enables and disables the delete bind button according to the selection.
867  */
868 void
870 
871  portChoice_->Clear();
872  portChoice_->Append(_T("none"));
873 
874  string selected = WidgetTools::lcStringSelection(bindList_, 0);
875 
876  if (selected == "") {
877  FindWindow(ID_DELETE_OPERAND)->Disable();
878  FindWindow(ID_PORT)->Disable();
879  return;
880  } else {
881  int selection = 0;
882  int operand = Conversion::toInt(selected);
883  FindWindow(ID_DELETE_OPERAND)->Enable();
884  FindWindow(ID_PORT)->Enable();
885 
886  // Search bound operands.
887  for (int i = 0; i < operation_->parentUnit()->operationPortCount();
888  i++) {
889 
890  FUPort* port = operation_->parentUnit()->operationPort(i);
891 
892  if (!operation_->isBound(*port)) {
893  portChoice_->Append(WxConversion::toWxString(port->name()));
894  } else if (operation_->io(*port) == operand) {
895  selection = portChoice_->Append(
896  WxConversion::toWxString(port->name()));
897  }
898  }
899  portChoice_->SetSelection(selection);
900  }
901 }
902 
903 
904 /**
905  * Handles the resource list item selection events.
906  *
907  * Enables and disables the edit and delete resource buttons
908  * according to the selection.
909  */
910 void
911 OperationDialog::onResourceSelection(wxGridRangeSelectEvent&) {
912  if (resourceGrid_->IsSelection()) {
913  FindWindow(ID_DELETE_RESOURCE)->Enable();
914  } else {
915  FindWindow(ID_DELETE_RESOURCE)->Disable();
916  }
917  updateUsageGrid();
918 }
919 
920 
921 /**
922  * Returns name of the resource selected in the resource grid.
923  *
924  * If a resource is not selected, an empty string is returned.
925  */
926 string
928  if (!resourceGrid_->IsSelection()) {
929  return "";
930  }
931  // Sometimes GetSelectedRows() returns an empty array even if
932  // IsSelection() returns true.
933  if (resourceGrid_->GetSelectedRows().Count() != 1) {
934  resourceGrid_->ClearSelection();
935  return "";
936  }
937  int row = resourceGrid_->GetSelectedRows().Item(0);
938  return WxConversion::toString(resourceGrid_->GetRowLabelValue(row));
939 }
940 
941 
942 /**
943  * Handles the Add resource button event.
944  *
945  * Opens pipeline resource dialog for adding a new resource to the operation.
946  */
947 void
949 
950  string newName = WxConversion::toString(resourceName_);
951 
952  // Check the name validity.
953  if (!MachineTester::isValidComponentName(newName)) {
955  format message =
957  InformationDialog warning(
958  this, WxConversion::toWxString(message.str()));
959  warning.ShowModal();
960  return;
961  }
962 
963  // Check that the resource name is not reserved.
964  if (operation_->parentUnit()->hasPipelineElement(newName) ||
965  ContainerTools::containsValue(newResources_, newName)) {
966 
968  format message =
970  format component =
972  format functionUnit =
974  message % newName % component.str() % functionUnit.str();
975  component = prodeTexts->text(ProDeTextGenerator::COMP_RESOURCE);
976  message % component.str();
977  WarningDialog warning(this, WxConversion::toWxString(message.str()));
978  warning.ShowModal();
979  return;
980  }
981  newResources_.push_back(newName);
982  updateResourceGrid();
983  dynamic_cast<wxTextCtrl*>(FindWindow(ID_RESOURCE_NAME))->Clear();
984 }
985 
986 
987 /**
988  * Handles the delete resource button event.
989  *
990  * Deletes the selected resource usage from the operation.
991  */
992 void
994 
995  string selected = selectedResource();
996 
997  // Search resource from the unused resources.
998  if (selected == "" ||
999  ContainerTools::removeValueIfExists(newResources_, selected)) {
1000 
1001  updateResourceGrid();
1002  return;
1003  }
1004 
1005  // Remove resource from the operation pipeline.
1006  try {
1007  operation_->pipeline()->removeResourceUse(selected);
1008  } catch (StartTooLate& e) {
1010  format fmt = prodeTexts->text(
1012  InformationDialog dialog(
1013  this, WxConversion::toWxString(fmt.str()));
1014  dialog.ShowModal();
1015  return;
1016  }
1017  updateResourceGrid();
1018 }
1019 
1020 
1021 /**
1022  * Handles the OK-button event.
1023  *
1024  * Updates the operation and closes the dialog.
1025  */
1026 void
1027 OperationDialog::onOK(wxCommandEvent&) {
1028 
1029  TransferDataFromWindow();
1030  string newName =
1031  WxConversion::toString(name_.Trim(true).Trim(false));
1032 
1033  // Check the name validity.
1034  if (!MachineTester::isValidComponentName(newName)) {
1036  format message =
1038  InformationDialog warning(
1039  this, WxConversion::toWxString(message.str()));
1040  warning.ShowModal();
1041  return;
1042  }
1043 
1044  try {
1045  operation_->setName(newName);
1046  } catch (ComponentAlreadyExists& e) {
1047 
1048  // Display an error message indicating that the name is reserved for
1049  // another operation.
1051  format message =
1053  format component =
1055 
1056  format bus = prodeTexts->text(ProDeTextGenerator::COMP_MACHINE);
1057  message % newName % component.str() % bus.str();
1058  component = prodeTexts->text(ProDeTextGenerator::COMP_OPERATION);
1059  message % component.str();
1060 
1061  InformationDialog dialog(
1062  this, WxConversion::toWxString(message.str()));
1063 
1064  dialog.ShowModal();
1065  return;
1066  }
1067 
1068  warnOnResourcesWithoutUsages();
1069 
1070  EndModal(wxID_OK);
1071 }
1072 
1073 /**
1074  * Updates the latency information static text widget.
1075  */
1076 void
1078  wxString latency = WxConversion::toWxString(operation_->latency());
1079  latencyText_->SetLabel(latency);
1080 }
1081 
1082 /**
1083  * Creates the dialog contents.
1084  *
1085  * This function was generated by wxDesigner.
1086  *
1087  * @return Main sizer of the created contents.
1088  * @param parent The dialog window.
1089  * @param call_fit If true, fits the contents inside the dialog.
1090  * @param set_sizer If true, sets the main sizer as dialog contents.
1091  */
1092 wxSizer*
1094  wxWindow *parent, bool call_fit, bool set_sizer) {
1095 
1096  wxFlexGridSizer *item0 = new wxFlexGridSizer( 1, 0, 0 );
1097  item0->AddGrowableCol( 0 );
1098  item0->AddGrowableRow( 0 );
1099 
1100  wxFlexGridSizer *item1 = new wxFlexGridSizer( 2, 0, 0 );
1101  item1->AddGrowableCol( 1 );
1102  item1->AddGrowableRow( 0 );
1103 
1104  wxFlexGridSizer *item2 = new wxFlexGridSizer( 1, 0, 0 );
1105  item2->AddGrowableRow( 1 );
1106 
1107  wxBoxSizer *item3 = new wxBoxSizer( wxHORIZONTAL );
1108 
1109  wxStaticText *item4 = new wxStaticText( parent, ID_LABEL_NAME, wxT("Name:"), wxDefaultPosition, wxDefaultSize, 0 );
1110  item3->Add( item4, 0, wxALIGN_CENTER|wxALL, 5 );
1111 
1112  wxTextCtrl *item5 = new wxTextCtrl( parent, ID_NAME, wxT(""), wxDefaultPosition, wxSize(160,-1), 0 );
1113  item3->Add( item5, 0, wxALIGN_CENTER, 5 );
1114 
1115  item2->Add( item3, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
1116 
1117  wxStaticBox *item7 = new wxStaticBox( parent, -1, wxT("Operands:") );
1118  wxStaticBoxSizer *item6 = new wxStaticBoxSizer( item7, wxHORIZONTAL );
1119  operandSizer_ = item6;
1120 
1121  wxFlexGridSizer *item8 = new wxFlexGridSizer( 1, 0, 0 );
1122  item8->AddGrowableRow( 0 );
1123 
1124  wxListCtrl *item9 = new wxListCtrl( parent, ID_BIND_LIST, wxDefaultPosition, wxSize(200,300), wxLC_REPORT|wxSUNKEN_BORDER );
1125  item8->Add( item9, 0, wxGROW|wxALL, 5 );
1126 
1127  wxBoxSizer *item10 = new wxBoxSizer( wxVERTICAL );
1128 
1129  wxBoxSizer *item11 = new wxBoxSizer( wxHORIZONTAL );
1130 
1131  wxStaticText *item12 = new wxStaticText( parent, ID_LABEL_PORT, wxT("Port:"), wxDefaultPosition, wxDefaultSize, 0 );
1132  item11->Add( item12, 0, wxALL, 5 );
1133 
1134  wxString *strs13 = (wxString*) NULL;
1135  wxChoice *item13 = new wxChoice( parent, ID_PORT, wxDefaultPosition, wxSize(100,-1), 0, strs13, 0 );
1136  item11->Add( item13, 0, wxGROW|wxALL, 5 );
1137 
1138  wxButton *item14 = new wxButton( parent, ID_DELETE_OPERAND, wxT("Delete"), wxDefaultPosition, wxDefaultSize, 0 );
1139  item11->Add( item14, 0, wxALL, 5 );
1140 
1141  item10->Add( item11, 0, wxGROW, 5 );
1142 
1143  wxStaticLine *item15 = new wxStaticLine( parent, ID_LINE, wxDefaultPosition, wxSize(20,-1), wxLI_HORIZONTAL );
1144  item10->Add( item15, 0, wxGROW|wxALL, 5 );
1145 
1146  wxBoxSizer *item16 = new wxBoxSizer( wxHORIZONTAL );
1147 
1148  wxStaticText *item17 = new wxStaticText( parent, ID_LABEL_OPERAND, wxT("New operand:"), wxDefaultPosition, wxDefaultSize, 0 );
1149  item16->Add( item17, 0, wxALL, 5 );
1150 
1151  wxSpinCtrl *item18 = new wxSpinCtrl( parent, ID_NUMBER, wxT("1"), wxDefaultPosition, wxSize(-1,-1), 0, 1, 10000, 1 );
1152  item16->Add( item18, 0, wxGROW|wxALL, 5 );
1153 
1154  wxButton *item19 = new wxButton( parent, ID_ADD_OPERAND, wxT("Add"), wxDefaultPosition, wxDefaultSize, 0 );
1155  item16->Add( item19, 0, wxALL, 5 );
1156 
1157  item10->Add( item16, 0, wxALIGN_CENTER, 5 );
1158 
1159  item8->Add( item10, 0, wxALIGN_CENTER|wxALL, 5 );
1160 
1161  item6->Add( item8, 0, wxGROW, 5 );
1162 
1163  item2->Add( item6, 0, wxGROW, 5 );
1164 
1165  item1->Add( item2, 0, wxGROW|wxALL, 5 );
1166 
1167  wxFlexGridSizer *item20 = new wxFlexGridSizer( 1, 0, 0 );
1168  item20->AddGrowableCol( 0 );
1169  item20->AddGrowableRow( 0 );
1170  item20->AddGrowableRow( 1 );
1171 
1172  wxStaticBox *item22 = new wxStaticBox( parent, -1, wxT("Pipeline Resources:") );
1173  wxStaticBoxSizer *item21 = new wxStaticBoxSizer( item22, wxHORIZONTAL );
1174  resourceSizer_ = item21;
1175 
1176  wxFlexGridSizer *item23 = new wxFlexGridSizer( 1, 0, 0 );
1177  item23->AddGrowableCol( 0 );
1178  item23->AddGrowableRow( 0 );
1179 
1180  wxGrid *item24 = new wxGrid( parent, ID_RESOURCE_GRID, wxDefaultPosition, wxSize(400,200), wxWANTS_CHARS );
1181  item24->CreateGrid( 0, 0, wxGrid::wxGridSelectRows );
1182  item23->Add( item24, 0, wxGROW|wxALL, 5 );
1183 
1184  wxBoxSizer *item25 = new wxBoxSizer( wxHORIZONTAL );
1185 
1186  wxStaticText *item26 = new wxStaticText( parent, ID_LABEL_RESOURCE_NAME, wxT("Name:"), wxDefaultPosition, wxDefaultSize, 0 );
1187  item25->Add( item26, 0, wxALIGN_CENTER|wxALL, 5 );
1188 
1189  wxTextCtrl *item27 = new wxTextCtrl( parent, ID_RESOURCE_NAME, wxT(""), wxDefaultPosition, wxDefaultSize, 0 );
1190  item25->Add( item27, 1, wxALIGN_CENTER|wxALL, 5 );
1191 
1192  wxButton *item28 = new wxButton( parent, ID_ADD_RESOURCE, wxT("Add"), wxDefaultPosition, wxDefaultSize, 0 );
1193  item28->Enable( false );
1194  item25->Add( item28, 0, wxALIGN_CENTER|wxALL, 5 );
1195 
1196  wxButton *item29 = new wxButton( parent, ID_DELETE_RESOURCE, wxT("Delete"), wxDefaultPosition, wxDefaultSize, 0 );
1197  item29->Enable( false );
1198  item25->Add( item29, 0, wxALIGN_CENTER|wxALL, 5 );
1199 
1200  //item25->Add( 30, 20, 0, wxALIGN_CENTER|wxALL, 5 );
1201 
1202  item23->Add( item25, 0, wxGROW|wxALL, 5 );
1203 
1204  item21->Add( item23, 1, wxGROW, 5 );
1205 
1206  item20->Add( item21, 0, wxGROW|wxBOTTOM, 5 );
1207 
1208  wxStaticBox *item33 = new wxStaticBox( parent, -1, wxT("Operand usage:") );
1209  wxStaticBoxSizer *item32 = new wxStaticBoxSizer( item33, wxHORIZONTAL );
1210  usageSizer_ = item32;
1211 
1212  wxGrid *item34 = new wxGrid( parent, ID_OPERAND_GRID, wxDefaultPosition, wxSize(400,200), wxWANTS_CHARS );
1213  item34->CreateGrid( 0, 0, wxGrid::wxGridSelectCells );
1214  item32->Add( item34, 1, wxGROW|wxALL, 5 );
1215 
1216  item20->Add( item32, 0, wxGROW, 5 );
1217 
1218  wxBoxSizer *item35 = new wxBoxSizer( wxHORIZONTAL );
1219 
1220  wxStaticText *item36 = new wxStaticText( parent, ID_LABEL_LATENCY, wxT("Operation latency:"), wxDefaultPosition, wxDefaultSize, 0 );
1221  item35->Add( item36, 0, wxALIGN_CENTER|wxALL, 5 );
1222 
1223  wxStaticText *item37 = new wxStaticText( parent, ID_LATENCY, wxT(" "), wxDefaultPosition, wxDefaultSize, 0 );
1224  item35->Add( item37, 0, wxALIGN_CENTER|wxALL, 5 );
1225 
1226  item20->Add( item35, 0, wxGROW|wxALL, 5 );
1227 
1228  item1->Add( item20, 0, wxGROW, 5 );
1229 
1230  item0->Add( item1, 0, wxGROW|wxALL, 5 );
1231 
1232  wxBoxSizer *item38 = new wxBoxSizer( wxVERTICAL );
1233 
1234  wxStaticLine *item39 = new wxStaticLine( parent, ID_LINE, wxDefaultPosition, wxSize(20,-1), wxLI_HORIZONTAL );
1235  item38->Add( item39, 0, wxGROW|wxALL, 5 );
1236 
1237  wxGridSizer *item40 = new wxGridSizer( 2, 0, 0 );
1238 
1239  wxButton *item41 = new wxButton( parent, ID_HELP, wxT("&Help"), wxDefaultPosition, wxDefaultSize, 0 );
1240  item40->Add( item41, 0, wxALL, 5 );
1241 
1242  wxBoxSizer *item42 = new wxBoxSizer( wxHORIZONTAL );
1243 
1244  wxButton *item43 = new wxButton( parent, wxID_OK, wxT("&OK"), wxDefaultPosition, wxDefaultSize, 0 );
1245  item42->Add( item43, 0, wxALIGN_CENTER|wxALL, 5 );
1246 
1247  wxButton *item44 = new wxButton( parent, wxID_CANCEL, wxT("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
1248  item42->Add( item44, 0, wxALIGN_CENTER|wxALL, 5 );
1249 
1250  item40->Add( item42, 0, 0, 5 );
1251 
1252  item38->Add( item40, 0, wxGROW, 5 );
1253 
1254  item0->Add( item38, 0, wxGROW, 5 );
1255 
1256  if (set_sizer) {
1257  parent->SetSizer( item0 );
1258  if (call_fit) {
1259  item0->SetSizeHints( parent );
1260  }
1261  }
1262 
1263  return item0;
1264 }
WarningDialog
Definition: WarningDialog.hh:42
WxConversion::toWxString
static wxString toWxString(const std::string &source)
TTAMachine::HWOperation
Definition: HWOperation.hh:52
ExecutionPipeline.hh
OperationDialog::updateResourceGrid
void updateResourceGrid()
Definition: OperationDialog.cc:312
TTAMachine::BaseFUPort::parentUnit
FunctionUnit * parentUnit() const
Definition: BaseFUPort.cc:96
ProDeTextGenerator::MSG_WARN_RES_WITHOUT_USAGES
@ MSG_WARN_RES_WITHOUT_USAGES
Warning: Resources without usages.
Definition: ProDeTextGenerator.hh:248
ProDeTextGenerator::MSG_ERROR_OPERAND_NUM_RESERVED
@ MSG_ERROR_OPERAND_NUM_RESERVED
Error: Operand number reserved.
Definition: ProDeTextGenerator.hh:236
WidgetTools::setLabel
static void setLabel(Texts::TextGenerator *generator, wxWindow *widget, int textID)
Definition: WidgetTools.cc:92
GUITextGenerator::instance
static GUITextGenerator * instance()
Definition: GUITextGenerator.cc:67
ProDeTextGenerator::MSG_ERROR_PIPELINE_START
@ MSG_ERROR_PIPELINE_START
Error: Pipeline usage start late.
Definition: ProDeTextGenerator.hh:239
OperationDialog::onOperandLClick
void onOperandLClick(wxGridEvent &event)
Definition: OperationDialog.cc:622
OperationDialog::onAddResource
void onAddResource(wxCommandEvent &event)
Definition: OperationDialog.cc:948
GUITextGenerator
Definition: GUITextGenerator.hh:46
GUITextGenerator::TXT_BUTTON_HELP
@ TXT_BUTTON_HELP
Label for help button.
Definition: GUITextGenerator.hh:60
TTAMachine::ExecutionPipeline::removeResourceUse
void removeResourceUse(const std::string &name)
Definition: ExecutionPipeline.cc:189
WidgetTools.hh
FindWindow
Definition: FindWindow.hh:49
OperationDialog::updateUsageGrid
void updateUsageGrid()
Definition: OperationDialog.cc:393
TTAMachine::ExecutionPipeline::writtenOperands
OperandSet writtenOperands(int cycle) const
Definition: ExecutionPipeline.cc:429
TTAMachine::PipelineElement::name
const std::string & name() const
ProDeConstants::WHITE_COLOR
static const wxColour WHITE_COLOR
Definition: ProDeConstants.hh:50
Texts::TextGenerator::text
virtual boost::format text(int textId)
Definition: TextGenerator.cc:94
TTAMachine::ExecutionPipeline::readOperands
OperandSet readOperands(int cycle) const
Definition: ExecutionPipeline.cc:408
ProDeTextGenerator::COMP_OPERATION
@ COMP_OPERATION
Name for operation (w/o article).
Definition: ProDeTextGenerator.hh:258
OperationDialog::initialize
void initialize()
Definition: OperationDialog.cc:128
OperationDialog::USE_MARK
static const wxString USE_MARK
Grid marker for resource use.
Definition: OperationDialog.hh:121
ProDeTextGenerator.hh
ProDeTextGenerator
Definition: ProDeTextGenerator.hh:49
ProDeTextGenerator::MSG_ERROR_ILLEGAL_NAME
@ MSG_ERROR_ILLEGAL_NAME
Error: Illegal component name.
Definition: ProDeTextGenerator.hh:223
OperationDialog::onOK
void onOK(wxCommandEvent &event)
Definition: OperationDialog.cc:1027
ProDeTextGenerator::MSG_ERROR_SAME_NAME
@ MSG_ERROR_SAME_NAME
Error: Same name exists.
Definition: ProDeTextGenerator.hh:229
ProDeTextGenerator::COMP_FUNCTION_UNIT
@ COMP_FUNCTION_UNIT
Name for FU (w/o article).
Definition: ProDeTextGenerator.hh:263
assert
#define assert(condition)
Definition: Application.hh:86
TTAMachine::FunctionUnit
Definition: FunctionUnit.hh:55
ProDeTextGenerator::COMP_A_RESOURCE
@ COMP_A_RESOURCE
Name for resource (w/ article).
Definition: ProDeTextGenerator.hh:262
ProDeTextGenerator::COMP_RESOURCE
@ COMP_RESOURCE
Name for resource (w/o article).
Definition: ProDeTextGenerator.hh:261
TTAMachine::FUPort
Definition: FUPort.hh:46
OperationDialog::createContents
wxSizer * createContents(wxWindow *parent, bool call_fit, bool set_sizer)
Definition: OperationDialog.cc:1093
OperationDialog::WRITE_MARK
static const wxString WRITE_MARK
Grid marker for a write.
Definition: OperationDialog.hh:125
GUITextGenerator::TXT_BUTTON_CANCEL
@ TXT_BUTTON_CANCEL
Label for cancel button.
Definition: GUITextGenerator.hh:55
TTAMachine::ExecutionPipeline::addResourceUse
void addResourceUse(const std::string &name, int start, int duration)
Definition: ExecutionPipeline.cc:112
OperationDialog::selectedResource
std::string selectedResource()
Definition: OperationDialog.cc:927
HWOperation.hh
OperationDialog.hh
WarningDialog.hh
TTAMachine::FunctionUnit::pipelineElement
virtual PipelineElement * pipelineElement(int index) const
Definition: FunctionUnit.cc:523
ProDeTextGenerator::TXT_LABEL_PORT
@ TXT_LABEL_PORT
Label for port widget.
Definition: ProDeTextGenerator.hh:75
ProDeTextGenerator::TXT_OPERATION_OPERANDS_BOX
@ TXT_OPERATION_OPERANDS_BOX
Operands box title.
Definition: ProDeTextGenerator.hh:186
Conversion.hh
ContainerTools::removeValueIfExists
static bool removeValueIfExists(ContainerType &aContainer, const ElementType &aKey)
OperationDialog::setOperandType
void setOperandType(int operand, bool read)
Definition: OperationDialog.cc:463
ProDeTextGenerator::TXT_COLUMN_PORT
@ TXT_COLUMN_PORT
Label for port column in a list.
Definition: ProDeTextGenerator.hh:114
dummy
SimValue dummy(32)
a dummy simvalue which is given for operands that are not bound
InformationDialog.hh
ConfirmDialog.hh
WidgetTools::lcStringSelection
static std::string lcStringSelection(wxListCtrl *list, int column)
Definition: WidgetTools.cc:108
TTAMachine::ExecutionPipeline::addPortRead
void addPortRead(int operand, int start, int duration)
Definition: ExecutionPipeline.cc:141
GUITextGenerator::TXT_BUTTON_ADD
@ TXT_BUTTON_ADD
Label for an add button.
Definition: GUITextGenerator.hh:53
ProDeTextGenerator::TXT_LABEL_NAME
@ TXT_LABEL_NAME
Label for component name widget.
Definition: ProDeTextGenerator.hh:56
Exception
Definition: Exception.hh:54
ProDeTextGenerator::TXT_OPERATION_USAGE_BOX
@ TXT_OPERATION_USAGE_BOX
Pipeline usage box title.
Definition: ProDeTextGenerator.hh:184
MachineTester::isValidComponentName
static bool isValidComponentName(const std::string &name)
Definition: MachineTester.cc:312
TTAMachine::ExecutionPipeline::OperandSet
std::set< int > OperandSet
Set for operand indexes.
Definition: ExecutionPipeline.hh:58
EVT_LIST_ITEM_SELECTED
FUImplementationDialog::onAddExternalPort FUImplementationDialog::onDeleteExternalPort FUImplementationDialog::onArchPortSelection FUImplementationDialog::onArchPortActivation EVT_LIST_ITEM_SELECTED(ID_EXTERNAL_PORT_LIST, FUImplementationDialog::onExternalPortSelection) EVT_LIST_ITEM_ACTIVATED(ID_EXTERNAL_PORT_LIST
ConfirmDialog
Definition: ConfirmDialog.hh:41
GUITextGenerator::TXT_BUTTON_DELETE
@ TXT_BUTTON_DELETE
Label for delete button.
Definition: GUITextGenerator.hh:56
TTAMachine::FunctionUnit::pipelineElementCount
virtual int pipelineElementCount() const
Definition: FunctionUnit.cc:507
OperationDialog::onBindOperand
void onBindOperand(wxCommandEvent &event)
Definition: OperationDialog.cc:842
ProDeConstants.hh
GUITextGenerator.hh
StartTooLate
Definition: Exception.hh:710
MachineTester.hh
ProDeTextGenerator::COMP_AN_OPERATION
@ COMP_AN_OPERATION
Name for operation (w/ article).
Definition: ProDeTextGenerator.hh:257
OperationDialog::updateLatency
void updateLatency()
Definition: OperationDialog.cc:1077
ProDeTextGenerator::instance
static ProDeTextGenerator * instance()
Definition: ProDeTextGenerator.cc:382
ProDeTextGenerator::TXT_COLUMN_OPERAND
@ TXT_COLUMN_OPERAND
Label for operand column.
Definition: ProDeTextGenerator.hh:118
OperationDialog::onOperandSelection
void onOperandSelection(wxListEvent &event)
Definition: OperationDialog.cc:869
ProDeTextGenerator::TXT_OPERATION_RESOURCES_BOX
@ TXT_OPERATION_RESOURCES_BOX
Pipeline resources box title.
Definition: ProDeTextGenerator.hh:185
EVT_LIST_ITEM_DESELECTED
FUImplementationDialog::onAddExternalPort FUImplementationDialog::onDeleteExternalPort FUImplementationDialog::onArchPortSelection EVT_LIST_ITEM_DESELECTED(ID_ARCH_PORT_LIST, FUImplementationDialog::onArchPortSelection) EVT_LIST_ITEM_ACTIVATED(ID_ARCH_PORT_LIST
EVT_BUTTON
EVT_BUTTON(ID_EDIT_ARCH_PORT, FUImplementationDialog::onEditArchitecturePort) EVT_BUTTON(ID_ADD_EXTERNAL_PORT
ProDeTextGenerator::TXT_LABEL_OPERAND
@ TXT_LABEL_OPERAND
Label for operand widget.
Definition: ProDeTextGenerator.hh:76
OperationDialog::READ_MARK
static const wxString READ_MARK
Grid marker for a read.
Definition: OperationDialog.hh:123
ProDeTextGenerator::MSG_CONFIRM_OPERAND_DELETION
@ MSG_CONFIRM_OPERAND_DELETION
Confirm: operand deletion.
Definition: ProDeTextGenerator.hh:250
OperationDialog::onDeleteResource
void onDeleteResource(wxCommandEvent &event)
Definition: OperationDialog.cc:993
OperationDialog::onGridRClick
void onGridRClick(wxGridEvent &event)
Definition: OperationDialog.cc:550
OperationDialog::~OperationDialog
~OperationDialog()
Definition: OperationDialog.cc:120
TTAMachine::Port::name
virtual std::string name() const
Definition: Port.cc:141
ProDeTextGenerator::TXT_OPERATION_DIALOG_TITLE
@ TXT_OPERATION_DIALOG_TITLE
Operation dialog title.
Definition: ProDeTextGenerator.hh:183
FUPort.hh
TTAMachine::ExecutionPipeline::removeOperandUse
void removeOperandUse(int operand, int cycle)
Definition: ExecutionPipeline.cc:272
OperationDialog::TransferDataToWindow
bool TransferDataToWindow()
Definition: OperationDialog.cc:243
PipelineElement.hh
OperationDialog::onAddOperand
void onAddOperand(wxCommandEvent &event)
Definition: OperationDialog.cc:754
ComponentAlreadyExists
Definition: Exception.hh:510
OperationDialog::warnOnResourcesWithoutUsages
void warnOnResourcesWithoutUsages()
Definition: OperationDialog.cc:482
TTAMachine::ExecutionPipeline
Definition: ExecutionPipeline.hh:55
OperationDialog::GRID_COLUMN_WIDTH
static const int GRID_COLUMN_WIDTH
Width of the resource and operand usage grid columns.
Definition: OperationDialog.hh:119
OperationDialog::setTexts
void setTexts()
Definition: OperationDialog.cc:170
OperationDialog::onDeleteOperand
void onDeleteOperand(wxCommandEvent &event)
Definition: OperationDialog.cc:786
ProDeTextGenerator::COMP_MACHINE
@ COMP_MACHINE
Text for machine description.
Definition: ProDeTextGenerator.hh:252
ContainerTools::containsValue
static bool containsValue(const ContainerType &aContainer, const ElementType &aKey)
TTAMachine::ExecutionPipeline::addPortWrite
void addPortWrite(int operand, int start, int duration)
Definition: ExecutionPipeline.cc:167
WxConversion.hh
WidgetTools::setWidgetLabel
static void setWidgetLabel(wxWindow *widget, std::string text)
Definition: WidgetTools.cc:52
Conversion::toInt
static int toInt(const T &source)
InformationDialog
Definition: InformationDialog.hh:42
OperationDialog::operandRow
int operandRow(int operand)
Definition: OperationDialog.cc:516
TTAMachine::FunctionUnit::operationPort
virtual FUPort * operationPort(const std::string &name) const
Definition: FunctionUnit.cc:224
TTAMachine
Definition: Assembler.hh:48
OperationDialog::onName
void onName(wxCommandEvent &event)
Definition: OperationDialog.cc:723
TTAMachine::ExecutionPipeline::latency
int latency() const
Definition: ExecutionPipeline.cc:482
WxConversion::toString
static std::string toString(const wxString &source)
OperationDialog::updateOperandList
void updateOperandList()
Definition: OperationDialog.cc:256
OperationDialog::onResourceLClick
void onResourceLClick(wxGridEvent &event)
Definition: OperationDialog.cc:563
OperationDialog::onGridLClick
void onGridLClick(wxGridEvent &event)
Definition: OperationDialog.cc:536
END_EVENT_TABLE
END_EVENT_TABLE() using namespace IDF
OperationDialog
Definition: OperationDialog.hh:49
OperationDialog::onResourceSelection
void onResourceSelection(wxGridRangeSelectEvent &event)
Definition: OperationDialog.cc:911
ProDeConstants::BLACK_COLOR
static const wxColour BLACK_COLOR
Definition: ProDeConstants.hh:49
TTAMachine::ExecutionPipeline::isResourceUsed
bool isResourceUsed(const std::string &name, int cycle) const
Definition: ExecutionPipeline.cc:300
FunctionUnit.hh
ContainerTools.hh
GUITextGenerator::TXT_BUTTON_OK
@ TXT_BUTTON_OK
Label for OK button.
Definition: GUITextGenerator.hh:59