OpenASIP 2.2
Loading...
Searching...
No Matches
BusDialog.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 BusDialog.cc
26 *
27 * Definition of BusDialog class.
28 *
29 * @author Veli-Pekka Jääskeläinen 2004 (vjaaskel-no.spam-cs.tut.fi)
30 * @note rating: red
31 */
32
33#include <wx/wx.h>
34#include <wx/listctrl.h>
35#include <wx/radiobox.h>
36#include <wx/spinctrl.h>
37#include <boost/format.hpp>
38
39#include "BusDialog.hh"
40#include "Bus.hh"
41#include "Segment.hh"
42#include "Guard.hh"
43#include "Conversion.hh"
44#include "WxConversion.hh"
45#include "WarningDialog.hh"
46#include "ErrorDialog.hh"
47#include "InformationDialog.hh"
48#include "Machine.hh"
49#include "MachineTester.hh"
50#include "UserManualCmd.hh"
51#include "ProDeConstants.hh"
52#include "FUPort.hh"
53#include "RFGuardDialog.hh"
54#include "FUGuardDialog.hh"
55#include "ModelConstants.hh"
56#include "WidgetTools.hh"
57#include "GUITextGenerator.hh"
58#include "ProDeTextGenerator.hh"
59
60using boost::format;
61using std::string;
62using namespace TTAMachine;
63
64BEGIN_EVENT_TABLE(BusDialog, wxDialog)
65 EVT_TEXT(ID_SEGMENT_NAME, BusDialog::onSegmentName)
66 EVT_TEXT(ID_BUS_NAME, BusDialog::onBusName)
67 EVT_BUTTON(ID_ADD_SEGMENT, BusDialog::onAddSegment)
68 EVT_BUTTON(ID_DELETE_SEGMENT, BusDialog::onDeleteSegment)
70 EVT_BUTTON(ID_SEGMENT_DOWN, BusDialog::onSegmentDown)
71 EVT_MENU(ID_DELETE_SEGMENT, BusDialog::onDeleteSegment)
72 EVT_LIST_ITEM_RIGHT_CLICK(ID_SEGMENT_LIST, BusDialog::onSegmentRightClick)
73
75
76 EVT_SPINCTRL(ID_BUS_WIDTH, BusDialog::onWidth)
77
78 EVT_BUTTON(ID_ADD_RF_GUARD, BusDialog::onAddRFGuard)
79 EVT_BUTTON(ID_DELETE_RF_GUARD, BusDialog::onDeleteRFGuard)
80 EVT_BUTTON(ID_EDIT_RF_GUARD, BusDialog::onEditRFGuard)
81
82 EVT_BUTTON(ID_ADD_FU_GUARD, BusDialog::onAddFUGuard)
83 EVT_BUTTON(ID_DELETE_FU_GUARD, BusDialog::onDeleteFUGuard)
84 EVT_BUTTON(ID_EDIT_FU_GUARD, BusDialog::onEditFUGuard)
85
86 EVT_CHECKBOX(ID_FALSE_GUARD, BusDialog::onUnconditionalGuard)
87 EVT_CHECKBOX(ID_TRUE_GUARD, BusDialog::onUnconditionalGuard)
88
89 EVT_LIST_ITEM_FOCUSED(ID_SEGMENT_LIST, BusDialog::onSegmentSelection)
90 EVT_LIST_DELETE_ITEM(ID_SEGMENT_LIST, BusDialog::onSegmentSelection)
93
94 EVT_LIST_ITEM_FOCUSED(ID_RF_GUARD_LIST, BusDialog::onRFGuardSelection)
95 EVT_LIST_DELETE_ITEM(ID_RF_GUARD_LIST, BusDialog::onRFGuardSelection)
98
99 EVT_LIST_ITEM_FOCUSED(ID_FU_GUARD_LIST, BusDialog::onFUGuardSelection)
100 EVT_LIST_DELETE_ITEM(ID_FU_GUARD_LIST, BusDialog::onFUGuardSelection)
103
105 EVT_LIST_ITEM_RIGHT_CLICK(ID_RF_GUARD_LIST, BusDialog::onRFGuardRightClick)
107 EVT_LIST_ITEM_RIGHT_CLICK(ID_FU_GUARD_LIST, BusDialog::onFUGuardRightClick)
108
109 EVT_MENU(ID_DELETE_RF_GUARD, BusDialog::onDeleteRFGuard)
110 EVT_MENU(ID_EDIT_RF_GUARD, BusDialog::onEditRFGuard)
111 EVT_MENU(ID_DELETE_FU_GUARD, BusDialog::onDeleteFUGuard)
112 EVT_MENU(ID_EDIT_FU_GUARD, BusDialog::onEditFUGuard)
114
115
116/**
117 * The Constructor.
118 *
119 * @param parent Parent window of the dialog.
120 * @param bus Transport bus to be modified with the dialog.
121 */
123 wxWindow* parent,
124 Bus* bus):
125 wxDialog(parent, -1, _T(""), wxDefaultPosition, wxSize(300, 300)),
126 bus_(bus),
127 name_(_T("")),
129 immWidth_(ModelConstants::DEFAULT_WIDTH),
130 newSegName_(_T("")),
131 alwaysTrueGuard_(NULL),
132 alwaysFalseGuard_(NULL),
133 immediateExtensionBox_(NULL),
134 rfGuardList_(NULL),
135 fuGuardList_(NULL) {
136
137 createContents(this, true, true);
138
139 FindWindow(wxID_OK)->Disable();
140 FindWindow(ID_ADD_SEGMENT)->Disable();
141 FindWindow(ID_DELETE_SEGMENT)->Disable();
142 FindWindow(ID_SEGMENT_UP)->Disable();
143 FindWindow(ID_SEGMENT_DOWN)->Disable();
144 FindWindow(ID_EDIT_RF_GUARD)->Disable();
145 FindWindow(ID_DELETE_RF_GUARD)->Disable();
146 FindWindow(ID_EDIT_FU_GUARD)->Disable();
147 FindWindow(ID_DELETE_FU_GUARD)->Disable();
148
149 rfGuardList_ = dynamic_cast<wxListCtrl*>(FindWindow(ID_RF_GUARD_LIST));
150 fuGuardList_ = dynamic_cast<wxListCtrl*>(FindWindow(ID_FU_GUARD_LIST));
151 segList_ = dynamic_cast<wxListCtrl*>(FindWindow(ID_SEGMENT_LIST));
152
153 immediateExtensionBox_ =
154 dynamic_cast<wxRadioBox*>(FindWindow(ID_SI_EXTENSION));
155 alwaysTrueGuard_ =
156 dynamic_cast<wxCheckBox*>(FindWindow(ID_TRUE_GUARD));
157 alwaysFalseGuard_ =
158 dynamic_cast<wxCheckBox*>(FindWindow(ID_FALSE_GUARD));
159
160 FindWindow(ID_BUS_NAME)->SetValidator(
161 wxTextValidator(wxFILTER_ASCII, &name_));
162 FindWindow(ID_SEGMENT_NAME)->SetValidator(
163 wxTextValidator(wxFILTER_ASCII, &newSegName_));
164 FindWindow(ID_BUS_WIDTH)->SetValidator(wxGenericValidator(&width_));
165 FindWindow(ID_SI_WIDTH)->SetValidator(wxGenericValidator(&immWidth_));
166
167 // set widget texts
168 setTexts();
169
170 TransferDataToWindow();
171
172 FindWindow(ID_BUS_NAME)->SetFocus();
173
174 // Editing segments is unsupported feature => hide segment ui
175 segmentSizer_->Show(false);
176 GetSizer()->SetSizeHints(this);
177}
178
179
180
181/**
182 * The Destructor.
183 */
186
187
188/**
189 *
190 */
191void
195
196 // Dialog title
197 format fmt = prodeTexts->text(ProDeTextGenerator::TXT_BUS_DIALOG_TITLE);
198
199 string title = fmt.str();
200 SetTitle(WxConversion::toWxString(title));
201
202 // buttons
203 WidgetTools::setLabel(generator, FindWindow(wxID_OK),
205
206 WidgetTools::setLabel(generator, FindWindow(wxID_CANCEL),
208
211
214
217
220
223
226
229
232
235
238
241
242 // widget labels
245
248
251
254
257
260
263
264 // Radio button labels
266 immediateExtensionBox_->SetString(0, WxConversion::toWxString(fmt.str()));
268 immediateExtensionBox_->SetString(1, WxConversion::toWxString(fmt.str()));
269
270 // box sizer labels
271 fmt = prodeTexts->text(ProDeTextGenerator::TXT_BUS_BUS_BOX);
272 string label = fmt.str();
274
276 label = fmt.str();
278
279 fmt = prodeTexts->text(ProDeTextGenerator::TXT_BUS_SI_BOX);
280 label = fmt.str();
282
283 fmt = prodeTexts->
285 label = fmt.str();
287
289 label = fmt.str();
291
292 // Create segment list columns.
293 wxListCtrl* segmentList =
294 dynamic_cast<wxListCtrl*>(FindWindow(ID_SEGMENT_LIST));
295 wxListCtrl* rfGuardList =
296 dynamic_cast<wxListCtrl*>(FindWindow(ID_RF_GUARD_LIST));
297 wxListCtrl* fuGuardList =
298 dynamic_cast<wxListCtrl*>(FindWindow(ID_FU_GUARD_LIST));
299
301 string invLabel = fmt.str();
302
303 fmt = prodeTexts->text(ProDeTextGenerator::TXT_COLUMN_NAME);
304 string nameLabel = fmt.str();
305
307 string indexLabel = fmt.str();
308
309 fmt = prodeTexts->text(ProDeTextGenerator::TXT_COLUMN_PORT);
310 string portLabel = fmt.str();
311
312 segmentList->InsertColumn(0, WxConversion::toWxString(nameLabel),
313 wxLIST_FORMAT_LEFT, 280);
314
315 rfGuardList->InsertColumn(0, WxConversion::toWxString(nameLabel),
316 wxLIST_FORMAT_LEFT, 170);
317 rfGuardList->InsertColumn(1, WxConversion::toWxString(indexLabel),
318 wxLIST_FORMAT_LEFT, 70);
319 rfGuardList->InsertColumn(2, WxConversion::toWxString(invLabel),
320 wxLIST_FORMAT_LEFT, 40);
321
322 fuGuardList->InsertColumn(0, WxConversion::toWxString(invLabel),
323 wxLIST_FORMAT_LEFT, 40);
324 fuGuardList->InsertColumn(1, WxConversion::toWxString(nameLabel),
325 wxLIST_FORMAT_LEFT, 170);
326 fuGuardList->InsertColumn(2, WxConversion::toWxString(portLabel),
327 wxLIST_FORMAT_LEFT, 70);
328}
329
330
331/**
332 * Transfers the data from the bus model to the dialog controls.
333 *
334 * @return false, if an error occured in the transfer.
335 */
336bool
338
340 width_ = bus_->width();
342
343
344 // set extension
345 if (bus_->signExtends()) {
346 immediateExtensionBox_->SetStringSelection(
348 } else {
349 immediateExtensionBox_->SetStringSelection(
351 }
352
355
356 // wxWidgets GTK1 version seems to bug with spincontrol validators.
357 // The widget value has to be set manually.
358 dynamic_cast<wxSpinCtrl*>(FindWindow(ID_BUS_WIDTH))->SetValue(width_);
359 dynamic_cast<wxSpinCtrl*>(FindWindow(ID_SI_WIDTH))->SetValue(immWidth_);
360
361 wxSpinEvent dummy;
362 onWidth(dummy);
363
364 return wxWindow::TransferDataToWindow();
365}
366
367/**
368 * Defines how SortItems() does comparison between two items to sort the list.
369 *
370 * Order: names in ascending order. Within same name, index numbers in
371 * ascending order. Within same name and index number, non-inverted guard
372 * comes before inverted.
373 */
374int wxCALLBACK
375ListCompareFunction(long item1, long item2, long WXUNUSED(sortData))
376{
377 // items are set with SetItemData to contain pointers to the rf guards
378 RegisterGuard* rfGuard1 = (RegisterGuard*) item1;
379 RegisterGuard* rfGuard2 = (RegisterGuard*) item2;
380 assert (rfGuard1 != NULL);
381 assert (rfGuard2 != NULL);
382
383 string name1 = rfGuard1->registerFile()->name();
384 int index1 = rfGuard1->registerIndex();
385 bool inverted1 = rfGuard1->isInverted();
386
387 string name2 = rfGuard2->registerFile()->name();
388 int index2 = rfGuard2->registerIndex();
389 bool inverted2 = rfGuard2->isInverted();
390
391 if (name1 < name2) {
392 return -1;
393 } else if (name1 > name2) {
394 return 1;
395 } else if (index1 < index2) {
396 return -1;
397 } else if (index1 > index2) {
398 return 1;
399 } else if (!inverted1 && inverted2) {
400 return -1;
401 } else if (inverted1 && !inverted2) {
402 return 1;
403 }
404
405 return 0;
406}
407
408/**
409 * Updates the guard lists.
410 */
411void
413
414 assert (rfGuardList_ != NULL);
415 assert (fuGuardList_ != NULL);
416 rfGuardList_->DeleteAllItems();
417 fuGuardList_->DeleteAllItems();
418
419 registerGuards_.clear();
420 portGuards_.clear();
421
422 alwaysTrueGuard_->SetValue(false);
423 alwaysFalseGuard_->SetValue(false);
424
425 // add guards
426 for (int i = 0; i < bus_->guardCount(); i++) {
427
428 Guard* guard = bus_->guard(i);
429
430 UnconditionalGuard* unCondGuard =
431 dynamic_cast<UnconditionalGuard*>(guard);
432
433 RegisterGuard* rfGuard = dynamic_cast<RegisterGuard*>(guard);
434 PortGuard* fuGuard = dynamic_cast<PortGuard*>(guard);
435
436 if (unCondGuard != NULL) {
437 // unconditional guard
438 if (unCondGuard->isInverted()) {
439 alwaysFalseGuard_->SetValue(true);
440 } else {
441 alwaysTrueGuard_->SetValue(true);
442 }
443 } else if(rfGuard != NULL) {
444 // register guard
445 int index = registerGuards_.size();
446 registerGuards_.push_back(rfGuard);
447
448 string name = rfGuard->registerFile()->name();
449 int rfIndex = rfGuard->registerIndex();
450 rfGuardList_->InsertItem(index, WxConversion::toWxString(name));
451 rfGuardList_->SetItem(index, 1, WxConversion::toWxString(rfIndex));
452 if (rfGuard->isInverted()) {
453 rfGuardList_->SetItem(index, 2, _T("*"));
454 } else {
455 rfGuardList_->SetItem(index, 2, _T(" "));
456 }
457
458 // bind pointer to the guard as item data for future reference
459 rfGuardList_->SetItemData(index, (long)rfGuard);
460 } else if(fuGuard != NULL) {
461 // port guard
462 int index = portGuards_.size();
463 portGuards_.push_back(fuGuard);
464
465 if (fuGuard->isInverted()) {
466 fuGuardList_->InsertItem(index, _T("*"));
467 } else {
468 fuGuardList_->InsertItem(index, _T(" "));
469 }
470
471 string name = fuGuard->port()->parentUnit()->name();
472 fuGuardList_->SetItem(index, 1, WxConversion::toWxString(name));
473 name = fuGuard->port()->name();
474 fuGuardList_->SetItem(index, 2, WxConversion::toWxString(name));
475 }
476 }
477
478 // sort guard list with given function, data parameter is not needed
479 rfGuardList_->SortItems(ListCompareFunction, static_cast<long>(0));
480}
481
482/**
483 * Updates the segment list control.
484 */
485void
487 segList_->DeleteAllItems();
488
489 for (int i = bus_->segmentCount()-1;i > -1;i--) {
490 string segmentName = bus_->segment(i)->name();
491 segList_->InsertItem(0, WxConversion::toWxString(segmentName));
492 }
493}
494
495/**
496 * Returns pointer to the selected segment.
497 *
498 * Returns NULL if no segment is selected.
499 */
500Segment*
502
503 // search the selected segment in the segment list widget
504 Segment* selected = NULL;
505 for (int i = 0; i < segList_->GetItemCount(); i++) {
506 // search selected list item
507 if (segList_->GetItemState(i, wxLIST_STATE_SELECTED) != 0) {
508 string name = WxConversion::toString(segList_->GetItemText(i));
509 selected = bus_->segment(name);
510 }
511 }
512 return selected;
513}
514
515
516/**
517 * Returns pointer to the selected fu port guard.
518 *
519 * @return NULL if no port guard is selected.
520 */
523 long item = -1;
524 item = fuGuardList_->GetNextItem(
525 item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
526
527 if (item == -1) {
528 return NULL;
529 }
530
531 assert (item < int(portGuards_.size()));
532
533 return portGuards_[item];
534}
535
536
537/**
538 * Returns pointer to the selected register file guard.
539 *
540 * @return NULL if no register guard is selected.
541 */
544 long item = -1;
545 item = rfGuardList_->GetNextItem(
546 item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
547
548 if (item == -1) {
549 return NULL;
550 }
551
552 assert (item < int(registerGuards_.size()));
553
554 long itemData = rfGuardList_->GetItemData(item);
555 RegisterGuard* rfGuard = (RegisterGuard*)itemData;
556 assert (rfGuard != NULL);
557 return rfGuard;
558}
559
560
561
562
563/**
564 * Adds a new segment to the segment list.
565 */
566void
567BusDialog::onAddSegment(wxCommandEvent&) {
568
569 if (!TransferDataFromWindow()) {
570 return;
571 }
572 assert(newSegName_ != _T(""));
573
574 string trimmedName =
575 WxConversion::toString(newSegName_.Trim(false).Trim(true));
576
577 // Check the name validity.
578 if (!MachineTester::isValidComponentName(trimmedName)) {
580 format message =
582 InformationDialog warning(
583 this, WxConversion::toWxString(message.str()));
584 warning.ShowModal();
585 return;
586 }
587
588 // Check that the new segment's name is unique among the segments of
589 // the bus.
590 if (bus_->hasSegment(trimmedName)) {
592 format message =
594 format component =
596 format bus = prodeTexts->text(ProDeTextGenerator::COMP_BUS);
597 message % trimmedName % component.str() % bus.str();
598 component = prodeTexts->text(ProDeTextGenerator::COMP_SEGMENT);
599 message % component.str();
600 WarningDialog dialog(this, WxConversion::toWxString(message.str()));
601 dialog.ShowModal();
602 return;
603 }
604 new Segment(trimmedName, *bus_);
606
607 // clear the segment name control
608 dynamic_cast<wxTextCtrl*>(
609 FindWindow(ID_SEGMENT_NAME))->SetValue(_T(""));
610}
611
612
613/**
614 * Enables and disables OK button based on input in the bus name widget.
615 */
616void
617BusDialog::onBusName(wxCommandEvent&) {
618 if (!TransferDataFromWindow()) {
619 assert(false);
620 }
621 wxString trimmedName = name_.Trim(false).Trim(true);
622 if (trimmedName == _T("")) {
623 FindWindow(wxID_OK)->Disable();
624 } else {
625 FindWindow(wxID_OK)->Enable();
626 }
627}
628
629
630/**
631 * Handles the unconditional guard deletion/creation when
632 * true/false guard checkbox values are toggled.
633 */
634void
635BusDialog::onUnconditionalGuard(wxCommandEvent& event) {
636
637 bool inverted = false;
638 wxCheckBox* checkbox = alwaysTrueGuard_;
639
640 if (event.GetId() == ID_FALSE_GUARD) {
641 inverted = true;
642 checkbox = alwaysFalseGuard_;
643 }
644
645 if (!checkbox->GetValue()) {
646 for (int i = 0; i < bus_->guardCount(); i++) {
647 Guard* guard = bus_->guard(i);
648 UnconditionalGuard* unCondGuard =
649 dynamic_cast<UnconditionalGuard*>(guard);
650 if (unCondGuard != NULL &&
651 unCondGuard->isInverted() == inverted) {
652
653 delete unCondGuard;
654 }
655 }
656 } else {
657 try {
658 new UnconditionalGuard(inverted, *bus_);
659 } catch (Exception& e) {
661 format text = prodeTexts->text(ProDeTextGenerator::MSG_ERROR);
662 wxString message = WxConversion::toWxString(text.str());
663 message.Append(WxConversion::toWxString(e.errorMessage()));
664 ErrorDialog dialog(this, message);
665 dialog.ShowModal();
666 return;
667 }
668 }
669}
670
671/**
672 * Enables and disables add segment button based on input in the segment
673 * name widget.
674 */
675void
676BusDialog::onSegmentName(wxCommandEvent&) {
677 if (!TransferDataFromWindow()) {
678 assert(false);
679 }
680 wxString trimmedName = newSegName_.Trim(false).Trim(true);
681 if (trimmedName == _T("")) {
682 FindWindow(ID_ADD_SEGMENT)->Disable();
683 } else {
684 FindWindow(ID_ADD_SEGMENT)->Enable();
685 }
686}
687
688
689/**
690 * Disables segment deletion and move buttons if no segment is selected.
691 */
692void
694 if (segList_->GetSelectedItemCount() != 1) {
695 FindWindow(ID_DELETE_SEGMENT)->Disable();
696 FindWindow(ID_SEGMENT_UP)->Disable();
697 FindWindow(ID_SEGMENT_DOWN)->Disable();
698 return;
699 }
700 FindWindow(ID_DELETE_SEGMENT)->Enable();
701 FindWindow(ID_SEGMENT_UP)->Enable();
702 FindWindow(ID_SEGMENT_DOWN)->Enable();
703}
704
705
706/**
707 * Opens a pop-up menu when right mouse button was pressed.
708 *
709 * @param event Information about right mouse click event.
710 */
711void
713
714 segList_->SetItemState(event.GetIndex(), wxLIST_STATE_SELECTED,
715 wxLIST_STATE_SELECTED);
716
717 wxMenu* contextMenu = new wxMenu();
718
720 format button = prodeTexts->text(
722 contextMenu->Append(
724 segList_->PopupMenu(contextMenu, event.GetPoint());
725}
726
727
728/**
729 * Deletes the selected segment from the bus.
730 *
731 * The Segments before and after the deleted segments are connected to each
732 * other.
733 */
734void
736
737 Segment* selected = selectedSegment();
738 assert(selected != NULL);
739
740 delete selected;
742
743 wxListEvent dummy;
745}
746
747
748/**
749 * Moves selected segment one position up in the segment chain.
750 */
751void
752BusDialog::onSegmentUp(wxCommandEvent&) {
753 Segment* selected = selectedSegment();
754 assert (selected != NULL);
755
756 if (!selected->hasSourceSegment()) {
757 // Selected segment was first in the chain, do nothing.
758 return;
759 }
760
761 selected->moveBefore(*(selected->sourceSegment()));
763
764 // set the moved segment as selected
765 long i = segList_->FindItem(0, WxConversion::toWxString(selected->name()));
766 segList_->SetItemState(i,wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
767}
768
769
770
771/**
772 * Moves selected segment one position down in the segment chain.
773 */
774void
775BusDialog::onSegmentDown(wxCommandEvent&) {
776 Segment* selected = selectedSegment();
777 assert (selected != NULL);
778
779 if (!selected->hasDestinationSegment()) {
780 // Selected segment was first in the chain, do nothing.
781 return;
782 }
783
784 selected->moveAfter(*(selected->destinationSegment()));
786
787 // set the moved segment as selected
788 long i = segList_->FindItem(0, WxConversion::toWxString(selected->name()));
789 segList_->SetItemState(i,wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
790}
791
792
793/**
794 * Validates input in the controls, and updates the Bus object.
795 */
796void
797BusDialog::onOK(wxCommandEvent&) {
798
799 if (!Validate()) {
800 return;
801 }
802
803 if (!TransferDataFromWindow()) {
804 return;
805 }
806
807 // Check that the machine doesn't contain instruction templates with
808 // slots that are wider than the new bus width.
811 for (int i = 0; i < navigator.count(); i++) {
812 int slotWidth = navigator.item(i)->supportedWidth(bus_->name());
813 if (slotWidth != 0 && slotWidth > width_) {
814 ProDeTextGenerator* generator =
816 format message = generator->text(
818 message % navigator.item(i)->name();
819 message % slotWidth;
820 InformationDialog dialog(
821 this, WxConversion::toWxString(message.str()));
822 dialog.ShowModal();
823 return;
824 }
825 }
826
827 // Check the name validity.
828 string trimmedName =
829 WxConversion::toString(name_.Trim(false).Trim(true));
830 if (!MachineTester::isValidComponentName(trimmedName)) {
832 format message =
834 InformationDialog warning(
835 this, WxConversion::toWxString(message.str()));
836 warning.ShowModal();
837 return;
838 }
839
840 // Check that the new name is not reserved.
841 if (trimmedName != bus_->name()) {
842 const Machine::BusNavigator busNavigator =
844 if (busNavigator.hasItem(trimmedName)) {
846 format message =
848 message % trimmedName;
849 message % prodeTexts->text(ProDeTextGenerator::COMP_A_BUS).str();
850 message % prodeTexts->text(ProDeTextGenerator::COMP_MACHINE).str();
851 message % prodeTexts->text(ProDeTextGenerator::COMP_BUS).str();
852 WarningDialog warning(
853 this, WxConversion::toWxString(message.str()));
854 warning.ShowModal();
855 return;
856 }
857 // Immediate slots share namespace with busses, check that an immediate
858 // slot with the same name does not exist.
859 const Machine::ImmediateSlotNavigator immSlotNavigator =
861 if (immSlotNavigator.hasItem(trimmedName)) {
863 format message =
865 message % trimmedName;
866 message % prodeTexts->text(
868 message % prodeTexts->text(ProDeTextGenerator::COMP_MACHINE).str();
869 message % prodeTexts->text(ProDeTextGenerator::COMP_BUS).str();
870 WarningDialog warning(
871 this, WxConversion::toWxString(message.str()));
872 warning.ShowModal();
873 return;
874 }
875 }
876
879 bus_->setName(trimmedName);
880
881 if (immediateExtensionBox_->GetStringSelection().IsSameAs(
883
885 } else {
887 }
888
889 EndModal(wxID_OK);
890}
891
892
893/**
894 * Creates and shows a register file guard dialog for
895 * adding register file guards.
896 */
897void
898BusDialog::onAddRFGuard(wxCommandEvent&) {
901
902 if (navigator.count() < 1) {
904 format message =
906 InformationDialog dialog(this, WxConversion::toWxString(message.str()));
907 dialog.ShowModal();
908 return;
909 }
910
911 RFGuardDialog dialog(this, bus_);
912 dialog.ShowModal();
914}
915
916
917
918/**
919 * Deletes selected register file guards from the register file guards list.
920 */
921void
923 long item = -1;
924
925 // loop selected guards and delete them
926 for (int i = 0; i < rfGuardList_->GetSelectedItemCount(); ++i) {
927 item = rfGuardList_->GetNextItem(
928 item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
929
930 assert (item < static_cast<int>(registerGuards_.size()));
931
932 // retrieve item data (guard pointer) that is bound with the item
933 if (item >= 0) {
934 long itemData = rfGuardList_->GetItemData(item);
935 RegisterGuard* rfGuard = (RegisterGuard*)itemData;
936 if (rfGuard != NULL) {
937 delete rfGuard;
938 rfGuard = NULL;
939 }
940 }
941 }
942
944 wxListEvent dummy;
946
947 return;
948}
949
950
951
952/**
953 * Handles the 'Edit RFGuard' button event.
954 *
955 * Opens a RFGuardDialog with the selected guard's attributes set.
956 */
957void
958BusDialog::onEditRFGuard(wxCommandEvent&) {
960 if (guard == NULL) {
961 // No guard selected.
962 return;
963 }
964 RFGuardDialog dialog(this, bus_, guard);
965 dialog.ShowModal();
967}
968
969
970/**
971 * Disables and enables Edit and Delete buttons under the register
972 * file guard list.
973 *
974 * If a guard is selected, buttons are enabled. If no guard is
975 * selected the buttons will be disabled.
976 */
977void
979 if (rfGuardList_->GetSelectedItemCount() != 1) {
980 FindWindow(ID_EDIT_RF_GUARD)->Disable();
981 } else {
982 FindWindow(ID_EDIT_RF_GUARD)->Enable();
983 }
984
985 if (rfGuardList_->GetSelectedItemCount() < 1) {
986 FindWindow(ID_DELETE_RF_GUARD)->Disable();
987 } else {
989 }
990}
991
992
993/**
994 * Creates and shows an empty function unit port guard dialog for
995 * adding function unit port guards.
996 */
997void
998BusDialog::onAddFUGuard(wxCommandEvent&) {
1001
1002 bool portExists = false;
1003 for (int i = 0; i < navigator.count(); i++) {
1004 if (navigator.item(i)->portCount() > 0) {
1005 portExists = true;
1006 break;
1007 }
1008 }
1009
1010 if (!portExists) {
1012 format message =
1014 InformationDialog dialog(
1015 this, WxConversion::toWxString(message.str()));
1016 dialog.ShowModal();
1017 return;
1018 }
1019
1020 FUGuardDialog dialog(this, bus_);
1021 dialog.ShowModal();
1023}
1024
1025
1026
1027/**
1028 * Deletes selected function unit port guards from the function unit
1029 * port guards list.
1030 */
1031void
1033 delete selectedFUGuard();
1035 wxListEvent dummy;
1037}
1038
1039
1040
1041/**
1042 * Handles the 'Edit FUGuard' button event.
1043 *
1044 * Opens a FUGuardDialog with the selected guard's attributes set.
1045 */
1046void
1048 PortGuard* guard = selectedFUGuard();
1049 if (guard == NULL) {
1050 // No guard selected.
1051 return;
1052 }
1053 FUGuardDialog dialog(this, bus_, guard);
1054 dialog.ShowModal();
1056}
1057
1058
1059/**
1060 * Sets the immediate width range when the bus width is modified.
1061 */
1062void
1063BusDialog::onWidth(wxSpinEvent&) {
1064 wxSpinCtrl* width = dynamic_cast<wxSpinCtrl*>(FindWindow(ID_BUS_WIDTH));
1065 wxSpinCtrl* siWidth = dynamic_cast<wxSpinCtrl*>(FindWindow(ID_SI_WIDTH));
1066 if (siWidth->GetValue() > width->GetValue()) {
1067 siWidth->SetValue(width->GetValue());
1068 }
1069 siWidth->SetRange(0, width->GetValue());
1070}
1071
1072
1073/**
1074 * Disables and enables Edit and Delete buttons under the register
1075 * file guard list.
1076 *
1077 * If a guard is selected, buttons are enabled. If no guard is
1078 * selected the buttons will be disabled.
1079 */
1080void
1082 if (fuGuardList_->GetSelectedItemCount() != 1) {
1083 FindWindow(ID_DELETE_FU_GUARD)->Disable();
1084 FindWindow(ID_EDIT_FU_GUARD)->Disable();
1085 return;
1086 }
1087 FindWindow(ID_DELETE_FU_GUARD)->Enable();
1088 FindWindow(ID_EDIT_FU_GUARD)->Enable();
1089}
1090
1091
1092/**
1093 * Opens a pop-up menu when right mouse button was pressed on the
1094 * register file guard list.
1095 *
1096 * @param event Information about right mouse click event.
1097 */
1098void
1100
1101 rfGuardList_->SetItemState(event.GetIndex(), wxLIST_STATE_SELECTED,
1102 wxLIST_STATE_SELECTED);
1103
1104 wxMenu* contextMenu = new wxMenu();
1105
1107 format button = prodeTexts->text(
1109 contextMenu->Append(
1111 button = prodeTexts->text(
1113 contextMenu->Append(
1115 rfGuardList_->PopupMenu(contextMenu, event.GetPoint());
1116}
1117
1118
1119/**
1120 * Handles left mouse button double clicks on the RFGuard list.
1121 */
1122void
1124 wxCommandEvent dummy;
1126}
1127
1128
1129/**
1130 * Opens a pop-up menu when right mouse button was pressed on the
1131 * FU guard list.
1132 *
1133 * @param event Information about right mouse click event.
1134 */
1135void
1137
1138 fuGuardList_->SetItemState(event.GetIndex(), wxLIST_STATE_SELECTED,
1139 wxLIST_STATE_SELECTED);
1140
1141 wxMenu* contextMenu = new wxMenu();
1142
1144 format button = prodeTexts->text(
1146 contextMenu->Append(
1148 button = prodeTexts->text(
1150 contextMenu->Append(
1152 fuGuardList_->PopupMenu(contextMenu, event.GetPoint());
1153}
1154
1155
1156/**
1157 * Handles left mouse button double clicks on the FUGuard list.
1158 */
1159void
1161 wxCommandEvent dummy;
1163}
1164
1165
1166/**
1167 * Creates the dialog window contents.
1168 *
1169 * This method was generated with wxDesigner. Don't modify manually,
1170 * all chnages will be lost if the code is regenerated.
1171 *
1172 * @return Main sizer of the created contents.
1173 * @param parent The dialog window.
1174 * @param call_fit If true, fits the contents inside the dialog.
1175 * @param set_sizer If true, sets the main sizer as dialog contents.
1176 */
1177wxSizer*
1178BusDialog::createContents(wxWindow *parent, bool call_fit, bool set_sizer) {
1179
1180 wxFlexGridSizer *item0 = new wxFlexGridSizer( 2, 0, 0 );
1181
1182 wxBoxSizer *item1 = new wxBoxSizer( wxVERTICAL );
1183
1184 wxStaticBox *item3 = new wxStaticBox( parent, -1, wxT("Bus:") );
1185 wxStaticBoxSizer *item2 = new wxStaticBoxSizer( item3, wxVERTICAL );
1186 busSizer_ = item2;
1187
1188 wxBoxSizer *item4 = new wxBoxSizer( wxHORIZONTAL );
1189
1190 wxStaticText *item5 = new wxStaticText( parent, ID_LABEL_BUS_NAME, wxT("Name:"), wxDefaultPosition, wxDefaultSize, 0 );
1191 item4->Add( item5, 0, wxALIGN_CENTER|wxALL, 5 );
1192
1193 wxTextCtrl *item6 = new wxTextCtrl( parent, ID_BUS_NAME, wxT(""), wxDefaultPosition, wxSize(200,-1), 0 );
1194 item4->Add( item6, 0, wxALIGN_CENTER|wxALL, 5 );
1195
1196 item2->Add( item4, 0, wxGROW|wxALL, 5 );
1197
1198 wxBoxSizer *item7 = new wxBoxSizer( wxHORIZONTAL );
1199
1200 wxStaticText *item8 = new wxStaticText( parent, ID_LABEL_BUS_WIDTH, wxT("Width:"), wxDefaultPosition, wxDefaultSize, 0 );
1201 item7->Add( item8, 0, wxALIGN_CENTER|wxALL, 5 );
1202
1203 wxSpinCtrl *item9 = new wxSpinCtrl( parent, ID_BUS_WIDTH, wxT("1"), wxDefaultPosition, wxSize(-1,-1), 0, 1, 1024, 1 );
1204 item7->Add( item9, 0, wxALIGN_CENTER|wxALL, 5 );
1205
1206 item2->Add( item7, 0, wxGROW|wxALL, 5 );
1207
1208 item0->Add( item2, 0, wxGROW|wxALL, 5 );
1209 //item1->Add( item2, 0, wxGROW|wxALL, 5 );
1210
1211 wxStaticBox *item11 = new wxStaticBox( parent, -1, wxT("Short Immediate:") );
1212 wxStaticBoxSizer *item10 = new wxStaticBoxSizer( item11, wxVERTICAL );
1213 siSizer_ = item10;
1214
1215 wxBoxSizer *item12 = new wxBoxSizer( wxHORIZONTAL );
1216
1217 wxStaticText *item13 = new wxStaticText( parent, ID_LABEL_SI_WIDTH, wxT("Width:"), wxDefaultPosition, wxDefaultSize, 0 );
1218 item12->Add( item13, 0, wxALIGN_CENTER|wxALL, 5 );
1219
1220 wxSpinCtrl *item14 = new wxSpinCtrl( parent, ID_SI_WIDTH, wxT("0"), wxDefaultPosition, wxSize(-1,-1), 0, 0, 1000, 0 );
1221 item12->Add( item14, 0, wxALIGN_CENTER|wxALL, 5 );
1222
1223 item10->Add( item12, 0, wxGROW|wxALL, 5 );
1224
1225 wxString strs15[] =
1226 {
1227 wxT("Zero"),
1228 wxT("Sign")
1229 };
1230 wxRadioBox *item15 = new wxRadioBox( parent, ID_SI_EXTENSION, wxT("Extension"), wxDefaultPosition, wxDefaultSize, 2, strs15, 1, wxRA_SPECIFY_ROWS );
1231 item10->Add( item15, 0, wxALL, 5 );
1232
1233 item0->Add( item10, 0, wxGROW|wxALL, 5 );
1234 //item1->Add( item10, 0, wxGROW|wxALL, 5 );
1235
1236 wxCheckBox *item16 = new wxCheckBox( parent, ID_TRUE_GUARD, wxT("Always true guard"), wxDefaultPosition, wxDefaultSize, 0 );
1237 item1->Add( item16, 0, wxALL, 5 );
1238
1239 wxCheckBox *item17 = new wxCheckBox( parent, ID_FALSE_GUARD, wxT("Always false guard"), wxDefaultPosition, wxDefaultSize, 0 );
1240 item1->Add( item17, 0, wxALL, 5 );
1241
1242 item0->Add( item1, 0, wxGROW|wxALL, 5 );
1243
1244 wxStaticBox *item19 = new wxStaticBox( parent, -1, wxT("Segements:") );
1245 wxStaticBoxSizer *item18 = new wxStaticBoxSizer( item19, wxVERTICAL );
1246 segmentSizer_ = item18;
1247
1248 wxListCtrl *item20 = new wxListCtrl( parent, ID_SEGMENT_LIST, wxDefaultPosition, wxSize(300,160), wxLC_REPORT|wxLC_SINGLE_SEL|wxSUNKEN_BORDER );
1249 item18->Add( item20, 0, wxALIGN_CENTER|wxALL, 5 );
1250
1251 wxBoxSizer *item21 = new wxBoxSizer( wxHORIZONTAL );
1252
1253 wxStaticText *item22 = new wxStaticText( parent, ID_LABEL_SEGMENT_NAME, wxT("Name:"), wxDefaultPosition, wxDefaultSize, 0 );
1254 item21->Add( item22, 0, wxALIGN_CENTER|wxALL, 5 );
1255
1256 wxTextCtrl *item23 = new wxTextCtrl( parent, ID_SEGMENT_NAME, wxT(""), wxDefaultPosition, wxSize(100,-1), 0 );
1257 item21->Add( item23, 0, wxALIGN_CENTER|wxALL, 5 );
1258
1259 wxBoxSizer *item24 = new wxBoxSizer( wxHORIZONTAL );
1260
1261 wxButton *item25 = new wxButton( parent, ID_SEGMENT_UP, wxT("Up"), wxDefaultPosition, wxSize(40,-1), 0 );
1262 item24->Add( item25, 0, wxALIGN_CENTER|wxALL, 5 );
1263
1264 wxButton *item26 = new wxButton( parent, ID_SEGMENT_DOWN, wxT("Down"), wxDefaultPosition, wxSize(50,-1), 0 );
1265 item24->Add( item26, 0, wxALIGN_CENTER|wxALL, 5 );
1266
1267 item21->Add( item24, 0, wxALL, 5 );
1268
1269 item18->Add( item21, 0, wxGROW|wxALL, 5 );
1270
1271 wxBoxSizer *item27 = new wxBoxSizer( wxHORIZONTAL );
1272
1273 wxButton *item28 = new wxButton( parent, ID_ADD_SEGMENT, wxT("Add"), wxDefaultPosition, wxDefaultSize, 0 );
1274 item27->Add( item28, 0, wxALIGN_CENTER|wxALL, 5 );
1275
1276 item27->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 );
1277
1278 wxButton *item29 = new wxButton( parent, ID_DELETE_SEGMENT, wxT("Delete"), wxDefaultPosition, wxDefaultSize, 0 );
1279 item27->Add( item29, 0, wxALIGN_CENTER|wxALL, 5 );
1280
1281 item18->Add( item27, 0, wxALIGN_CENTER|wxALL, 5 );
1282
1283 item0->Add( item18, 0, wxALL, 5 );
1284
1285 wxStaticBox *item31 = new wxStaticBox( parent, -1, wxT("Register File Guards:") );
1286 wxStaticBoxSizer *item30 = new wxStaticBoxSizer( item31, wxVERTICAL );
1287 registerGuardSizer_ = item30;
1288
1289 wxListCtrl *item32 = new wxListCtrl( parent, ID_RF_GUARD_LIST, wxDefaultPosition, wxSize(300,120), wxLC_REPORT|wxSUNKEN_BORDER );
1290 item30->Add( item32, 0, wxALIGN_CENTER|wxALL, 5 );
1291
1292 wxBoxSizer *item33 = new wxBoxSizer( wxHORIZONTAL );
1293
1294 wxButton *item34 = new wxButton( parent, ID_ADD_RF_GUARD, wxT("Add..."), wxDefaultPosition, wxDefaultSize, 0 );
1295 item33->Add( item34, 0, wxALIGN_CENTER|wxALL, 5 );
1296
1297 wxButton *item35 = new wxButton( parent, ID_EDIT_RF_GUARD, wxT("Edit..."), wxDefaultPosition, wxDefaultSize, 0 );
1298 item35->Enable( false );
1299 item33->Add( item35, 0, wxALIGN_CENTER|wxALL, 5 );
1300
1301 wxButton *item36 = new wxButton( parent, ID_DELETE_RF_GUARD, wxT("Delete"), wxDefaultPosition, wxDefaultSize, 0 );
1302 item36->Enable( false );
1303 item33->Add( item36, 0, wxALIGN_CENTER|wxALL, 5 );
1304
1305 item30->Add( item33, 0, wxALIGN_CENTER|wxALL, 5 );
1306
1307 item0->Add( item30, 0, wxGROW|wxALL, 5 );
1308
1309 wxStaticBox *item38 = new wxStaticBox( parent, -1, wxT("Function Unit Guards") );
1310 wxStaticBoxSizer *item37 = new wxStaticBoxSizer( item38, wxVERTICAL );
1311 portGuardSizer_ = item37;
1312
1313 wxListCtrl *item39 = new wxListCtrl( parent, ID_FU_GUARD_LIST, wxDefaultPosition, wxSize(300,120), wxLC_REPORT|wxLC_SINGLE_SEL|wxSUNKEN_BORDER );
1314 item37->Add( item39, 0, wxALIGN_CENTER|wxALL, 5 );
1315
1316 wxBoxSizer *item40 = new wxBoxSizer( wxHORIZONTAL );
1317
1318 wxButton *item41 = new wxButton( parent, ID_ADD_FU_GUARD, wxT("Add..."), wxDefaultPosition, wxDefaultSize, 0 );
1319 item40->Add( item41, 0, wxALIGN_CENTER|wxALL, 5 );
1320
1321 wxButton *item42 = new wxButton( parent, ID_EDIT_FU_GUARD, wxT("Edit..."), wxDefaultPosition, wxDefaultSize, 0 );
1322 item42->Enable( false );
1323 item40->Add( item42, 0, wxALIGN_CENTER|wxALL, 5 );
1324
1325 wxButton *item43 = new wxButton( parent, ID_DELETE_FU_GUARD, wxT("Delete"), wxDefaultPosition, wxDefaultSize, 0 );
1326 item43->Enable( false );
1327 item40->Add( item43, 0, wxALIGN_CENTER|wxALL, 5 );
1328
1329 item37->Add( item40, 0, wxALIGN_CENTER|wxALL, 5 );
1330
1331 item0->Add( item37, 0, wxGROW|wxALL, 5 );
1332
1333 wxButton *item44 = new wxButton( parent, ID_HELP, wxT("&Help"), wxDefaultPosition, wxDefaultSize, 0 );
1334 item0->Add( item44, 0, wxALL, 5 );
1335
1336 wxBoxSizer *item45 = new wxBoxSizer( wxHORIZONTAL );
1337
1338 wxButton *item46 = new wxButton( parent, wxID_OK, wxT("&OK"), wxDefaultPosition, wxDefaultSize, 0 );
1339 item45->Add( item46, 0, wxALIGN_CENTER|wxALL, 5 );
1340
1341 wxButton *item47 = new wxButton( parent, wxID_CANCEL, wxT("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
1342 item45->Add( item47, 0, wxALIGN_CENTER|wxALL, 5 );
1343
1344 item0->Add( item45, 0, wxALL, 5 );
1345
1346 if (set_sizer)
1347 {
1348 parent->SetSizer( item0 );
1349 if (call_fit)
1350 item0->SetSizeHints( parent );
1351 }
1352
1353 return item0;
1354}
#define assert(condition)
END_EVENT_TABLE() using namespace IDF
int wxCALLBACK ListCompareFunction(long item1, long item2, long WXUNUSED(sortData))
Definition BusDialog.cc:375
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
const int DEFAULT_WIDTH
Default window width.
SimValue dummy(32)
a dummy simvalue which is given for operands that are not bound
void onOK(wxCommandEvent &)
Definition BusDialog.cc:797
wxString newSegName_
Name for a new segment.
Definition BusDialog.hh:105
void onBusName(wxCommandEvent &)
Definition BusDialog.cc:617
wxListCtrl * rfGuardList_
Register file guard list control.
Definition BusDialog.hh:116
wxListCtrl * fuGuardList_
Function unit port guard list control.
Definition BusDialog.hh:118
void onDeleteSegment(wxCommandEvent &)
Definition BusDialog.cc:735
wxCheckBox * alwaysFalseGuard_
Check box for always false unconditional guard.
Definition BusDialog.hh:112
wxRadioBox * immediateExtensionBox_
Radio box for immediate extension.
Definition BusDialog.hh:114
void onAddFUGuard(wxCommandEvent &)
Definition BusDialog.cc:998
@ ID_EDIT_RF_GUARD
Definition BusDialog.hh:153
@ ID_EDIT_FU_GUARD
Definition BusDialog.hh:157
@ ID_SEGMENT_NAME
Definition BusDialog.hh:146
@ ID_RF_GUARD_LIST
Definition BusDialog.hh:151
@ ID_DELETE_SEGMENT
Definition BusDialog.hh:150
@ ID_LABEL_SEGMENT_NAME
Definition BusDialog.hh:164
@ ID_DELETE_RF_GUARD
Definition BusDialog.hh:154
@ ID_ADD_FU_GUARD
Definition BusDialog.hh:156
@ ID_SEGMENT_LIST
Definition BusDialog.hh:145
@ ID_SI_EXTENSION
Definition BusDialog.hh:142
@ ID_LABEL_BUS_WIDTH
Definition BusDialog.hh:161
@ ID_ADD_RF_GUARD
Definition BusDialog.hh:152
@ ID_SEGMENT_DOWN
Definition BusDialog.hh:148
@ ID_DELETE_FU_GUARD
Definition BusDialog.hh:158
@ ID_LABEL_SI_WIDTH
Definition BusDialog.hh:163
@ ID_FU_GUARD_LIST
Definition BusDialog.hh:155
@ ID_LABEL_BUS_NAME
Definition BusDialog.hh:160
wxStaticBoxSizer * registerGuardSizer_
Static boxsizer for the register guard properties.
Definition BusDialog.hh:125
TTAMachine::PortGuard * selectedFUGuard() const
Definition BusDialog.cc:522
wxSizer * createContents(wxWindow *parent, bool call_fit, bool set_sizer)
vector< TTAMachine::PortGuard * > portGuards_
list of port guards
Definition BusDialog.hh:135
void onActivateRFGuard(wxListEvent &event)
void onFUGuardRightClick(wxListEvent &event)
void onDeleteRFGuard(wxCommandEvent &)
Definition BusDialog.cc:922
TTAMachine::RegisterGuard * selectedRFGuard() const
Definition BusDialog.cc:543
void onRFGuardSelection(wxListEvent &)
Definition BusDialog.cc:978
void setTexts()
Definition BusDialog.cc:192
virtual ~BusDialog()
Definition BusDialog.cc:184
void onDeleteFUGuard(wxCommandEvent &)
wxListCtrl * segList_
List widget for the segment list.
Definition BusDialog.hh:108
void onActivateFUGuard(wxListEvent &event)
void updateGuardLists()
Definition BusDialog.cc:412
void onWidth(wxSpinEvent &)
TTAMachine::Segment * selectedSegment() const
Definition BusDialog.cc:501
virtual bool TransferDataToWindow()
Definition BusDialog.cc:337
int width_
Width of the bus.
Definition BusDialog.hh:101
wxStaticBoxSizer * siSizer_
Static boxsizer for the short immediate properties.
Definition BusDialog.hh:123
void onEditRFGuard(wxCommandEvent &)
Definition BusDialog.cc:958
wxString name_
Name of the bus.
Definition BusDialog.hh:99
void onSegmentDown(wxCommandEvent &)
Definition BusDialog.cc:775
void updateSegmentList()
Definition BusDialog.cc:486
void onAddRFGuard(wxCommandEvent &)
Definition BusDialog.cc:898
void onUnconditionalGuard(wxCommandEvent &)
Definition BusDialog.cc:635
vector< TTAMachine::RegisterGuard * > registerGuards_
list of register guards
Definition BusDialog.hh:133
int immWidth_
Short immediate width.
Definition BusDialog.hh:103
wxCheckBox * alwaysTrueGuard_
Check box for always true unconditional guard.
Definition BusDialog.hh:110
void onEditFUGuard(wxCommandEvent &)
void onRFGuardRightClick(wxListEvent &event)
wxStaticBoxSizer * segmentSizer_
Static boxsizer for the segment properties.
Definition BusDialog.hh:129
void onSegmentName(wxCommandEvent &)
Definition BusDialog.cc:676
void onSegmentRightClick(wxListEvent &event)
Definition BusDialog.cc:712
void onFUGuardSelection(wxListEvent &)
void onAddSegment(wxCommandEvent &)
Definition BusDialog.cc:567
wxStaticBoxSizer * busSizer_
Static boxsizer for the bus properties.
Definition BusDialog.hh:121
void onSegmentSelection(wxListEvent &)
Definition BusDialog.cc:693
TTAMachine::Bus * bus_
Transport Bus to edit.
Definition BusDialog.hh:97
void onSegmentUp(wxCommandEvent &)
Definition BusDialog.cc:752
wxStaticBoxSizer * portGuardSizer_
Static boxsizer for the port guard properties.
Definition BusDialog.hh:127
std::string errorMessage() const
Definition Exception.cc:123
@ 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.
@ TXT_BUTTON_ADD
Label for an add button.
static GUITextGenerator * instance()
static bool isValidComponentName(const std::string &name)
static const wxString EXTENSION_ZERO
String for the zero extension.
static const wxString EXTENSION_SIGN
String for the sign extension.
static ProDeTextGenerator * instance()
@ MSG_ERROR_SAME_NAME
Error: Same name exists.
@ MSG_ERROR_ILLEGAL_NAME
Error: Illegal component name.
@ TXT_LABEL_FALSE_GUARD
Label for 'always false guard'.
@ TXT_LABEL_BUTTON_EDIT
Label for &Edit... button.
@ TXT_BUS_REGISTER_GUARD_BOX
Register file guards box title.
@ COMP_BUS
Name for bus component.
@ TXT_LABEL_NAME
Label for component name widget.
@ TXT_LABEL_EXTENSION
Label for 'extension' radiobox.
@ TXT_RADIO_EXTENSION_ZERO
Label for 'zero' radio button.
@ TXT_BUS_SEGMENTS_BOX
Segments box title.
@ TXT_LABEL_WIDTH
Label for bit width widget.
@ TXT_BUS_SI_BOX
Short immediate box title.
@ TXT_BUTTON_UP
Label for up button.
@ COMP_MACHINE
Text for machine description.
@ COMP_A_SEGMENT
Name for a segment component.
@ TXT_LABEL_BUTTON_DELETE
Label for &Delete button.
@ TXT_BUS_BUS_BOX
Bus Dialog bus box title.
@ TXT_BUTTON_DOWN
Label for down button.
@ MSG_ERROR_CANNOT_FU_GUARD
Error: Function unit port guard.
@ TXT_RADIO_EXTENSION_SIGN
Label for 'sign' radio button.
@ TXT_LABEL_TRUE_GUARD
Label for 'always true guard'.
@ TXT_COLUMN_PORT
Label for port column in a list.
@ TXT_BUS_PORT_GUARD_BOX
Function unit guards box title.
@ TXT_COLUMN_INDEX
Label for index column in a list.
@ COMP_AN_IMM_SLOT
Name for imm. slot (w/ article).
@ TXT_COLUMN_INVERTED
Label for inv column in a list.
@ MSG_ERROR_CANNOT_RF_GUARD
Error: Register file guard.
@ MSG_ERROR
Text 'Error' and new line.
@ MSG_ERROR_BUS_IT_SLOT_WIDTH
Error: Slot width > bus width.
@ COMP_A_BUS
Name for a bus component.
@ TXT_COLUMN_NAME
Label for name column in a list.
@ COMP_SEGMENT
Name for segment component.
@ TXT_BUS_DIALOG_TITLE
Bus Dialog title.
FunctionUnit * parentUnit() const
Definition BaseFUPort.cc:96
virtual bool hasSegment(const std::string &name) const
Definition Bus.cc:284
virtual Segment * segment(int index) const
Definition Bus.cc:329
virtual void setName(const std::string &name)
Definition Bus.cc:196
virtual void setImmediateWidth(int width)
Definition Bus.cc:241
int width() const
Definition Bus.cc:149
int immediateWidth() const
Definition Bus.cc:160
virtual void setSignExtends()
Definition Bus.cc:262
bool signExtends() const
Definition Bus.cc:171
virtual void setZeroExtends()
Definition Bus.cc:253
Guard * guard(int index) const
Definition Bus.cc:456
virtual int segmentCount() const
Definition Bus.cc:385
int guardCount() const
Definition Bus.cc:441
virtual void setWidth(int width)
Definition Bus.cc:223
virtual Machine * machine() const
virtual TCEString name() const
virtual bool isInverted() const
ComponentType * item(int index) const
bool hasItem(const std::string &name) const
virtual ImmediateSlotNavigator immediateSlotNavigator() const
Definition Machine.cc:462
virtual RegisterFileNavigator registerFileNavigator() const
Definition Machine.cc:450
virtual FunctionUnitNavigator functionUnitNavigator() const
Definition Machine.cc:380
virtual InstructionTemplateNavigator instructionTemplateNavigator() const
Definition Machine.cc:428
virtual BusNavigator busNavigator() const
Definition Machine.cc:356
FUPort * port() const
virtual std::string name() const
Definition Port.cc:141
const RegisterFile * registerFile() const
Segment * destinationSegment() const
void moveBefore(Segment &segment)
Definition Segment.cc:320
void moveAfter(Segment &segment)
Definition Segment.cc:357
bool hasSourceSegment() const
Definition Segment.cc:388
Segment * sourceSegment() const
bool hasDestinationSegment() const
Definition Segment.cc:399
std::string name() const
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 wxString toWxString(const std::string &source)
static std::string toString(const wxString &source)