OpenASIP 2.2
Loading...
Searching...
No Matches
GCUDialog.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 GCUDialog.cc
26 *
27 * Definition of GCUDialog class.
28 *
29 * @author Veli-Pekka Jääskeläinen 2004 (vjaaskel-no.spam-cs.tut.fi)
30 * @note rating: red
31 */
32
33#include <string>
34#include <wx/spinctrl.h>
35#include <wx/listctrl.h>
36#include <wx/statline.h>
37#include <wx/valgen.h>
38#include <boost/format.hpp>
39
40#include "Application.hh"
41#include "GCUDialog.hh"
42#include "ModelConstants.hh"
43#include "ProDeConstants.hh"
44#include "WxConversion.hh"
45#include "Conversion.hh"
46#include "Machine.hh"
47#include "MachineTester.hh"
48#include "ControlUnit.hh"
49#include "FUPort.hh"
51#include "AddressSpace.hh"
52#include "Socket.hh"
53#include "InformationDialog.hh"
54#include "GUITextGenerator.hh"
55#include "ProDeTextGenerator.hh"
56#include "WxConversion.hh"
57#include "WidgetTools.hh"
58#include "UserManualCmd.hh"
59#include "OperationDialog.hh"
60#include "HWOperation.hh"
61#include "WarningDialog.hh"
62#include "FUPortDialog.hh"
63#include "SRPortDialog.hh"
64#include "ObjectState.hh"
65
66using std::string;
67using boost::format;
68using namespace TTAMachine;
69
70// Too long lines to keep Doxygen quiet.
71BEGIN_EVENT_TABLE(GCUDialog, wxDialog)
72 EVT_TEXT(ID_NAME, GCUDialog::onName)
74
75 EVT_BUTTON(ID_ADD_OPERATION, GCUDialog::onAddOperation)
76 EVT_BUTTON(ID_EDIT_OPERATION, GCUDialog::onEditOperation)
77 EVT_BUTTON(ID_DELETE_OPERATION, GCUDialog::onDeleteOperation)
81 EVT_LIST_ITEM_RIGHT_CLICK(ID_OPERATION_LIST, GCUDialog::onOperationRightClick)
82 EVT_MENU(ID_EDIT_OPERATION, GCUDialog::onEditOperation)
83 EVT_MENU(ID_DELETE_OPERATION, GCUDialog::onDeleteOperation)
84
85 EVT_BUTTON(ID_ADD_FU_PORT, GCUDialog::onAddFUPort)
86 EVT_BUTTON(ID_ADD_SR_PORT, GCUDialog::onAddSRPort)
88 EVT_BUTTON(ID_DELETE_PORT, GCUDialog::onDeletePort)
92 EVT_LIST_ITEM_RIGHT_CLICK(ID_PORT_LIST, GCUDialog::onPortRightClick)
93 EVT_MENU(ID_EDIT_PORT, GCUDialog::onEditPort)
94 EVT_MENU(ID_DELETE_PORT, GCUDialog::onDeletePort)
95
96 EVT_CHOICE(ID_RA_CHOICE, GCUDialog::onRAPortChoice)
98
99
100/**
101 * The Constructor.
102 *
103 * @param parent Parent window of the dialog.
104 * @param gcu The Global Control Unit to be modified with the dialog.
105 */
107 wxWindow* parent,
108 ControlUnit* gcu):
109 wxDialog(parent, -1, _T(""), wxDefaultPosition),
110 gcu_(gcu),
111 name_(_T("")),
112 delaySlots_(0) {
113
114 // Create dialog contents and set pointers to the dialog controls.
115 createContents(this, true, true);
116 addressSpaceChoice_ =
117 dynamic_cast<wxChoice*>(FindWindow(ID_ADDRESS_SPACE));
118 raPortChoice_ =
119 dynamic_cast<wxChoice*>(FindWindow(ID_RA_CHOICE));
120 operationList_ =
121 dynamic_cast<wxListCtrl*>(FindWindow(ID_OPERATION_LIST));
122 portList_ =
123 dynamic_cast<wxListCtrl*>(FindWindow(ID_PORT_LIST));
124
125 // Disable conditional controls initially.
126 FindWindow(wxID_OK)->Disable();
127 FindWindow(ID_EDIT_OPERATION)->Disable();
128 FindWindow(ID_DELETE_OPERATION)->Disable();
129 FindWindow(ID_EDIT_PORT)->Disable();
130 FindWindow(ID_DELETE_PORT)->Disable();
131
132 // set widget labels
133 setLabels();
134
135 // Set validators for dialog controls.
136 FindWindow(ID_NAME)->SetValidator(
137 wxTextValidator(wxFILTER_ASCII, &name_));
138 FindWindow(ID_DELAY_SLOTS)->SetValidator(
139 wxGenericValidator(&delaySlots_));
140 //FindWindow(ID_GUARD_LATENCY)->SetValidator(
141 //wxGenericValidator(&guardLatency_));
142
143 TransferDataToWindow();
144}
145
146
147/**
148 * The Destructor.
149 */
152
153
154/**
155 * Sets the widget labels to texts provided by the GUITextGenerator.
156 */
157void
159
162
163 // Dialog title
164 format fmt = prodeTexts->text(ProDeTextGenerator::TXT_GCU_DIALOG_TITLE);
165 string title = fmt.str();
166 SetTitle(WxConversion::toWxString(title));
167
168 // buttons
169 WidgetTools::setLabel(generator, FindWindow(wxID_OK),
171
172 WidgetTools::setLabel(generator, FindWindow(wxID_CANCEL),
174
177
180
183
186
189
192
195
198
199 // widget labels
202
205
208
209 //WidgetTools::setLabel(
210 //prodeTexts, FindWindow(ID_LABEL_GLOBAL_GUARD_LATENCY),
211 //ProDeTextGenerator::TXT_LABEL_GLOBAL_GUARD_LATENCY);
212
213 // box sizer labels
216
217
218 // Create operation list columns.
219 fmt = prodeTexts->text(ProDeTextGenerator::TXT_COLUMN_NAME);
220 wxListCtrl* operationList =
221 dynamic_cast<wxListCtrl*>(FindWindow(ID_OPERATION_LIST));
222 operationList->InsertColumn(0, WxConversion::toWxString(fmt.str()),
223 wxLIST_FORMAT_LEFT, 260);
224
225 // Create port list columns.
227 portList_->InsertColumn(0, WxConversion::toWxString(fmt.str()),
228 wxLIST_FORMAT_CENTER, 30);
229 fmt = prodeTexts->text(ProDeTextGenerator::TXT_COLUMN_SRP);
230 portList_->InsertColumn(1, WxConversion::toWxString(fmt.str()),
231 wxLIST_FORMAT_CENTER, 40);
232 fmt = prodeTexts->text(ProDeTextGenerator::TXT_COLUMN_NAME);
233 portList_->InsertColumn(2, WxConversion::toWxString(fmt.str()),
234 wxLIST_FORMAT_LEFT, 110);
236 portList_->InsertColumn(3, WxConversion::toWxString(fmt.str()),
237 wxLIST_FORMAT_LEFT, 110);
238}
239
240
241/**
242 * Transfers data from the GCU object to the dialog widgets.
243 *
244 * @return false, if an error occured in the transfer.
245 */
246bool
255
256 // wxWidgets GTK1 version seems to bug with spincontrol validators.
257 // The widget value has to be set manually.
258 dynamic_cast<wxSpinCtrl*>(
260
261 return wxWindow::TransferDataToWindow();
262}
263
264
265/**
266 * Updates 'Address Space' choice control.
267 *
268 * Clears all items from the choicer and adds all address spaces plus
269 * an item 'NONE' indicating empty selection.
270 */
271void
273
274 addressSpaceChoice_->Clear();
276
277 // Put each address space of the Machine to the control.
280
281 for (int i = 0;i < navigator.count(); i++) {
282 AddressSpace* as = navigator.item(i);
283 wxString name = WxConversion::toWxString(as->name());
284 addressSpaceChoice_->Append(name);
285 }
286
287 if (gcu_->addressSpace() != NULL) {
288
289 wxString asName =
291
292 addressSpaceChoice_->SetStringSelection(asName);
293
294 } else {
295 addressSpaceChoice_->SetStringSelection(ProDeConstants::NONE);
296 }
297}
298
299
300/**
301 * Updates the Return address port choicer when the return address port
302 * choicer selection is changed.
303 */
304void
306
307 wxString selection = raPortChoice_->GetStringSelection();
308
309 raPortChoice_->Clear();
311 raPortChoice_->SetSelection(0);
312
313 for (int i = 0; i < gcu_->specialRegisterPortCount(); i++) {
315 string portName = port->name();
316 raPortChoice_->Append(WxConversion::toWxString(portName));
317
318 if (gcu_->hasReturnAddressPort() &&
319 port == gcu_->returnAddressPort()) {
320
321 raPortChoice_->SetStringSelection(
322 WxConversion::toWxString(portName));
323 }
324 }
325}
326
327
328/**
329 * Updates 'Ports' list control.
330 *
331 * Clears all items from the choicer and adds all ports.
332 */
333void
335
336 portList_->DeleteAllItems();
337
338 // Current list index is stored in a separate variable because of
339 // possible omitting of the return address port.
340 int index = 0;
341 for (int i = 0; i < gcu_->portCount(); i++) {
342
343 BaseFUPort* port = gcu_->port(i);
344
345 bool triggers = port->isTriggering();
346 string width = Conversion::toString(port->width());
347 string name = port->name();
348
349 // set asterisk symbol in the "T" column if port triggers
350 if (!triggers) {
351 portList_->InsertItem(index, _T(""), 0);
352 } else {
353 portList_->InsertItem(index, _T("*"), 0);
354 }
355
356 // set asterisk symbol in the "SRP" column if the port is
357 // a special register port
358 if (gcu_->hasSpecialRegisterPort(port->name())) {
359 portList_->SetItem(index, 1, _T("*"));
360 } else {
361 portList_->SetItem(index, 1, _T(""));
362 }
363
364 portList_->SetItem(index, 2, WxConversion::toWxString(name));
365 portList_->SetItem(index, 3, WxConversion::toWxString(width));
366
367 index++;
368 }
369 wxListEvent dummy;
371}
372
373
374/**
375 * Validates input in the controls, and updates the ControlUnit.
376 */
377void
378GCUDialog::onOK(wxCommandEvent&) {
379
380 if (!Validate()) {
381 return;
382 }
383
384 if (!TransferDataFromWindow()) {
385 return;
386 }
387
388 string trimmedName =
389 WxConversion::toString(name_.Trim(false).Trim(true));
390
391 // Check the name validity.
392 if (!MachineTester::isValidComponentName(trimmedName)) {
394 format message =
396 InformationDialog warning(
397 this, WxConversion::toWxString(message.str()));
398 warning.ShowModal();
399 return;
400 }
401
402 // Check that the name is not reserved for another FU.
403 if (trimmedName != gcu_->name()) {
406 for (int i = 0; i < navigator.count(); i++) {
407 FunctionUnit* fu = navigator.item(i);
408 if (trimmedName == fu->name()) {
409 ProDeTextGenerator* prodeTexts =
411 format message =
413 format a_fu =
415 format machine =
417 format gcu = prodeTexts->text(ProDeTextGenerator::COMP_GCU);
418 message % trimmedName % a_fu.str() % machine.str() % gcu.str();
419 WarningDialog warning(
420 this, WxConversion::toWxString(message.str()));
421 warning.ShowModal();
422 return;
423 }
424 }
425 }
426
427 try {
428 gcu_->setName(trimmedName);
431 } catch (Exception& e) {
432 InformationDialog dialog(
434 dialog.ShowModal();
435 return;
436 }
437
438 // set GCU address space
439 string asName =
440 WxConversion::toString(addressSpaceChoice_->GetStringSelection());
441
443
446
447 assert(asNavigator.hasItem(asName));
448 AddressSpace* addressSpace = asNavigator.item(asName);
449 gcu_->setAddressSpace(addressSpace);
450
451 } else {
452 // no address space set
453 gcu_->setAddressSpace(NULL);
454 }
455
456 EndModal(wxID_OK);
457}
458
459
460/**
461 * Checks whether the name field is empty, and disables OK button of the
462 * dialog if it is.
463 */
464void
465GCUDialog::onName(wxCommandEvent&) {
466 if (!TransferDataFromWindow()) {
467 assert(false);
468 }
469 wxString trimmedName = name_.Trim(false).Trim(true);
470 if (trimmedName == _T("")) {
471 FindWindow(wxID_OK)->Disable();
472 } else {
473 FindWindow(wxID_OK)->Enable();
474 }
475}
476
477
478
479/**
480 * Creates and shows an empty Operation Dialog for adding operations.
481 */
482void
484 ObjectState* gcu = gcu_->saveState();
485
486 // Generate name for the new operation.
487 int i = 1;
490 while (gcu_->hasOperation(newName)) {
493 i++;
494 }
495
496 HWOperation* operation = new HWOperation(newName, *gcu_);
497 OperationDialog dialog(this, operation);
498 if (dialog.ShowModal() == wxID_OK) {
499 delete gcu;
500 } else {
501 gcu_->loadState(gcu);
502 }
504}
505
506
507/**
508 * Deletes selected operation from the operation list.
509 */
510void
513 if (name == "") {
514 return;
515 }
516 delete gcu_->operation(name);
518}
519
520
521/**
522 * Handles the 'Edit Operation' button event.
523 *
524 * Opens a OperationDialog with the selected operation's attributes set.
525 */
526void
528
529 HWOperation* selected = selectedOperation();
530 if (selected == NULL) {
531 // No operation selected.
532 return;
533 }
534
535 ObjectState* gcu = gcu_->saveState();
536 OperationDialog dialog(this, selected);
537 if (dialog.ShowModal() == wxID_OK) {
538 delete gcu;
539 } else {
540 gcu_->loadState(gcu);
541 }
543}
544
545
546/**
547 * Returns pointer to the operation, which is selected on the operation list.
548 *
549 * @return Pointer to the selected operation.
550 */
554 if (name == "") {
555 return NULL;
556 }
557 return gcu_->operation(name);
558}
559
560
561/**
562 * Disables and enables Edit and Delete buttons under the operation list.
563 *
564 * If a operation is selected, buttons are enabled. If no operation is
565 * selected the buttons will be disabled.
566 *
567 * @param event ListEvent, which may have changed the selection.
568 */
569void
571 if (operationList_->GetSelectedItemCount() != 1) {
573 FindWindow(ID_EDIT_OPERATION)->Disable();
574 return;
575 }
577 FindWindow(ID_EDIT_OPERATION)->Enable();
578}
579
580
581/**
582 * Updates the operation list.
583 */
584void
586 operationList_->DeleteAllItems();
587 for (int i=0; i < gcu_->operationCount(); i++) {
588 wxString name = WxConversion::toWxString(gcu_->operation(i)->name());
589 operationList_->InsertItem(0, name);
590 }
591 wxListEvent dummy;
593}
594
595
596/**
597 * Opens a pop-up menu when right mouse button was pressed on the
598 * operation list.
599 *
600 * @param event Information about right mouse click event.
601 */
602void
604
605 operationList_->SetItemState(event.GetIndex(), wxLIST_STATE_SELECTED,
606 wxLIST_STATE_SELECTED);
607
608 wxMenu* contextMenu = new wxMenu();
609
611 format button = prodeTexts->text(
613 contextMenu->Append(
615 button = prodeTexts->text(
617 contextMenu->Append(
619 operationList_->PopupMenu(contextMenu, event.GetPoint());
620}
621
622
623/**
624 * Handles left mouse button double clicks on the operation list.
625 */
626void
628 wxCommandEvent dummy;
630}
631
632
633
634/**
635 * Creates and shows an empty Function Unit Port Dialog for adding ports.
636 */
637void
638GCUDialog::onAddFUPort(wxCommandEvent&) {
639
640 // Generate name for the new port.
641 int i = 1;
644 while (gcu_->hasPort(newName)) {
647 i++;
648 }
649
650 FUPort* port = new FUPort(
651 newName, ModelConstants::DEFAULT_WIDTH, *gcu_, false, false);
652 FUPortDialog portDialog(this, port);
653 if (portDialog.ShowModal() == wxID_CANCEL) {
654 // adding port was cancelled
655 delete port;
656 }
658}
659
660
661/**
662 * Creates and shows an empty Special Register Port Dialog for adding ports.
663 */
664void
665GCUDialog::onAddSRPort(wxCommandEvent&) {
666
667 // Generate name for the new port.
668 int i = 1;
671 while (gcu_->hasPort(newName)) {
674 i++;
675 }
676
679
680 SRPortDialog portDialog(this, port);
681 if (portDialog.ShowModal() == wxID_CANCEL) {
682 // adding port was cancelled
683 delete port;
684 }
687}
688
689
690/**
691 * Deletes selected port from the port list.
692 */
693void
694GCUDialog::onDeletePort(wxCommandEvent&) {
695 Port* selected = selectedPort();
696 if (selected == NULL) {
697 return;
698 }
699 delete selected;
702}
703
704
705/**
706 * Returns a pointer to the port selected in the port list.
707 *
708 * @return Pointer to the port selected in the port list.
709 */
713 if (name == "") {
714 return NULL;
715 }
716 BaseFUPort* port = gcu_->port(name);
717 return port;
718}
719
720
721/**
722 * Handles the 'Edit Port' button event.
723 *
724 * Opens a FUPortDialog with the selected port set.
725 */
726void
727GCUDialog::onEditPort(wxCommandEvent&) {
728 BaseFUPort* selected = selectedPort();
729 if (selected == NULL) {
730 return;
731 }
732
733 if (gcu_->hasSpecialRegisterPort(selected->name())) {
734 SpecialRegisterPort* port =
735 gcu_->specialRegisterPort(selected->name());
736 SRPortDialog portDialog(this, port);
737 portDialog.ShowModal();
738 } else if (gcu_->hasOperationPort(selected->name())) {
739 FUPort* port = gcu_->operationPort(selected->name());
740 FUPortDialog portDialog(this, port);
741 portDialog.ShowModal();
742 }
745}
746
747
748/**
749 * Disables and enables Edit and Delete buttons under the port list.
750 *
751 * If a port is selected, buttons are enabled. If no port is selected the
752 * buttons will be disabled.
753 *
754 * @param event ListEvent, which may have changed the selection.
755 */
756void
758 if (portList_->GetSelectedItemCount() != 1) {
759 FindWindow(ID_DELETE_PORT)->Disable();
760 FindWindow(ID_EDIT_PORT)->Disable();
761 return;
762 }
763 FindWindow(ID_DELETE_PORT)->Enable();
764 FindWindow(ID_EDIT_PORT)->Enable();
765}
766
767
768/**
769 * Opens a pop-up menu when right mouse button was pressed on the port list.
770 *
771 * @param event Information about right mouse click event.
772 */
773void
774GCUDialog::onPortRightClick(wxListEvent& event) {
775
776 portList_->SetItemState(event.GetIndex(), wxLIST_STATE_SELECTED,
777 wxLIST_STATE_SELECTED);
778
779 wxMenu* contextMenu = new wxMenu();
780
782 format button = prodeTexts->text(
784 contextMenu->Append(
786 button = prodeTexts->text(
788 contextMenu->Append(
790 portList_->PopupMenu(contextMenu, event.GetPoint());
791}
792
793
794/**
795 * Handles left mouse button double clicks on the port list.
796 */
797void
799 wxCommandEvent dummy;
801}
802
803
804/**
805 * Sets the return address port when return address port choicer selection
806 * changes.
807 */
808void
810
811 if (raPortChoice_->GetStringSelection() == ProDeConstants::NONE) {
813 return;
814 }
815
816 string selection =
817 WxConversion::toString(raPortChoice_->GetStringSelection());
818
819 SpecialRegisterPort* port = gcu_->specialRegisterPort(selection);
820
821 assert(port != NULL);
822
825}
826
827
828/**
829 * Creates the dialog window contents.
830 *
831 * This method was generated with wxDesigner, thus the ugly code and
832 * too long lines.
833 *
834 * @return Main sizer of the created contents.
835 * @param parent The dialog window.
836 * @param call_fit If true, fits the contents inside the dialog.
837 * @param set_sizer If true, sets the main sizer as dialog contents.
838 */
839wxSizer*
840GCUDialog::createContents(wxWindow *parent, bool call_fit, bool set_sizer) {
841
842 wxBoxSizer *item0 = new wxBoxSizer( wxVERTICAL );
843
844 wxBoxSizer *item1 = new wxBoxSizer( wxHORIZONTAL );
845
846 wxBoxSizer *item2 = new wxBoxSizer( wxVERTICAL );
847
848 wxFlexGridSizer *item3 = new wxFlexGridSizer( 2, 0, 0 );
849
850 wxStaticText *item4 = new wxStaticText( parent, ID_TEXT_NAME, wxT("Name:"), wxDefaultPosition, wxDefaultSize, 0 );
851 item3->Add( item4, 0, wxALL, 5 );
852
853 wxTextCtrl *item5 = new wxTextCtrl( parent, ID_NAME, wxT(""), wxDefaultPosition, wxSize(140,-1), 0 );
854 item3->Add( item5, 0, wxGROW|wxALL, 5 );
855
856 wxStaticText *item6 = new wxStaticText( parent, ID_TEXT_DS, wxT("Delay slots:"), wxDefaultPosition, wxDefaultSize, 0 );
857 item3->Add( item6, 0, wxALL, 5 );
858
859 wxSpinCtrl *item7 = new wxSpinCtrl( parent, ID_DELAY_SLOTS, wxT("1"), wxDefaultPosition, wxSize(-1,-1), 0, 0, 10000, 1 );
860 item3->Add( item7, 0, wxGROW|wxALL, 5 );
861
862 // global guard latency currently fixed at 1.
863 //wxStaticText *item8 = new wxStaticText( parent, ID_LABEL_GLOBAL_GUARD_LATENCY, wxT("Guard Latency:"), wxDefaultPosition, wxDefaultSize, 0 );
864 //item3->Add( item8, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
865
866 //wxSpinCtrl *item9 = new wxSpinCtrl( parent, ID_GUARD_LATENCY, wxT("0"), wxDefaultPosition, wxSize(100,-1), 0, 0, 1000, 0 );
867 //item3->Add( item9, 0, wxGROW|wxALL, 5 );
868
869 wxStaticText *item10 = new wxStaticText( parent, ID_TEXT_AS, wxT("Address Space:"), wxDefaultPosition, wxDefaultSize, 0 );
870 item3->Add( item10, 0, wxALL, 5 );
871
872 wxString *strs11 = (wxString*) NULL;
873 wxChoice *item11 = new wxChoice( parent, ID_ADDRESS_SPACE, wxDefaultPosition, wxSize(100,-1), 0, strs11, 0 );
874 item3->Add( item11, 0, wxGROW|wxALL, 5 );
875
876 item2->Add( item3, 0, wxALL, 5 );
877
878 wxStaticBox *item13 = new wxStaticBox( parent, -1, wxT("Operations:") );
879 wxStaticBoxSizer *item12 = new wxStaticBoxSizer( item13, wxVERTICAL );
880 operationsSizer_ = item12;
881
882 wxListCtrl *item14 = new wxListCtrl( parent, ID_OPERATION_LIST, wxDefaultPosition, wxSize(300,200), wxLC_REPORT|wxLC_SINGLE_SEL|wxSUNKEN_BORDER );
883 item12->Add( item14, 0, wxGROW|wxALL, 5 );
884
885 wxBoxSizer *item15 = new wxBoxSizer( wxHORIZONTAL );
886
887 wxButton *item16 = new wxButton( parent, ID_ADD_OPERATION, wxT("&Add..."), wxDefaultPosition, wxDefaultSize, 0 );
888 item15->Add( item16, 0, wxALIGN_CENTER|wxALL, 5 );
889
890 wxButton *item17 = new wxButton( parent, ID_EDIT_OPERATION, wxT("&Edit..."), wxDefaultPosition, wxDefaultSize, 0 );
891 item15->Add( item17, 0, wxALIGN_CENTER|wxALL, 5 );
892
893 wxButton *item18 = new wxButton( parent, ID_DELETE_OPERATION, wxT("&Delete"), wxDefaultPosition, wxDefaultSize, 0 );
894 item15->Add( item18, 0, wxALIGN_CENTER|wxALL, 5 );
895
896 item12->Add( item15, 0, wxALIGN_CENTER|wxALL, 5 );
897
898 item2->Add( item12, 0, wxGROW|wxALL, 5 );
899
900 item1->Add( item2, 0, wxGROW|wxALL, 5 );
901
902 wxStaticBox *item20 = new wxStaticBox( parent, -1, wxT("Ports:") );
903 wxStaticBoxSizer *item19 = new wxStaticBoxSizer( item20, wxVERTICAL );
904 portListSizer_ = item19;
905
906 wxBoxSizer *item21 = new wxBoxSizer( wxVERTICAL );
907
908 wxListCtrl *item22 = new wxListCtrl( parent, ID_PORT_LIST, wxDefaultPosition, wxSize(300,180), wxLC_REPORT|wxSUNKEN_BORDER );
909 item21->Add( item22, 0, wxGROW|wxALL, 5 );
910
911 wxBoxSizer *item23 = new wxBoxSizer( wxHORIZONTAL );
912
913 wxButton *item24 = new wxButton( parent, ID_EDIT_PORT, wxT("Edit..."), wxDefaultPosition, wxDefaultSize, 0 );
914 item23->Add( item24, 0, wxALIGN_CENTER|wxALL, 5 );
915
916 wxButton *item25 = new wxButton( parent, ID_DELETE_PORT, wxT("Delete"), wxDefaultPosition, wxDefaultSize, 0 );
917 item23->Add( item25, 0, wxALIGN_CENTER|wxALL, 5 );
918
919 item21->Add( item23, 0, 0, 5 );
920
921 wxBoxSizer *item26 = new wxBoxSizer( wxHORIZONTAL );
922
923 wxButton *item27 = new wxButton( parent, ID_ADD_FU_PORT, wxT("Add operation port..."), wxDefaultPosition, wxDefaultSize, 0 );
924 item26->Add( item27, 0, wxALIGN_CENTER|wxALL, 5 );
925
926 wxButton *item28 = new wxButton( parent, ID_ADD_SR_PORT, wxT("Add special register port..."), wxDefaultPosition, wxDefaultSize, 0 );
927 item26->Add( item28, 0, wxALIGN_CENTER|wxALL, 5 );
928
929 item21->Add( item26, 0, wxALIGN_CENTER|wxALL, 5 );
930
931 wxStaticLine *item29 = new wxStaticLine( parent, ID_LINE, wxDefaultPosition, wxSize(20,-1), wxLI_HORIZONTAL );
932 item21->Add( item29, 0, wxGROW|wxALL, 5 );
933
934 wxFlexGridSizer *item30 = new wxFlexGridSizer( 2, 0, 0 );
935
936 wxStaticText *item31 = new wxStaticText( parent, ID_LABEL_RA_CHOICE, wxT("Return address port:"), wxDefaultPosition, wxDefaultSize, 0 );
937 item30->Add( item31, 0, wxALIGN_CENTER|wxALL, 5 );
938
939 wxString strs32[] =
940 {
941 wxT("NONE")
942 };
943 wxChoice *item32 = new wxChoice( parent, ID_RA_CHOICE, wxDefaultPosition, wxSize(120,-1), 1, strs32, 0 );
944 item30->Add( item32, 0, wxALIGN_CENTER|wxALL, 5 );
945
946 item21->Add( item30, 0, wxGROW|wxALL, 5 );
947
948 wxStaticLine *item35 = new wxStaticLine( parent, ID_LINE, wxDefaultPosition, wxSize(20,-1), wxLI_HORIZONTAL );
949 item21->Add( item35, 0, wxGROW|wxALL, 5 );
950
951 item19->Add( item21, 0, wxGROW|wxALL, 5 );
952
953 item1->Add( item19, 0, wxGROW|wxALL, 5 );
954
955 item0->Add( item1, 0, wxALIGN_CENTER|wxALL, 5 );
956
957 wxStaticLine *item36 = new wxStaticLine( parent, ID_LINE, wxDefaultPosition, wxSize(20,-1), wxLI_HORIZONTAL );
958 item0->Add( item36, 0, wxGROW|wxALL, 5 );
959
960 wxGridSizer *item37 = new wxGridSizer( 2, 0, 0 );
961
962 wxButton *item38 = new wxButton( parent, ID_HELP, wxT("&Help"), wxDefaultPosition, wxDefaultSize, 0 );
963 item37->Add( item38, 0, wxALL, 5 );
964
965 wxBoxSizer *item39 = new wxBoxSizer( wxHORIZONTAL );
966
967 wxButton *item40 = new wxButton( parent, wxID_OK, wxT("&OK"), wxDefaultPosition, wxDefaultSize, 0 );
968 item39->Add( item40, 0, wxALIGN_CENTER|wxALL, 5 );
969
970 wxButton *item41 = new wxButton( parent, wxID_CANCEL, wxT("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
971 item39->Add( item41, 0, wxALIGN_CENTER|wxALL, 5 );
972
973 item37->Add( item39, 0, wxALL, 5 );
974
975 item0->Add( item37, 0, wxGROW|wxLEFT|wxRIGHT, 5 );
976
977 if (set_sizer)
978 {
979 parent->SetSizer( item0 );
980 if (call_fit)
981 item0->SetSizeHints( parent );
982 }
983
984 return item0;
985}
#define assert(condition)
END_EVENT_TABLE() using namespace IDF
TTAMachine::Machine * machine
the architecture definition of the estimated processor
FUImplementationDialog::onAddExternalPort FUImplementationDialog::onDeleteExternalPort FUImplementationDialog::onArchPortSelection EVT_LIST_ITEM_DESELECTED(ID_ARCH_PORT_LIST, FUImplementationDialog::onArchPortSelection) EVT_LIST_ITEM_ACTIVATED(ID_ARCH_PORT_LIST
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
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
EVT_BUTTON(ID_EDIT_ARCH_PORT, FUImplementationDialog::onEditArchitecturePort) EVT_BUTTON(ID_ADD_EXTERNAL_PORT
SimValue dummy(32)
a dummy simvalue which is given for operands that are not bound
static std::string toString(const T &source)
std::string errorMessage() const
Definition Exception.cc:123
void updateRAPortChoice()
Definition GCUDialog.cc:305
void updatePortList()
Definition GCUDialog.cc:334
void onOK(wxCommandEvent &event)
Definition GCUDialog.cc:378
void onEditOperation(wxCommandEvent &event)
Definition GCUDialog.cc:527
void onAddOperation(wxCommandEvent &event)
Definition GCUDialog.cc:483
void onPortSelection(wxListEvent &event)
Definition GCUDialog.cc:757
virtual bool TransferDataToWindow()
Definition GCUDialog.cc:247
wxStaticBoxSizer * operationsSizer_
Box sizer for the operations list controls.
Definition GCUDialog.hh:106
wxChoice * addressSpaceChoice_
Address Space choice control.
Definition GCUDialog.hh:96
@ ID_ADD_OPERATION
Definition GCUDialog.hh:122
@ ID_LABEL_RA_CHOICE
Definition GCUDialog.hh:136
@ ID_EDIT_OPERATION
Definition GCUDialog.hh:123
@ ID_ADDRESS_SPACE
Definition GCUDialog.hh:116
@ ID_OPERATION_LIST
Definition GCUDialog.hh:117
@ ID_DELETE_OPERATION
Definition GCUDialog.hh:124
void onAddFUPort(wxCommandEvent &event)
Definition GCUDialog.cc:638
void onActivatePort(wxListEvent &event)
Definition GCUDialog.cc:798
wxChoice * raPortChoice_
Return address port choice control.
Definition GCUDialog.hh:98
void onDeletePort(wxCommandEvent &event)
Definition GCUDialog.cc:694
void setLabels()
Definition GCUDialog.cc:158
int delaySlots_
Number of delay slots of the global control unit.
Definition GCUDialog.hh:91
wxListCtrl * operationList_
Operation list widget.
Definition GCUDialog.hh:101
TTAMachine::HWOperation * selectedOperation()
Definition GCUDialog.cc:552
void onOperationRightClick(wxListEvent &event)
Definition GCUDialog.cc:603
void onDeleteOperation(wxCommandEvent &event)
Definition GCUDialog.cc:511
void onEditPort(wxCommandEvent &event)
Definition GCUDialog.cc:727
wxSizer * createContents(wxWindow *parent, bool call_fit, bool set_sizer)
Definition GCUDialog.cc:840
void onActivateOperation(wxListEvent &event)
Definition GCUDialog.cc:627
TTAMachine::BaseFUPort * selectedPort()
Definition GCUDialog.cc:711
wxString name_
Name of the global control unit.
Definition GCUDialog.hh:89
wxStaticBoxSizer * portListSizer_
Box sizer for the port list controls.
Definition GCUDialog.hh:108
TTAMachine::ControlUnit * gcu_
The Global Control Unit to be modified with the dialog.
Definition GCUDialog.hh:87
wxListCtrl * portList_
Port list widget.
Definition GCUDialog.hh:103
void onPortRightClick(wxListEvent &event)
Definition GCUDialog.cc:774
void updateOperationList()
Definition GCUDialog.cc:585
int guardLatency_
Guard latency of the gcu.
Definition GCUDialog.hh:93
void updateAddressSpaceChoice()
Definition GCUDialog.cc:272
void onRAPortChoice(wxCommandEvent &event)
Definition GCUDialog.cc:809
void onOperationSelection(wxListEvent &event)
Definition GCUDialog.cc:570
virtual ~GCUDialog()
Definition GCUDialog.cc:150
void onAddSRPort(wxCommandEvent &event)
Definition GCUDialog.cc:665
void onName(wxCommandEvent &event)
Definition GCUDialog.cc:465
@ TXT_BUTTON_EDIT_DIALOG
Label for edit button (with trailing ...).
@ TXT_BUTTON_ADD_DIALOG
Label for add button (with trailing ...).
@ TXT_BUTTON_HELP
Label for help button.
@ TXT_BUTTON_DELETE
Label for delete button.
@ TXT_BUTTON_CANCEL
Label for cancel button.
@ TXT_BUTTON_OK
Label for OK button.
static GUITextGenerator * instance()
static bool isValidComponentName(const std::string &name)
static const int DEFAULT_WIDTH
Default bit width.
static const wxString NONE
Constant for "None".
static const std::string COMP_NEW_NAME_PREFIX_PORT
Prefix for new port names.
static const std::string COMP_NEW_NAME_PREFIX_OPERATION
Prefix for new operation names.
static ProDeTextGenerator * instance()
@ MSG_ERROR_SAME_NAME
Error: Same name exists.
@ MSG_ERROR_ILLEGAL_NAME
Error: Illegal component name.
@ TXT_GCU_DIALOG_TITLE
GCU Dialog title.
@ TXT_LABEL_BUTTON_EDIT
Label for &Edit... button.
@ TXT_LABEL_NAME
Label for component name widget.
@ COMP_A_FUNCTION_UNIT
Name for FU (w/ article).
@ TXT_LABEL_ADDRESS_SPACE
Label for address spave selector.
@ TXT_COLUMN_WIDTH
Label for width column in a list.
@ TXT_GCU_DELAY_SLOTS
Delay slots control label.
@ TXT_BUTTON_ADD_FU_PORT
Label for GCUdlg add SR port btn.
@ COMP_MACHINE
Text for machine description.
@ TXT_LABEL_BUTTON_DELETE
Label for &Delete button.
@ TXT_GCU_PORTS_BOX
Port list box title.
@ TXT_BUTTON_ADD_SR_PORT
Label for GCUdlg add FU port btn.
@ TXT_COLUMN_TRIGGERS
Label for T column in a list.
@ TXT_COLUMN_SRP
Label for sp.reg. port column.
@ TXT_COLUMN_NAME
Label for name column in a list.
@ COMP_GCU
Name for control unit.
virtual int width() const
virtual bool isTriggering() const =0
virtual Machine * machine() const
virtual TCEString name() const
SpecialRegisterPort * returnAddressPort() const
virtual ObjectState * saveState() const
void setGlobalGuardLatency(int latency)
SpecialRegisterPort * specialRegisterPort(int index) const
void setDelaySlots(int delaySlots)
bool hasReturnAddressPort() const
int globalGuardLatency() const
void setReturnAddressPort(const SpecialRegisterPort &port)
bool hasSpecialRegisterPort(const std::string &name) const
int specialRegisterPortCount() const
virtual void loadState(const ObjectState *state)
virtual AddressSpace * addressSpace() const
virtual HWOperation * operation(const std::string &name) const
virtual int operationCount() const
virtual FUPort * operationPort(const std::string &name) const
virtual void setAddressSpace(AddressSpace *as)
virtual bool hasOperationPort(const std::string &name) const
virtual bool hasOperation(const std::string &name) const
virtual void setName(const std::string &name)
virtual BaseFUPort * port(const std::string &name) const
const std::string & name() const
ComponentType * item(int index) const
bool hasItem(const std::string &name) const
virtual FunctionUnitNavigator functionUnitNavigator() const
Definition Machine.cc:380
virtual AddressSpaceNavigator addressSpaceNavigator() const
Definition Machine.cc:392
virtual std::string name() const
Definition Port.cc:141
virtual bool hasPort(const std::string &name) const
Definition Unit.cc:96
virtual int portCount() const
Definition Unit.cc:135
virtual boost::format text(int textId)
static void setWidgetLabel(wxWindow *widget, std::string text)
static void setLabel(Texts::TextGenerator *generator, wxWindow *widget, int textID)
static std::string lcStringSelection(wxListCtrl *list, int column)
static wxString toWxString(const std::string &source)
static std::string toString(const wxString &source)