OpenASIP  2.0
ProcessorImplementationWindow.cc
Go to the documentation of this file.
1 /*
2  Copyright (c) 2002-2021 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 ProcessorImplementationWindow.cc
26  *
27  * Implementation of ProcessorImplementationWindow class.
28  *
29  * @author Veli-Pekka Jääskeläinen 2006 (vjaaskel-no.spam-cs.tut.fi)
30  * @author Pekka Jääskeläinen 2021
31  * @note rating: red
32  */
33 
34 #include <wx/wx.h>
35 #include <wx/listctrl.h>
36 #include <wx/statline.h>
37 #include <wx/notebook.h>
38 #include <wx/docview.h>
39 
41 #include "IDFSerializer.hh"
42 #include "MachineImplementation.hh"
43 #include "Conversion.hh"
44 #include "WxConversion.hh"
45 #include "IDFValidator.hh"
46 #include "ErrorDialog.hh"
47 #include "WarningDialog.hh"
48 #include "Machine.hh"
50 #include "RegisterFile.hh"
51 #include "FunctionUnit.hh"
53 #include "Environment.hh"
54 #include "BinaryEncoding.hh"
55 #include "BEMGenerator.hh"
56 #include "FileSystem.hh"
58 #include "ProDe.hh"
59 #include "ObjectState.hh"
61 
62 #if wxCHECK_VERSION(3, 0, 0)
63  #define wxSAVE wxFD_SAVE
64  #define wxOVERWRITE_PROMPT wxFD_OVERWRITE_PROMPT
65  #define wxOPEN wxFD_OPEN
66  #define wxFILE_MUST_EXIST wxFD_FILE_MUST_EXIST
67 #endif
68 
69 using namespace IDF;
70 using namespace TTAMachine;
71 using namespace ProGe;
72 using std::vector;
73 using std::string;
74 
75 BEGIN_EVENT_TABLE(ProcessorImplementationWindow, wxDialog)
80 
81  EVT_LIST_ITEM_FOCUSED(ID_RF_LIST, ProcessorImplementationWindow::onRFSelection)
82  EVT_LIST_DELETE_ITEM(ID_RF_LIST, ProcessorImplementationWindow::onRFSelection)
86 
87  EVT_LIST_ITEM_FOCUSED(ID_IU_LIST, ProcessorImplementationWindow::onIUSelection)
88  EVT_LIST_DELETE_ITEM(ID_IU_LIST, ProcessorImplementationWindow::onIUSelection)
92 
93  EVT_LIST_ITEM_FOCUSED(ID_FU_LIST, ProcessorImplementationWindow::onFUSelection)
94  EVT_LIST_DELETE_ITEM(ID_FU_LIST, ProcessorImplementationWindow::onFUSelection)
98 
99  EVT_LIST_ITEM_FOCUSED(ID_PARAMETER_LIST, ProcessorImplementationWindow::onParameterSelection)
100  EVT_LIST_DELETE_ITEM(ID_PARAMETER_LIST, ProcessorImplementationWindow::onParameterSelection)
103 
104 
114 
115 
116 /**
117  * Constructor.
118  *
119  * @param parent Parent window of the page.
120  * @param machine Processor architecture.
121  * @param impl Processor implementation definition.
122  */
124  wxWindow* parent, TTAMachine::Machine& machine,
125  IDF::MachineImplementation& impl):
126  wxDialog(parent, -1, _T("Processor Implementation"),
127  wxDefaultPosition, wxDefaultSize,
128  wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER),
129  machine_(machine), impl_(impl), plugin_(NULL), dirtyData_(false) {
130 
131  createContents(this, true, true);
132  SetMinSize(wxSize(600, 500));
133 
134  // Plugin name is always fixed, thus disable editing
135  dynamic_cast<wxTextCtrl*>(FindWindow(ID_IC_DEC_PLUGIN_NAME))->
136  Enable(false);
137 
138  fuList_ = dynamic_cast<wxListCtrl*>(FindWindow(ID_FU_LIST));
139  rfList_ = dynamic_cast<wxListCtrl*>(FindWindow(ID_RF_LIST));
140  iuList_ = dynamic_cast<wxListCtrl*>(FindWindow(ID_IU_LIST));
141  parameterList_ = dynamic_cast<wxListCtrl*>(FindWindow(ID_PARAMETER_LIST));
142 
143  // Add FU and RF list columns.
144  fuList_->InsertColumn(0, _T("FU"), wxLIST_FORMAT_LEFT, 150);
145  fuList_->InsertColumn(1, _T("ID"), wxLIST_FORMAT_LEFT, 40);
146  fuList_->InsertColumn(2, _T("HDB"), wxLIST_FORMAT_LEFT, 400);
147 
148  rfList_->InsertColumn(0, _T("RF"), wxLIST_FORMAT_LEFT, 150);
149  rfList_->InsertColumn(1, _T("ID"), wxLIST_FORMAT_LEFT, 40);
150  rfList_->InsertColumn(2, _T("HDB"), wxLIST_FORMAT_LEFT, 400);
151 
152  iuList_->InsertColumn(0, _T("IU"), wxLIST_FORMAT_LEFT, 150);
153  iuList_->InsertColumn(1, _T("ID"), wxLIST_FORMAT_LEFT, 40);
154  iuList_->InsertColumn(2, _T("HDB"), wxLIST_FORMAT_LEFT, 400);
155 
156  parameterList_->InsertColumn(0, _T("Name"), wxLIST_FORMAT_LEFT, 150);
157  parameterList_->InsertColumn(1, _T("Value"), wxLIST_FORMAT_LEFT, 100);
158  parameterList_->InsertColumn(
159  2, _T("Description"), wxLIST_FORMAT_LEFT, 300);
160 
161  // Disable conditional buttons by default.
162  FindWindow(ID_SELECT_RF_IMPL)->Disable();
163  FindWindow(ID_SELECT_IU_IMPL)->Disable();
164  FindWindow(ID_SELECT_FU_IMPL)->Disable();
165  FindWindow(ID_SET_VALUE)->Disable();
166 
167  // Load default plugin
168  std::string pluginFile = Environment::defaultICDecoderPlugin();
169  std::string pluginName = FileSystem::fileNameBody(pluginFile);
170  assert(pluginName.length() > 6);
171  pluginName = pluginName.substr(0, pluginName.length() - 6);
172 
173  loadICDecoderPlugin(pluginName, pluginFile);
174 
175 }
176 
177 
178 /**
179  * Destructor.
180  */
182 }
183 
184 /**
185  * Transfers data from the current MachineImplementation object to the
186  * dialog widgets.
187  */
188 bool
190 
191  updateImplementationLists();
192  parameterList_->DeleteAllItems();
193 
194  if (impl_.hasICDecoderPluginFile()) {
195  try {
196  dynamic_cast<wxTextCtrl*>(FindWindow(ID_IC_DEC_PLUGIN_FILE))->
197  SetValue(WxConversion::toWxString(impl_.icDecoderPluginFile()));
198  } catch (FileNotFound& e) {
199  dynamic_cast<wxTextCtrl*>(FindWindow(ID_IC_DEC_PLUGIN_FILE))->
200  SetValue(WxConversion::toWxString("File not found"));
201  }
202  }
203 
204  if (impl_.hasICDecoderPluginName()) {
205  dynamic_cast<wxTextCtrl*>(FindWindow(ID_IC_DEC_PLUGIN_NAME))->
206  SetValue(WxConversion::toWxString(impl_.icDecoderPluginName()));
207  }
208 
209  if (impl_.hasICDecoderHDB()) {
210  try {
211  dynamic_cast<wxTextCtrl*>(FindWindow(ID_IC_DEC_HDB_FILE))->
212  SetValue(WxConversion::toWxString(impl_.icDecoderHDB()));
213  } catch (FileNotFound& e) {
214  dynamic_cast<wxTextCtrl*>(FindWindow(ID_IC_DEC_HDB_FILE))->
215  SetValue(WxConversion::toWxString("File not found"));
216  }
217  }
218 
219 
220  wxTextCtrl* descCtrl = dynamic_cast<wxTextCtrl*>(
221  FindWindow(ID_IC_DEC_PLUGIN_DESC));
222 
223  // Set IC&decoder generator plugin attributes.
224  if (plugin_ != NULL) {
225 
226  descCtrl->SetValue(
227  WxConversion::toWxString(plugin_->pluginDescription()));
228 
229  // IC / Decoder plugin parameters.
230  for (int i = 0; i < plugin_->recognizedParameterCount(); i++) {
231  string paramName = plugin_->recognizedParameter(i);
232  string paramValue =
233  impl_.icDecoderParameterValue(plugin_->recognizedParameter(i));
234  string paramDesc = plugin_->parameterDescription(paramName);
235  parameterList_->InsertItem(i, WxConversion::toWxString(paramName));
236  parameterList_->SetItem(
237  i, 1, WxConversion::toWxString(paramValue));
238  parameterList_->SetItem(
239  i, 2, WxConversion::toWxString(paramDesc));
240  }
241  parameterList_->SetColumnWidth(2, wxLIST_AUTOSIZE);
242  } else {
243  descCtrl->SetValue(_T("\n No IC / Decoder plugin loaded."));
244  }
245 
246  if (impl_.hasDecompressorFile()) {
247  try {
248  dynamic_cast<wxTextCtrl*>(FindWindow(ID_DECOMPRESSOR_PATH))->
249  SetValue(WxConversion::toWxString(impl_.decompressorFile()));
250  } catch (FileNotFound& e) {
251  wxString message =
252  _T("Unable to set decompressor block file:\n");
253 
254  WarningDialog dialog(this, message);
255  dialog.ShowModal();
256  }
257  }
258 
259  return true;
260 }
261 
262 /**
263  * Update the list of FU implementations for single RF
264  */
265 void
266 ProcessorImplementationWindow::updateRFList(const std::string& rfName, int index) {
267  const RFImplementationLocation rfImpl =
268  impl_.rfImplementation(rfName);
269 
270  string hdb;
271  int id = 0;
272  try {
273  hdb = Environment::shortHDBPath(rfImpl.hdbFile());
274  id = rfImpl.id();
275  } catch (FileNotFound& e) {
276  hdb = "Warning: " + e.errorMessage();
277  }
278  rfList_->SetItem(index, 1, WxConversion::toWxString(id));
279  rfList_->SetItem(index, 2, WxConversion::toWxString(hdb));
280 }
281 
282 
283 
284 /**
285  * Event handler for the automatic implementation selection button.
286  */
287 void
289  AutoSelectImplementationsDialog dialog(this, machine_, impl_);
290  dialog.ShowModal();
291  updateImplementationLists();
292 }
293 
294 /**
295  * Updates the list views on RF, IU and FU pages.
296  */
297 void
299  fuList_->DeleteAllItems();
300  rfList_->DeleteAllItems();
301  iuList_->DeleteAllItems();
302 
303  // FU implementation list.
305  machine_.functionUnitNavigator();
306 
307  for (int i = 0; i < fuNav.count(); i++) {
308  string fuName = fuNav.item(i)->name();
309  fuList_->InsertItem(i, WxConversion::toWxString(fuName));
310  if (impl_.hasFUImplementation(fuName)) {
311  const FUImplementationLocation fuImpl =
312  impl_.fuImplementation(fuName);
313 
314  string hdb;
315  int id = 0;
316  try {
317  hdb = Environment::shortHDBPath(fuImpl.hdbFile());
318  id = fuImpl.id();
319  } catch (FileNotFound& e) {
320  hdb = "Warning: " + e.errorMessage();
321  }
322 
323  fuList_->SetItem(i, 1, WxConversion::toWxString(id));
324  fuList_->SetItem(i, 2, WxConversion::toWxString(hdb));
325  }
326  }
327 
328  // RF implementation list.
329  const Machine::RegisterFileNavigator rfNav =
330  machine_.registerFileNavigator();
331 
332  for (int i = 0; i < rfNav.count(); i++) {
333  string rfName = rfNav.item(i)->name();
334  rfList_->InsertItem(i, WxConversion::toWxString(rfName));
335  if (impl_.hasRFImplementation(rfName)) {
336  const RFImplementationLocation rfImpl =
337  impl_.rfImplementation(rfName);
338 
339  string hdb;
340  int id = 0;
341  try {
342  hdb = Environment::shortHDBPath(rfImpl.hdbFile());
343  id = rfImpl.id();
344  } catch (FileNotFound& e) {
345  hdb = "Warning: " + e.errorMessage();
346  }
347  rfList_->SetItem(i, 1, WxConversion::toWxString(id));
348  rfList_->SetItem(i, 2, WxConversion::toWxString(hdb));
349  }
350  }
351 
352  // IU implementation list.
353  const Machine::ImmediateUnitNavigator iuNav =
354  machine_.immediateUnitNavigator();
355 
356  for (int i = 0; i < iuNav.count(); i++) {
357  string iuName = iuNav.item(i)->name();
358  iuList_->InsertItem(i, WxConversion::toWxString(iuName));
359  if (impl_.hasIUImplementation(iuName)) {
360  const RFImplementationLocation iuImpl =
361  impl_.iuImplementation(iuName);
362 
363  string hdb;
364  int id = 0;
365  try {
366  hdb = Environment::shortHDBPath(iuImpl.hdbFile());
367  id = iuImpl.id();
368  } catch (FileNotFound& e) {
369  hdb = "Warning: " + e.errorMessage();
370  }
371  iuList_->SetItem(i, 1, WxConversion::toWxString(id));
372  iuList_->SetItem(i, 2, WxConversion::toWxString(hdb));
373  }
374  }
375 }
376 
377 /**
378  * Call the dialog to select RF implementation and handle the return values
379  * of the dialog.
380  */
382 
383  const RegisterFile& rf = *machine_.registerFileNavigator().item(item);
384  if (impl_.hasRFImplementation(rf.name())) {
386  this, rf, impl_.rfImplementation(rf.name()));
387 
388  if (dialog.ShowModal() == wxID_OK) {
389  setDirty();
390  updateRFList(rf.name(), item);
391  }
392  } else {
393  UnitImplementationLocation* location =
394  new RFImplementationLocation("", -1, rf.name());
395 
396  BlockImplementationDialog dialog(this, rf, *location);
397  if (dialog.ShowModal() == wxID_OK) {
398  impl_.addRFImplementation(location);
399  setDirty();
400  updateRFList(rf.name(), item);
401  } else {
402  delete location;
403  }
404  }
405 }
406 
407 
408 /**
409  * Event handler for the RF Select implementation button.
410  */
411 void
413  long item = -1;
414  item = rfList_->GetNextItem(
415  item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
416 
417  if (item == -1) {
418  // No rf selected.
419  return;
420  }
421 
422  handleSelectRFImplementation(item);
423 }
424 
425 /**
426  * Event handler for the RF Select implementation button.
427  */
428 void
430  handleSelectRFImplementation(e.GetIndex());
431 }
432 
433 
435 
436  const ImmediateUnit& iu = *machine_.immediateUnitNavigator().item(item);
437  if (impl_.hasIUImplementation(iu.name())) {
439  this, iu, impl_.iuImplementation(iu.name()));
440 
441  if (dialog.ShowModal() == wxID_OK) {
442  setDirty();
443  }
444  } else {
445  UnitImplementationLocation* location =
446  new RFImplementationLocation("", -1, iu.name());
447 
448  BlockImplementationDialog dialog(this, iu, *location);
449  if (dialog.ShowModal() == wxID_OK) {
450  impl_.addIUImplementation(location);
451  setDirty();
452  } else {
453  delete location;
454  }
455  }
456  TransferDataToWindow();
457 }
458 
459 
460 /**
461  * Event handler for the IU Select implementation button.
462  */
463 void
465  long item = -1;
466  item = iuList_->GetNextItem(
467  item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
468 
469  if (item == -1) {
470  // No iu selected.
471  return;
472  }
473 
474  handleSelectIUImplementation(item);
475 }
476 
477 /**
478  * Event handler for the IU Select implementation doubleclick.
479  */
480 void
482  handleSelectIUImplementation(e.GetIndex());
483 }
484 
485 /**
486  * Update the list of FU implementations for single FU
487  */
488 void ProcessorImplementationWindow::updateFUList(const std::string& fuName, int index) {
489  const FUImplementationLocation fuImpl =
490  impl_.fuImplementation(fuName);
491 
492  string hdb;
493  int id = 0;
494  try {
495  hdb = Environment::shortHDBPath(fuImpl.hdbFile());
496  id = fuImpl.id();
497  } catch (FileNotFound& e) {
498  hdb = "Warning: " + e.errorMessage();
499  }
500 
501  fuList_->SetItem(index, 1, WxConversion::toWxString(id));
502  fuList_->SetItem(index, 2, WxConversion::toWxString(hdb));
503 }
504 
505 /**
506  * Handle calling of the implementation selection dialog and it's return value
507  */
509 
510  const FunctionUnit& fu = *machine_.functionUnitNavigator().item(item);
511 
512  if (impl_.hasFUImplementation(fu.name())) {
514  this, fu, impl_.fuImplementation(fu.name()));
515 
516  if (dialog.ShowModal() == wxID_OK) {
517  setDirty();
518  updateFUList(fu.name(), item);
519  }
520  } else {
521  UnitImplementationLocation* location =
522  new FUImplementationLocation("", -1, fu.name());
523 
524  BlockImplementationDialog dialog(this, fu, *location);
525  if (dialog.ShowModal() == wxID_OK) {
526  impl_.addFUImplementation(location);
527  setDirty();
528  updateFUList(fu.name(), item);
529  } else {
530  delete location;
531  }
532  }
533 }
534 
535 
536 /**
537  * Event handler for the FU Select implementation button.
538  */
539 void
541  long item = -1;
542  item = fuList_->GetNextItem(
543  item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
544 
545  if (item == -1) {
546  // No fu selected.
547  return;
548  }
549 
550  handleSelectFUImplementation(item);
551 }
552 
553 /**
554  * Event handler for the FU Select implementation doubleclick.
555  */
556 void
558  handleSelectFUImplementation(e.GetIndex());
559 }
560 
561 /**
562  * Event handler for the RF list selection changes.
563  *
564  * Enables and disables the select RF implementation button.
565  */
566 void
568  if (rfList_->GetSelectedItemCount() == 1) {
569  FindWindow(ID_SELECT_RF_IMPL)->Enable();
570  } else {
571  FindWindow(ID_SELECT_RF_IMPL)->Disable();
572  }
573 }
574 
575 /**
576  * Event handler for the IU list selection changes.
577  *
578  * Enables and disables the select IU implementation button.
579  */
580 void
582  if (iuList_->GetSelectedItemCount() == 1) {
583  FindWindow(ID_SELECT_IU_IMPL)->Enable();
584  } else {
585  FindWindow(ID_SELECT_IU_IMPL)->Disable();
586  }
587 }
588 
589 /**
590  * Event handler for the FU list selection changes.
591  *
592  * Enables and disables the select FU implementation button.
593  */
594 void
596  if (fuList_->GetSelectedItemCount() == 1) {
597  FindWindow(ID_SELECT_FU_IMPL)->Enable();
598  } else {
599  FindWindow(ID_SELECT_FU_IMPL)->Disable();
600  }
601 }
602 
603 /**
604  * Event handler for the ic/decoder parameter list selection changes.
605  *
606  * Enables and disables the set parameter value button.
607  */
608 void
610  if (parameterList_->GetSelectedItemCount() == 1) {
611  FindWindow(ID_SET_VALUE)->Enable();
612  } else {
613  FindWindow(ID_SET_VALUE)->Disable();
614  }
615 }
616 
617 /**
618  * Event handler for the Load IDF... button.
619  */
620 void
622 
623  wxFileDialog dialog(
624  this, _T("Choose a file"), _T(""), _T(""),
625  _T("Implemenation Definition Files files (*.idf)|*.idf|All files|*"),
626  (wxOPEN | wxFILE_MUST_EXIST));
627 
628  if (dialog.ShowModal() == wxID_OK) {
629 
630  ObjectState* old =impl_.saveState();
631 
632  string idfFile =
633  WxConversion::toString(dialog.GetPath());
634 
635  IDFSerializer serializer;
636  serializer.setSourceFile(idfFile);
637 
638  try {
639  ObjectState* newIDF = serializer.readState();
640  impl_.loadState(newIDF);
641  delete newIDF;
642  } catch (Exception& e) {
643  impl_.loadState(old);
644  wxString message = _T("Error reading idf '");
645  message.Append(WxConversion::toWxString(idfFile));
646  message.Append(_T("':\n"));
647  message.Append(WxConversion::toWxString(e.errorMessage()));
648  ErrorDialog errorDialog(this, message);
649  errorDialog.ShowModal();
650  return;
651  }
652 
653  IDFValidator validator(impl_, machine_);
654  if (!validator.validate()) {
655  wxString message = _T("Warning:\n");
656  for (int i = 0; i < validator.errorCount(); i++) {
657  message.Append(
658  WxConversion::toWxString(validator.errorMessage(i)));
659 
660  message.Append(_T("\n"));
661  }
662  WarningDialog warningDialog(this, message);
663  warningDialog.ShowModal();
664 
665  // Remove implementations of units that doesn't exist in the
666  // architecture.
668  }
669 
670  // check and possibly correct file paths defined in IDF
671  checkImplementationFiles();
672 
673  try {
674  if (impl_.hasICDecoderPluginName() &&
675  impl_.hasICDecoderPluginFile()) {
676 
677  loadICDecoderPlugin(
678  impl_.icDecoderPluginName(),
679  impl_.icDecoderPluginFile());
680  }
681  } catch (Exception& e) {
682  wxString msg = _T("Warning: could not load IC decoder plugin!");
683  WarningDialog warningDialog(this, msg);
684  warningDialog.ShowModal();
685  }
686 
687  TransferDataToWindow();
688  delete old;
689  }
690 }
691 
692 
693 /**
694  * Event handler for the Close button.
695  */
696 void
698  if (dirtyData_) {
699  wxString message = _T("Save before exit?\n");
700 
701  wxMessageDialog dialog(this, message, message, wxYES|wxCANCEL|wxNO);
702  int rv = dialog.ShowModal();
703  switch(rv) {
704  case wxID_NO:
705  break;
706  case wxID_YES:
707  doSaveIDF();
708  return;
709  case wxID_CANCEL:
710  default:
711  return;
712  }
713  }
714  Close();
715 }
716 
717 
718 void
720  wxString message = _T("Save implementation.");
721  wxString defaultDir = _T(".");
722 
723  wxDocument* doc = wxGetApp().docManager()->GetCurrentDocument();
724  wxString defaultFile;
725  if (doc != NULL) {
726  defaultFile = doc->GetFilename();
727  defaultFile.erase(defaultFile.rfind('.'));
728  defaultFile += _T(".idf");
729 
730  // set default save location to same where the .adf file is
731  string absolutePathToADF = FileSystem::absolutePathOf(
732  WxConversion::toString(defaultFile));
733  defaultDir = WxConversion::toWxString(
734  FileSystem::directoryOfPath(absolutePathToADF));
735  defaultFile = WxConversion::toWxString(
737  } else {
738  defaultFile = _T(".idf");
739  }
740 
741  wxString fileTypes = _T("Implementation Definition File (.idf)|*.idf");
742 
743  wxFileDialog dialog(
744  this, message, defaultDir, defaultFile, fileTypes,
745  wxSAVE | wxOVERWRITE_PROMPT);
746 
747  if (dialog.ShowModal() == wxID_OK) {
748  string path = WxConversion::toString(dialog.GetPath());
749  try {
750  // Make local and default file paths relative.
751  std::vector<string> searchPaths;
752  searchPaths.push_back(FileSystem::currentWorkingDir());
753  std::vector<string> hdbSearchPaths = Environment::hdbPaths();
754  impl_.makeImplFilesRelative(searchPaths);
755 
756  IDFSerializer serializer;
757  serializer.setDestinationFile(path);
758  serializer.writeMachineImplementation(impl_);
759  setDirty(false);
760  } catch (Exception& e) {
761  wxString message = _T("Error writing '");
762  message.Append(WxConversion::toWxString(path));
763  message.Append(_T("':"));
764  message.Append(WxConversion::toWxString(e.errorMessage()));
765  ErrorDialog dialog(this, message);
766  dialog.ShowModal();
767  }
768  }
769 }
770 
771 
772 
773 /**
774  * Event handler for the Save IDF button.
775  */
776 void
778  doSaveIDF();
779 }
780 
781 /**
782  * Event handler for the decompressor block Browse... button.
783  */
784 void
786  wxFileDialog dialog(
787  this, _T("Choose a file"), _T(""), _T(""),
788  _T("Decompressor block files (*.vhdl;*.vhd)|*.vhdl;*.vhd|"
789  "All files|*"),
790  (wxOPEN | wxFILE_MUST_EXIST));
791 
792  if (dialog.ShowModal() == wxID_OK) {
793  setDirty(true);
794  string decompressorFile =
795  WxConversion::toString(dialog.GetPath());
796 
797  impl_.setDecompressorFile(decompressorFile);
798  }
799 
800  TransferDataToWindow();
801 }
802 
803 
804 /**
805  * Event handler for the ic/decoder plugin Browse... button.
806  */
807 void
809 
810  wxFileDialog dialog(
811  this, _T("Choose a file"), _T(""), _T(""),
812  _T("IC/Decoder plugins (*.so)|*.so|All files|*.*"),
813  (wxOPEN | wxFILE_MUST_EXIST));
814 
815  if (dialog.ShowModal() == wxID_OK) {
816  setDirty(true);
817  string pluginFile =
818  WxConversion::toString(dialog.GetPath());
819 
820  // An ugly way to determine the plugin name which should be the
821  // file name minus the "Plugin.so" ending.
822  string pluginName = FileSystem::fileOfPath(pluginFile);
823  pluginName = FileSystem::fileNameBody(pluginFile);
824  if (pluginName.length() < 6 ||
825  pluginName.substr(pluginName.length() - 6) != "Plugin") {
826 
827  wxString message = _T("Unable to determine plugin name.\n");
828  message.Append(_T("Plugin file must be named "));
829  message.Append(_T("'<plugin name>Plugin.so'"));
830  ErrorDialog dialog(this, message);
831  dialog.ShowModal();
832  return;
833  }
834  pluginName = pluginName.substr(0, pluginName.length() - 6);
835  loadICDecoderPlugin(pluginName, pluginFile);
836  impl_.clearICDecoderParameters();
837  }
838 
839  TransferDataToWindow();
840 }
841 
842 
843 /**
844  * Event handler for the ic/ hdb Browse... button.
845  */
846 void
848 
849  wxFileDialog dialog(
850  this, _T("Choose a file"), _T(""), _T(""),
851  _T("HDB Files (*.hdb)|*.hdb|All files|*.*"),
852  (wxOPEN | wxFILE_MUST_EXIST));
853 
854  if (dialog.ShowModal() == wxID_OK) {
855  setDirty(true);
856  string hdbFile = WxConversion::toString(dialog.GetPath());
857  impl_.setICDecoderHDB(hdbFile);
858  }
859 
860  TransferDataToWindow();
861 }
862 
863 
864 /**
865  * Event handler for the ic/decoder parameter value setting button.
866  */
867 void
869 
870  long item = -1;
871  item = parameterList_->GetNextItem(
872  item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
873 
874  if (item < 0) return;
875 
876  wxTextCtrl* valueCtrl = dynamic_cast<wxTextCtrl*>(
877  FindWindow(ID_PARAMETER_VALUE));
878 
879  std::string name = plugin_->recognizedParameter(item);
880  std::string value = WxConversion::toString(valueCtrl->GetValue());
881  impl_.setICDecoderParameter(name, value);
882  TransferDataToWindow();
883 }
884 
885 
886 /**
887  * Loads an IC/Decoder plugin.
888  *
889  * @param pluginName Name of the plugin.
890  * @param pluginFile Full path to the plugin file.
891  */
892 void
894  const string& pluginName,
895  const string& pluginFile) {
896 
897  if (plugin_ != NULL) {
898  delete plugin_;
899  plugin_ = NULL;
900  }
901 
902  // initialize the plugin tool
903  vector<string> pluginPaths = Environment::icDecoderPluginPaths();
904  for (vector<string>::const_iterator iter = pluginPaths.begin();
905  iter != pluginPaths.end(); iter++) {
906  try {
907  pluginTool_.addSearchPath(*iter);
908  } catch (const FileNotFound&) {
909  }
910  }
911 
912  try {
913  pluginTool_.registerModule(pluginFile);
914  } catch (const FileNotFound&) {
915  wxString message = _T("Plugin file '");
916  message.Append(WxConversion::toWxString(pluginFile));
917  message.Append(_T("' doesn't exist"));
918  ErrorDialog dialog(this, message);
919  dialog.ShowModal();
920  return;
921  } catch (Exception& e) {
922  wxString message = _T("Error loading plugin file '");
923  message.Append(WxConversion::toWxString(pluginFile));
924  message.Append(_T("':\n"));
925  message.Append(WxConversion::toWxString(e.errorMessage()));
926  ErrorDialog dialog(this, message);
927  dialog.ShowModal();
928  return;
929  }
930 
931  ICDecoderGeneratorPlugin* (*creator)(
933 
934  try {
935  pluginTool_.importSymbol(
936  "create_generator_plugin_" + pluginName, creator, pluginFile);
937 
938  BEMGenerator generator(machine_);
939  BinaryEncoding* bem = generator.generate();
940  plugin_ = creator(machine_, *bem);
941  delete bem;
942  } catch (Exception& e) {
943  wxString message = _T("Error loading plugin '");
944  message.Append(WxConversion::toWxString(pluginName));
945  message.Append(_T("' from '"));
946  message.Append(WxConversion::toWxString(pluginFile));
947  message.Append(_T("':\n"));
948  message.Append(WxConversion::toWxString(e.errorMessage()));
949  ErrorDialog dialog(this, message);
950  dialog.ShowModal();
951  return;
952  }
953 
954  try {
955  impl_.setICDecoderPluginFile(pluginFile);
956  } catch (FileNotFound& e) {
957  }
958  impl_.setICDecoderPluginName(pluginName);
959  assert(plugin_ != NULL);
960  return;
961 }
962 
963 /**
964  * Event handler for the Generate Processor... button.
965  */
966 void
968 
969  IDFValidator validator(impl_, machine_);
970  if (!validator.validate()) {
971  wxString message;
972  for (int i = 0; i < validator.errorCount(); i++) {
973  message.Append(
974  WxConversion::toWxString(validator.errorMessage(i)));
975 
976  message.Append(_T("\n"));
977  }
978  ErrorDialog dialog(this, message);
979  dialog.ShowModal();
980  return;
981  }
982 
983  GenerateProcessorDialog dialog(this, machine_, impl_);
984  dialog.ShowModal();
985 }
986 
987 /**
988  * Checks if every file path defined in IDF is correct.
989  *
990  * If one or more file paths are invalid, warning dialog is shown to user.
991  */
992 void
994  size_t missingFileCount;
995  size_t alternativesCount;
996 
997  // check implementation files, and try to fix paths for unresolved files
998  if (impl_.checkImplFiles(missingFileCount, alternativesCount)) {
999  // if all the files were located, exit method
1000  return;
1001  }
1002 
1003  // every file was not found, get missing files and possible alternatives
1004  wxString missFileCountStr = WxConversion::toWxString(
1005  static_cast<int>(missingFileCount));
1006  wxString altFileCountStr = WxConversion::toWxString(
1007  static_cast<int>(alternativesCount));
1008 
1009  // form message for the dialog
1010  wxString message = missFileCountStr;
1011  message.Append(_T(" file(s) defined in IDF couldn't be located from"));
1012  message.Append(_T(" absolute paths or under working directory.\n"));
1013  message.Append(_T("\n"));
1014 
1015  if (alternativesCount > 0) {
1016  message.Append(altFileCountStr);
1017  message.Append(_T(" of them were replaced with file(s) found under"));
1018  message.Append(_T(" the default search paths."));
1019  } else {
1020  message.Append(_T("Any alternative file paths couldn't be"));
1021  message.Append(_T(" located for the missing files."));
1022  }
1023 
1024  WarningDialog warningDialog(this, message);
1025  warningDialog.ShowModal();
1026 }
1027 
1028 
1029 /**
1030  * Creates the dialog widgets.
1031  *
1032  * Code geenrated by wxDesigner. Do not modify manually.
1033  *
1034  * @param parent Parent window of the created widget hierarchy.
1035  * @param call_fit Fit parent window size.
1036  * @param set_sizer Set the created top level sizer as the parent win contents.
1037  */
1038 
1039 wxSizer *ProcessorImplementationWindow::createContents( wxWindow *parent, bool call_fit, bool set_sizer )
1040 {
1041  wxFlexGridSizer *item0 = new wxFlexGridSizer( 1, 0, 0 );
1042  item0->AddGrowableCol( 0 );
1043  item0->AddGrowableRow( 0 );
1044 
1045  wxNotebook *item2 = new wxNotebook( parent, ID_NOTEBOOK, wxDefaultPosition, wxDefaultSize, 0 );
1046 #if !wxCHECK_VERSION(2,5,2)
1047  wxNotebookSizer *item1 = new wxNotebookSizer( item2 );
1048 #else
1049  wxWindow *item1 = item2;
1050 #endif
1051 
1052  wxPanel *item3 = new wxPanel( item2, -1 );
1054  item2->AddPage( item3, wxT("Register Files") );
1055 
1056  wxPanel *item4 = new wxPanel( item2, -1 );
1058  item2->AddPage( item4, wxT("Immediate Units") );
1059 
1060  wxPanel *item5 = new wxPanel( item2, -1 );
1062  item2->AddPage( item5, wxT("Function Units") );
1063 
1064  wxPanel *item6 = new wxPanel( item2, -1 );
1066  item2->AddPage( item6, wxT("Instruction Compression") );
1067 
1068  wxPanel *item7 = new wxPanel( item2, -1 );
1070  item2->AddPage( item7, wxT("IC / Decoder Plugin") );
1071 
1072  item0->Add( item1, 0, wxFIXED_MINSIZE|wxGROW|wxALL, 5 );
1073 
1074  wxStaticLine *item8 = new wxStaticLine( parent, ID_LINE, wxDefaultPosition, wxSize(200,-1), wxLI_HORIZONTAL );
1075  item0->Add( item8, 0, wxFIXED_MINSIZE|wxGROW|wxALL, 5 );
1076 
1077  wxGridSizer *item9 = new wxGridSizer( 2, 0, 0 );
1078 
1079  wxBoxSizer *item10 = new wxBoxSizer( wxHORIZONTAL );
1080 
1081  wxButton *item11 = new wxButton( parent, ID_LOAD_IDF, wxT("Load IDF..."), wxDefaultPosition, wxDefaultSize, 0 );
1082  item10->Add( item11, 0, wxFIXED_MINSIZE|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
1083 
1084  wxButton *item12 = new wxButton( parent, ID_SAVE_IDF, wxT("Save IDF..."), wxDefaultPosition, wxDefaultSize, 0 );
1085  item10->Add( item12, 0, wxFIXED_MINSIZE|wxALIGN_CENTER|wxALL, 5 );
1086 
1087  wxButton *item13 = new wxButton( parent, ID_GENERATE, wxT("Generate Processor"), wxDefaultPosition, wxDefaultSize, 0 );
1088  item10->Add( item13, 0, wxFIXED_MINSIZE|wxALIGN_CENTER|wxALL, 5 );
1089 
1090  item9->Add( item10, 0, wxFIXED_MINSIZE|wxALIGN_CENTER_VERTICAL, 5 );
1091 
1092  wxBoxSizer *item14 = new wxBoxSizer( wxHORIZONTAL );
1093 
1094  wxButton *item15 = new wxButton( parent, ID_CLOSE, wxT("Close"), wxDefaultPosition, wxDefaultSize, 0 );
1095  item14->Add( item15, 0, wxFIXED_MINSIZE|wxALIGN_CENTER|wxALL, 5 );
1096 
1097  item9->Add( item14, 0, wxFIXED_MINSIZE|wxALIGN_CENTER_VERTICAL, 5 );
1098 
1099  item0->Add( item9, 0, wxFIXED_MINSIZE|wxGROW|wxALL, 5 );
1100 
1101  if (set_sizer)
1102  {
1103  parent->SetSizer( item0 );
1104  if (call_fit)
1105  item0->SetSizeHints( parent );
1106  }
1107 
1108  return item0;
1109 }
1110 
1111 wxSizer *ProcessorImplementationWindow::registerFilePage( wxWindow *parent, bool call_fit, bool set_sizer )
1112 {
1113  wxFlexGridSizer *item0 = new wxFlexGridSizer( 1, 0, 0 );
1114  item0->AddGrowableCol( 0 );
1115  item0->AddGrowableRow( 0 );
1116 
1117  wxListCtrl *item1 = new wxListCtrl( parent, ID_RF_LIST, wxDefaultPosition, wxDefaultSize, wxLC_REPORT|wxLC_SINGLE_SEL|wxSUNKEN_BORDER );
1118  item0->Add( item1, 0, wxGROW|wxALL, 5 );
1119 
1120  wxBoxSizer *buttonSizer = new wxBoxSizer( wxHORIZONTAL );
1121  wxButton *autoSelButton = new wxButton( parent, ID_AUTO_SELECT_IMPL, wxT("Auto Select Implementations"), wxDefaultPosition, wxDefaultSize, 0 );
1122  buttonSizer->Add( autoSelButton, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
1123 
1124  wxButton *item2 = new wxButton( parent, ID_SELECT_RF_IMPL, wxT("Select implementation..."), wxDefaultPosition, wxDefaultSize, 0 );
1125  buttonSizer->Add( item2, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
1126 
1127  item0->Add( buttonSizer, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
1128 
1129  if (set_sizer)
1130  {
1131  parent->SetSizer( item0 );
1132  if (call_fit)
1133  item0->SetSizeHints( parent );
1134  }
1135 
1136  return item0;
1137 }
1138 
1139 wxSizer *ProcessorImplementationWindow::functionUnitPage( wxWindow *parent, bool call_fit, bool set_sizer )
1140 {
1141  wxFlexGridSizer *item0 = new wxFlexGridSizer( 1, 0, 0 );
1142  item0->AddGrowableCol( 0 );
1143  item0->AddGrowableRow( 0 );
1144 
1145  wxListCtrl *item1 = new wxListCtrl( parent, ID_FU_LIST, wxDefaultPosition, wxDefaultSize, wxLC_REPORT|wxLC_SINGLE_SEL|wxSUNKEN_BORDER );
1146  item0->Add( item1, 0, wxGROW|wxALL, 5 );
1147 
1148  wxBoxSizer *buttonSizer = new wxBoxSizer( wxHORIZONTAL );
1149  wxButton *autoSelButton = new wxButton( parent, ID_AUTO_SELECT_IMPL, wxT("Auto Select Implementations"), wxDefaultPosition, wxDefaultSize, 0 );
1150  buttonSizer->Add( autoSelButton, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
1151 
1152  wxButton *item2 = new wxButton( parent, ID_SELECT_FU_IMPL, wxT("Select implementation..."), wxDefaultPosition, wxDefaultSize, 0 );
1153  buttonSizer->Add( item2, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
1154 
1155  item0->Add( buttonSizer, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
1156 
1157  if (set_sizer)
1158  {
1159  parent->SetSizer( item0 );
1160  if (call_fit)
1161  item0->SetSizeHints( parent );
1162  }
1163 
1164  return item0;
1165 }
1166 
1167 wxSizer *ProcessorImplementationWindow::decompressionPage( wxWindow *parent, bool call_fit, bool set_sizer )
1168 {
1169  wxFlexGridSizer *item0 = new wxFlexGridSizer( 1, 0, 0 );
1170  item0->AddGrowableCol( 0 );
1171 
1172  item0->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 );
1173 
1174  wxStaticBox *item2 = new wxStaticBox( parent, -1, wxT("Instruction Decompressor:") );
1175  wxStaticBoxSizer *item1 = new wxStaticBoxSizer( item2, wxVERTICAL );
1176 
1177  wxFlexGridSizer *item3 = new wxFlexGridSizer( 2, 0, 0 );
1178 
1179  wxStaticText *item4 = new wxStaticText( parent, ID_TEXT, wxT("Decompressor block file:"), wxDefaultPosition, wxDefaultSize, 0 );
1180  item3->Add( item4, 0, wxALL, 5 );
1181 
1182  item3->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 );
1183 
1184  wxTextCtrl *item5 = new wxTextCtrl( parent, ID_DECOMPRESSOR_PATH, wxT(""), wxDefaultPosition, wxSize(250,-1), wxTE_READONLY );
1185  item3->Add( item5, 0, wxALIGN_CENTER|wxALL, 5 );
1186 
1187  wxButton *item6 = new wxButton( parent, ID_BROWSE_DECOMPRESSOR, wxT("Browse..."), wxDefaultPosition, wxDefaultSize, 0 );
1188  item3->Add( item6, 0, wxALIGN_CENTER|wxALL, 5 );
1189 
1190  item1->Add( item3, 0, wxGROW|wxALL, 5 );
1191 
1192  item0->Add( item1, 0, wxGROW|wxALL, 5 );
1193 
1194  item0->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 );
1195 
1196  if (set_sizer)
1197  {
1198  parent->SetSizer( item0 );
1199  if (call_fit)
1200  item0->SetSizeHints( parent );
1201  }
1202 
1203  return item0;
1204 }
1205 
1206 wxSizer *ProcessorImplementationWindow::icDecoderPluginPage( wxWindow *parent, bool call_fit, bool set_sizer )
1207 {
1208  wxFlexGridSizer *item0 = new wxFlexGridSizer( 1, 0, 0 );
1209  item0->AddGrowableCol( 0 );
1210  item0->AddGrowableRow( 0 );
1211 
1212  wxFlexGridSizer *item1 = new wxFlexGridSizer( 1, 0, 0 );
1213  item1->AddGrowableCol( 0 );
1214  item1->AddGrowableRow( 1 );
1215 
1216  wxFlexGridSizer *item2 = new wxFlexGridSizer( 3, 0, 0 );
1217 
1218  wxStaticText *item3 = new wxStaticText( parent, ID_TEXT, wxT("Plugin file:"), wxDefaultPosition, wxDefaultSize, 0 );
1219  item2->Add( item3, 0, wxALL, 5 );
1220 
1221  wxTextCtrl *item4 = new wxTextCtrl( parent, ID_IC_DEC_PLUGIN_FILE, wxT(""), wxDefaultPosition, wxSize(80,-1), wxTE_READONLY );
1222  item2->Add( item4, 0, wxGROW|wxALL, 5 );
1223 
1224  wxButton *item5 = new wxButton( parent, ID_BROWSE_IC_DEC_PLUGIN, wxT("Browse..."), wxDefaultPosition, wxDefaultSize, 0 );
1225  item2->Add( item5, 0, wxALIGN_CENTER|wxALL, 5 );
1226 
1227  wxStaticText *item6 = new wxStaticText( parent, ID_TEXT, wxT("HDB file:"), wxDefaultPosition, wxDefaultSize, 0 );
1228  item2->Add( item6, 0, wxALL, 5 );
1229 
1230  wxTextCtrl *item7 = new wxTextCtrl( parent, ID_IC_DEC_HDB_FILE, wxT(""), wxDefaultPosition, wxSize(80,-1), 0 );
1231  item2->Add( item7, 0, wxGROW|wxALL, 5 );
1232 
1233  wxButton *item8 = new wxButton( parent, ID_BROWSE_IC_DEC_HDB, wxT("Browse..."), wxDefaultPosition, wxDefaultSize, 0 );
1234  item2->Add( item8, 0, wxALIGN_CENTER|wxALL, 5 );
1235 
1236  wxStaticText *item9 = new wxStaticText( parent, ID_TEXT, wxT("Plugin name:"), wxDefaultPosition, wxDefaultSize, 0 );
1237  item2->Add( item9, 0, wxALL, 5 );
1238 
1239  wxTextCtrl *item10 = new wxTextCtrl( parent, ID_IC_DEC_PLUGIN_NAME, wxT(""), wxDefaultPosition, wxSize(80,-1), wxTE_READONLY );
1240  item2->Add( item10, 0, wxGROW|wxALL, 5 );
1241 
1242  item2->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 );
1243 
1244  wxStaticText *item11 = new wxStaticText( parent, ID_TEXT, wxT("Description:"), wxDefaultPosition, wxDefaultSize, 0 );
1245  item2->Add( item11, 0, wxALL, 5 );
1246 
1247  wxTextCtrl *item12 = new wxTextCtrl( parent, ID_IC_DEC_PLUGIN_DESC, wxT(""), wxDefaultPosition, wxSize(320,80), wxTE_MULTILINE|wxTE_READONLY );
1248  item2->Add( item12, 0, wxGROW|wxALL, 5 );
1249 
1250  item1->Add( item2, 0, wxFIXED_MINSIZE|wxGROW|wxALL, 5 );
1251 
1252  wxFlexGridSizer *item13 = new wxFlexGridSizer( 1, 0, 0 );
1253  item13->AddGrowableCol( 0 );
1254  item13->AddGrowableRow( 1 );
1255 
1256  wxStaticText *item14 = new wxStaticText( parent, ID_TEXT, wxT("Plugin parameters:"), wxDefaultPosition, wxDefaultSize, 0 );
1257  item13->Add( item14, 0, wxALL, 5 );
1258 
1259  wxListCtrl *item15 = new wxListCtrl( parent, ID_PARAMETER_LIST, wxDefaultPosition, wxDefaultSize, wxLC_REPORT|wxLC_SINGLE_SEL|wxSUNKEN_BORDER );
1260  item13->Add( item15, 0, wxGROW|wxALL, 5 );
1261 
1262  wxBoxSizer *item16 = new wxBoxSizer( wxHORIZONTAL );
1263 
1264  wxStaticText *item17 = new wxStaticText( parent, ID_TEXT, wxT("New value:"), wxDefaultPosition, wxDefaultSize, 0 );
1265  item16->Add( item17, 0, wxALIGN_CENTER|wxALL, 5 );
1266 
1267  wxTextCtrl *item18 = new wxTextCtrl( parent, ID_PARAMETER_VALUE, wxT(""), wxDefaultPosition, wxSize(200,-1), 0 );
1268  item16->Add( item18, 0, wxALIGN_CENTER|wxALL, 5 );
1269 
1270  wxButton *item19 = new wxButton( parent, ID_SET_VALUE, wxT("Set"), wxDefaultPosition, wxDefaultSize, 0 );
1271  item16->Add( item19, 0, wxALIGN_CENTER|wxALL, 5 );
1272 
1273  item13->Add( item16, 0, wxALIGN_CENTER, 5 );
1274 
1275  item1->Add( item13, 0, wxFIXED_MINSIZE|wxGROW|wxALL, 5 );
1276 
1277  item0->Add( item1, 0, wxGROW|wxALL, 5 );
1278 
1279  if (set_sizer)
1280  {
1281  parent->SetSizer( item0 );
1282  if (call_fit)
1283  item0->SetSizeHints( parent );
1284  }
1285 
1286  return item0;
1287 }
1288 
1289 wxSizer *ProcessorImplementationWindow::immediateUnitPage( wxWindow *parent, bool call_fit, bool set_sizer )
1290 {
1291  wxFlexGridSizer *item0 = new wxFlexGridSizer( 1, 0, 0 );
1292  item0->AddGrowableCol( 0 );
1293  item0->AddGrowableRow( 0 );
1294 
1295  wxListCtrl *item1 = new wxListCtrl( parent, ID_IU_LIST, wxDefaultPosition, wxDefaultSize, wxLC_REPORT|wxLC_SINGLE_SEL|wxSUNKEN_BORDER );
1296  item0->Add( item1, 0, wxGROW|wxALL, 5 );
1297 
1298  wxBoxSizer *buttonSizer = new wxBoxSizer( wxHORIZONTAL );
1299  wxButton *autoSelButton = new wxButton( parent, ID_AUTO_SELECT_IMPL, wxT("Auto Select Implementations"), wxDefaultPosition, wxDefaultSize, 0 );
1300  buttonSizer->Add( autoSelButton, 0, wxALL, 5 );
1301 
1302  wxButton *item2 = new wxButton( parent, ID_SELECT_IU_IMPL, wxT("Select implementation..."), wxDefaultPosition, wxDefaultSize, 0 );
1303  buttonSizer->Add( item2, 0, wxALL, 5 );
1304 
1305  item0->Add( buttonSizer, 0, wxALL, 5 );
1306 
1307  if (set_sizer)
1308  {
1309  parent->SetSizer( item0 );
1310  if (call_fit)
1311  item0->SetSizeHints( parent );
1312  }
1313 
1314  return item0;
1315 }
IDF::UnitImplementationLocation
Definition: UnitImplementationLocation.hh:48
ProcessorImplementationWindow::onSaveIDF
void onSaveIDF(wxCommandEvent &event)
Definition: ProcessorImplementationWindow.cc:777
WarningDialog
Definition: WarningDialog.hh:42
BlockImplementationDialog.hh
IDFValidator::errorCount
int errorCount() const
Definition: IDFValidator.cc:81
IDF::RFImplementationLocation
UnitImplementationLocation RFImplementationLocation
Definition: ComponentImplementationSelector.hh:57
BinaryEncoding
Definition: BinaryEncoding.hh:61
IDF::IDFSerializer::readState
virtual ObjectState * readState()
Definition: IDFSerializer.cc:111
ProDe.hh
BEMGenerator.hh
ProcessorImplementationWindow::onRFActivation
void onRFActivation(wxListEvent &event)
Definition: ProcessorImplementationWindow.cc:429
FileSystem.hh
WxConversion::toWxString
static wxString toWxString(const std::string &source)
FileNotFound
Definition: Exception.hh:224
ProcessorImplementationWindow::onAutoSelectImplementations
void onAutoSelectImplementations(wxCommandEvent &event)
Definition: ProcessorImplementationWindow.cc:288
ProcessorImplementationWindow::onClose
void onClose(wxCommandEvent &event)
Definition: ProcessorImplementationWindow.cc:697
TTAMachine::Component::name
virtual TCEString name() const
Definition: MachinePart.cc:125
ProcessorImplementationWindow::onBrowseDecompressor
void onBrowseDecompressor(wxCommandEvent &event)
Definition: ProcessorImplementationWindow.cc:785
EVT_LIST_ITEM_ACTIVATED
FUImplementationDialog::onAddExternalPort FUImplementationDialog::onDeleteExternalPort FUImplementationDialog::onArchPortSelection FUImplementationDialog::onArchPortActivation FUImplementationDialog::onExternalPortActivation FUImplementationDialog::onParameterSelection EVT_LIST_ITEM_ACTIVATED(ID_PARAMETER_LIST, FUImplementationDialog::onParameterActivation) EVT_LIST_ITEM_DESELECTED(ID_PARAMETER_LIST
XMLSerializer::setSourceFile
void setSourceFile(const std::string &fileName)
Definition: XMLSerializer.cc:115
machine
TTAMachine::Machine * machine
the architecture definition of the estimated processor
Definition: EstimatorCmdLineUI.cc:59
ProcessorImplementationWindow::onFUSelection
void onFUSelection(wxListEvent &event)
Definition: ProcessorImplementationWindow.cc:595
GenerateProcessorDialog
Definition: GenerateProcessorDialog.hh:56
ProcessorImplementationWindow::onSelectRFImplementation
void onSelectRFImplementation(wxCommandEvent &event)
Definition: ProcessorImplementationWindow.cc:412
ProGe::ICDecoderGeneratorPlugin
Definition: ICDecoderGeneratorPlugin.hh:68
ProcessorImplementationWindow::onParameterSelection
void onParameterSelection(wxListEvent &event)
Definition: ProcessorImplementationWindow.cc:609
ProcessorImplementationWindow::onSelectIUImplementation
void onSelectIUImplementation(wxCommandEvent &event)
Definition: ProcessorImplementationWindow.cc:464
ProcessorImplementationWindow::icDecoderPluginPage
wxSizer * icDecoderPluginPage(wxWindow *parent, bool call_fit, bool set_sizer=true)
Definition: ProcessorImplementationWindow.cc:1206
ObjectState
Definition: ObjectState.hh:59
AutoSelectImplementationsDialog
Definition: AutoSelectImplementationsDialog.hh:59
Environment::icDecoderPluginPaths
static std::vector< std::string > icDecoderPluginPaths(bool libraryPathsOnly=false)
Definition: Environment.cc:635
ProcessorImplementationWindow::onLoadIDF
void onLoadIDF(wxCommandEvent &event)
Definition: ProcessorImplementationWindow.cc:621
FindWindow
Definition: FindWindow.hh:49
ProcessorImplementationWindow::~ProcessorImplementationWindow
virtual ~ProcessorImplementationWindow()
Definition: ProcessorImplementationWindow.cc:181
ProcessorImplementationWindow::onIUActivation
void onIUActivation(wxListEvent &event)
Definition: ProcessorImplementationWindow.cc:481
TTAMachine::Machine::Navigator::count
int count() const
FileSystem::absolutePathOf
static std::string absolutePathOf(const std::string &pathName)
Definition: FileSystem.cc:303
FileSystem::fileOfPath
static std::string fileOfPath(const std::string pathName)
Definition: FileSystem.cc:101
ICDecoderGeneratorPlugin.hh
ProcessorImplementationWindow::onBrowseICDecPlugin
void onBrowseICDecPlugin(wxCommandEvent &event)
Definition: ProcessorImplementationWindow.cc:808
IDFValidator::errorMessage
std::string errorMessage(int index) const
Definition: IDFValidator.cc:94
Environment::defaultICDecoderPlugin
static std::string defaultICDecoderPlugin()
Definition: Environment.cc:1012
IDFValidator.hh
AutoSelectImplementationsDialog.hh
BEMGenerator
Definition: BEMGenerator.hh:61
ProcessorImplementationWindow::handleSelectIUImplementation
void handleSelectIUImplementation(long item)
Definition: ProcessorImplementationWindow.cc:434
ProcessorImplementationWindow
Definition: ProcessorImplementationWindow.hh:55
ProcessorImplementationWindow::TransferDataToWindow
virtual bool TransferDataToWindow()
Definition: ProcessorImplementationWindow.cc:189
assert
#define assert(condition)
Definition: Application.hh:86
TTAMachine::FunctionUnit
Definition: FunctionUnit.hh:55
ProcessorImplementationWindow::registerFilePage
wxSizer * registerFilePage(wxWindow *parent, bool call_fit, bool set_sizer=true)
Definition: ProcessorImplementationWindow.cc:1111
ErrorDialog
Definition: ErrorDialog.hh:42
WarningDialog.hh
Environment::hdbPaths
static std::vector< std::string > hdbPaths(bool libraryPathsOnly=false)
Definition: Environment.cc:683
ErrorDialog.hh
Conversion.hh
ProcessorImplementationWindow::onSelectFUImplementation
void onSelectFUImplementation(wxCommandEvent &event)
Definition: ProcessorImplementationWindow.cc:540
BinaryEncoding.hh
Environment::shortHDBPath
static TCEString shortHDBPath(const TCEString &hdbPath)
Definition: Environment.cc:707
IDFValidator
Definition: IDFValidator.hh:52
XMLSerializer::setDestinationFile
void setDestinationFile(const std::string &fileName)
Definition: XMLSerializer.cc:142
FileSystem::directoryOfPath
static std::string directoryOfPath(const std::string fileName)
Definition: FileSystem.cc:79
ObjectState.hh
IDF::FUImplementationLocation
UnitImplementationLocation FUImplementationLocation
Definition: ComponentImplementationSelector.hh:55
GenerateProcessorDialog.hh
Environment.hh
ProcessorImplementationWindow::onGenerateProcessor
void onGenerateProcessor(wxCommandEvent &event)
Definition: ProcessorImplementationWindow.cc:967
ProcessorImplementationWindow::createContents
wxSizer * createContents(wxWindow *parent, bool call_fit, bool set_sizer)
Definition: ProcessorImplementationWindow.cc:1039
IDFValidator::validate
bool validate()
Definition: IDFValidator.cc:66
ProcessorImplementationWindow::checkImplementationFiles
void checkImplementationFiles()
Definition: ProcessorImplementationWindow.cc:993
Machine.hh
Exception
Definition: Exception.hh:54
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
ProcessorImplementationWindow::onRFSelection
void onRFSelection(wxListEvent &event)
Definition: ProcessorImplementationWindow.cc:567
Exception::errorMessage
std::string errorMessage() const
Definition: Exception.cc:123
ProcessorImplementationWindow::decompressionPage
wxSizer * decompressionPage(wxWindow *parent, bool call_fit, bool set_sizer=true)
Definition: ProcessorImplementationWindow.cc:1167
ProcessorImplementationWindow.hh
ProcessorImplementationWindow::updateImplementationLists
void updateImplementationLists()
Definition: ProcessorImplementationWindow.cc:298
ProcessorImplementationWindow::updateFUList
void updateFUList(const std::string &fuName, int index)
Definition: ProcessorImplementationWindow.cc:488
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
ProcessorImplementationWindow::loadICDecoderPlugin
void loadICDecoderPlugin(const std::string &pluginName, const std::string &pluginFile)
Definition: ProcessorImplementationWindow.cc:893
ProcessorImplementationWindow::handleSelectFUImplementation
void handleSelectFUImplementation(long item)
Definition: ProcessorImplementationWindow.cc:508
false
find Finds info of the inner loops in the false
Definition: InnerLoopFinder.cc:81
IDF::UnitImplementationLocation::id
virtual int id() const
Definition: UnitImplementationLocation.cc:127
FALSE
const string FALSE
Value used for false in attribute and element values.
Definition: GUIOptionsSerializer.cc:67
ProGe
Definition: FUGen.hh:54
RegisterFile.hh
BlockImplementationDialog
Definition: BlockImplementationDialog.hh:49
ProcessorImplementationWindow::onBrowseICHDB
void onBrowseICHDB(wxCommandEvent &event)
Definition: ProcessorImplementationWindow.cc:847
IDFValidator::removeUnknownImplementations
static void removeUnknownImplementations(IDF::MachineImplementation &idf, const TTAMachine::Machine &machine)
Definition: IDFValidator.cc:223
ProcessorImplementationWindow::onFUActivation
void onFUActivation(wxListEvent &event)
Definition: ProcessorImplementationWindow.cc:557
FileSystem::currentWorkingDir
static std::string currentWorkingDir()
Definition: FileSystem.cc:142
WxConversion.hh
TTAMachine::Machine::Navigator::item
ComponentType * item(int index) const
IDF::UnitImplementationLocation::hdbFile
virtual std::string hdbFile() const
Definition: UnitImplementationLocation.cc:99
TTAMachine::RegisterFile
Definition: RegisterFile.hh:47
ProcessorImplementationWindow::onSetParameterValue
void onSetParameterValue(wxCommandEvent &event)
Definition: ProcessorImplementationWindow.cc:868
IDF::IDFSerializer::writeMachineImplementation
void writeMachineImplementation(const MachineImplementation &implementation)
Definition: IDFSerializer.cc:163
TTAMachine
Definition: Assembler.hh:48
ProcessorImplementationWindow::functionUnitPage
wxSizer * functionUnitPage(wxWindow *parent, bool call_fit, bool set_sizer=true)
Definition: ProcessorImplementationWindow.cc:1139
IDF::IDFSerializer
Definition: IDFSerializer.hh:45
ProcessorImplementationWindow::doSaveIDF
void doSaveIDF()
Definition: ProcessorImplementationWindow.cc:719
FileSystem::fileNameBody
static std::string fileNameBody(const std::string &fileName)
Definition: FileSystem.cc:291
ProcessorImplementationWindow::handleSelectRFImplementation
void handleSelectRFImplementation(long item)
Definition: ProcessorImplementationWindow.cc:381
WxConversion::toString
static std::string toString(const wxString &source)
ProcessorImplementationWindow::immediateUnitPage
wxSizer * immediateUnitPage(wxWindow *parent, bool call_fit, bool set_sizer=true)
Definition: ProcessorImplementationWindow.cc:1289
TTAMachine::Machine::Navigator
Definition: Machine.hh:186
ProcessorImplementationWindow::updateRFList
void updateRFList(const std::string &rfName, int index)
Definition: ProcessorImplementationWindow.cc:266
BEMGenerator::generate
BinaryEncoding * generate()
Definition: BEMGenerator.cc:104
IDF::MachineImplementation
Definition: MachineImplementation.hh:54
IDF
Definition: DSDBManager.hh:54
END_EVENT_TABLE
END_EVENT_TABLE() using namespace IDF
MachineImplementation.hh
TTAMachine::Machine
Definition: Machine.hh:73
FunctionUnit.hh
ProcessorImplementationWindow::onIUSelection
void onIUSelection(wxListEvent &event)
Definition: ProcessorImplementationWindow.cc:581
IDFSerializer.hh
TTAMachine::ImmediateUnit
Definition: ImmediateUnit.hh:50