OpenASIP 2.2
Loading...
Searching...
No Matches
RFImplementationDialog.cc
Go to the documentation of this file.
1/*
2 Copyright (c) 2002-2014 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 RFImplementationDialog.cc
26 *
27 * Implementation of RFImplementationDialog class.
28 *
29 * @author Veli-Pekka Jääskeläinen 2006 (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/choice.h>
37#include <wx/statline.h>
38
39#include <vector>
40
42#include "RFImplementation.hh"
45
46#include "RFExternalPort.hh"
48
51
54
55#include "InformationDialog.hh"
56#include "WxConversion.hh"
57#include "WidgetTools.hh"
58#include "ErrorDialog.hh"
59
60using namespace HDB;
61
62BEGIN_EVENT_TABLE(RFImplementationDialog, wxDialog)
63
70 EVT_BUTTON(ID_MOVE_SOURCE_DOWN,
71 RFImplementationDialog::onMoveSourceFileDown)
72 EVT_RADIOBOX(ID_SAC, RFImplementationDialog::onSACchoise)
73
75
77 ID_PORT_LIST, RFImplementationDialog::onPortSelection)
79 ID_PORT_LIST, RFImplementationDialog::onPortSelection)
81 ID_SOURCE_LIST, RFImplementationDialog::onSourceFileSelection)
83 ID_SOURCE_LIST, RFImplementationDialog::onSourceFileSelection)
84
86 ID_ADD_EXTERNAL_PORT, RFImplementationDialog::onAddExternalPort)
88 ID_EDIT_EXTERNAL_PORT, RFImplementationDialog::onEditExternalPort)
90 ID_DELETE_EXTERNAL_PORT,
91 RFImplementationDialog::onDeleteExternalPort)
92
94 ID_EXTERNAL_PORT_LIST,
95 RFImplementationDialog::onExternalPortSelection)
97 ID_EXTERNAL_PORT_LIST,
98 RFImplementationDialog::onExternalPortActivation)
100 ID_EXTERNAL_PORT_LIST,
101 RFImplementationDialog::onExternalPortSelection)
102
104 ID_PARAMETER_LIST, RFImplementationDialog::onParameterSelection)
106 ID_PARAMETER_LIST, RFImplementationDialog::onParameterActivation)
108 ID_PARAMETER_LIST, RFImplementationDialog::onParameterSelection)
109
110 EVT_BUTTON(ID_ADD_PARAMETER, RFImplementationDialog::onAddParameter)
111 EVT_BUTTON(ID_EDIT_PARAMETER, RFImplementationDialog::onEditParameter)
112 EVT_BUTTON(ID_DELETE_PARAMETER, RFImplementationDialog::onDeleteParameter)
113
114
115
117
118/**
119 * The Constructor.
120 *
121 * @param parent Parent window of the dialog.
122 * @param id Window identifier for the dialog window.
123 * @param implementation RF implementation to modify.
124 */
126 wxWindowID id, RFImplementation& implementation) :
127 wxDialog(parent, id, _T("Register File Implementation")),
128 implementation_(implementation) {
129
130 createContents(this, true, true);
131
132 // Initialize list and choice widgets.
133 portList_ = dynamic_cast<wxListCtrl*>(FindWindow(ID_PORT_LIST));
134 sourceList_ = dynamic_cast<wxListCtrl*>(FindWindow(ID_SOURCE_LIST));
135 externalPortList_ = dynamic_cast<wxListCtrl*>(FindWindow(
136 ID_EXTERNAL_PORT_LIST));
137 parameterList_ = dynamic_cast<wxListCtrl*>(FindWindow(ID_PARAMETER_LIST));
138 sizeChoice_ = dynamic_cast<wxChoice*>(FindWindow(ID_SIZE_CHOICE));
139 widthChoice_ = dynamic_cast<wxChoice*>(FindWindow(ID_WIDTH_CHOICE));
140 assert(sizeChoice_);
141 assert(widthChoice_);
142
143 portList_->InsertColumn(0, _T("name"), wxLIST_FORMAT_LEFT, 200);
144 sourceList_->InsertColumn(0, _T("source file"), wxLIST_FORMAT_LEFT, 260);
145
146 // Add initial size and width parameter choices
147 sizeChoice_->SetSelection(sizeChoice_->Append(
148 WxConversion::toWxString(implementation_.sizeParameter())));
149 widthChoice_->SetSelection(widthChoice_->Append(
150 WxConversion::toWxString(implementation_.widthParameter())));
151
152 // Create columns in list widgets.
153 externalPortList_->InsertColumn(0, _T("name"), wxLIST_FORMAT_LEFT, 260);
154 parameterList_->InsertColumn(0, _T("parameter"), wxLIST_FORMAT_LEFT, 180);
155 parameterList_->InsertColumn(1, _T("value"), wxLIST_FORMAT_LEFT, 80);
156
157 // Read string attributes from the RFImplementation object.
158 name_ = WxConversion::toWxString(implementation_.moduleName());
159 clkPort_ = WxConversion::toWxString(implementation_.clkPort());
160 rstPort_ = WxConversion::toWxString(implementation_.rstPort());
161 gLockPort_ = WxConversion::toWxString(implementation_.glockPort());
162 guardPort_ = WxConversion::toWxString(implementation_.guardPort());
163 sacParam_ = implementation_.separateAddressCycleParameter();
164
165 // Set text field validators.
166 FindWindow(ID_NAME)->SetValidator(
167 wxTextValidator(wxFILTER_ASCII, &name_));
168 FindWindow(ID_CLK_PORT)->SetValidator(
169 wxTextValidator(wxFILTER_ASCII, &clkPort_));
170 FindWindow(ID_RESET_PORT)->SetValidator(
171 wxTextValidator(wxFILTER_ASCII, &rstPort_));
172 FindWindow(ID_GLOCK_PORT)->SetValidator(
173 wxTextValidator(wxFILTER_ASCII, &gLockPort_));
174 FindWindow(ID_GUARD_PORT)->SetValidator(
175 wxTextValidator(wxFILTER_ASCII, &guardPort_));
176
177 wxRadioBox* rbox = dynamic_cast<wxRadioBox*>(FindWindow(ID_SAC));
178 rbox->SetSelection(sacParam_ ? RBOX_TRUE : RBOX_FALSE);
179
180 // Disable conditional buttons initially.
181 FindWindow(ID_DELETE_PORT)->Disable();
182 FindWindow(ID_MODIFY_PORT)->Disable();
183 FindWindow(ID_DELETE_SOURCE)->Disable();
184 FindWindow(ID_EDIT_EXTERNAL_PORT)->Disable();
185 FindWindow(ID_DELETE_EXTERNAL_PORT)->Disable();
186 FindWindow(ID_EDIT_PARAMETER)->Disable();
187 FindWindow(ID_DELETE_PARAMETER)->Disable();
188
189 update();
190}
191
192/**
193 * The Destructor.
194 */
197
198void
200
201 // Update port list.
202 portList_->DeleteAllItems();
203 for (int i = 0; i < implementation_.portCount(); i++) {
204 wxString portName = WxConversion::toWxString(
206 portList_->InsertItem(i, portName);
207 }
208
209 // Update source file list.
210 sourceList_->DeleteAllItems();
211 for (int i = 0; i < implementation_.implementationFileCount(); i++) {
212 wxString fileName = WxConversion::toWxString(
214 sourceList_->InsertItem(i, fileName);
215 }
217 sourceList_->SetColumnWidth(0, wxLIST_AUTOSIZE);
218 }
219
220 // Update external port list.
221 externalPortList_->DeleteAllItems();
222 for (int i = 0; i < implementation_.externalPortCount(); i++) {
223 wxString portName = WxConversion::toWxString(
225 externalPortList_->InsertItem(i, portName);
226 }
227
228 // Update parameter list.
229 parameterList_->DeleteAllItems();
230 for (int i = 0; i < implementation_.parameterCount(); i++) {
231 const RFImplementation::Parameter parameter =
233 wxString param = WxConversion::toWxString(parameter.type);
234 param.Append(_T(": "));
235 param.Append(WxConversion::toWxString(parameter.name));
236 parameterList_->InsertItem(i, param);
237 parameterList_->SetItem(
238 i, 1, WxConversion::toWxString(parameter.value));
239 }
240
241 // Update width and size parameter choices
242 wxString oldWidthChoice = getWidthParameter();
243 wxString oldSizeChoice = getSizeParameter();
244 widthChoice_->Clear();
245 widthChoice_->Append(_T(""));
246 sizeChoice_->Clear();
247 sizeChoice_->Append(_T(""));
248 for (int i = 0; i < implementation_.parameterCount(); i++) {
249 const RFImplementation::Parameter parameter =
251 widthChoice_->Append(WxConversion::toWxString(parameter.name));
252 sizeChoice_->Append(WxConversion::toWxString(parameter.name));
253 }
254 widthChoice_->SetSelection(widthChoice_->FindString(oldWidthChoice));
255 sizeChoice_->SetSelection(sizeChoice_->FindString(oldSizeChoice));
256
257 wxListEvent dummy;
261}
262
263void
265 assert((event.GetInt() == RBOX_FALSE) || (event.GetInt() == RBOX_TRUE));
266 sacParam_ = (event.GetInt() == RBOX_FALSE) ? false : true;
267}
268
269/**
270 * Event handler for the add port button.
271 *
272 * Opens a RFPortImplementationdialog for adding a new port.
273 */
274void
276
277 RFPortImplementation* port = new RFPortImplementation("", HDB::IN, "", "",
278 "", implementation_);
279
280 RFPortImplementationDialog dialog(this, -1, *port);
281
282 if (dialog.ShowModal() != wxID_OK) {
284 }
285
286 update();
287}
288
289/**
290 * Event handler for the port list selection changes.
291 *
292 * Updates the delete port button enabled/disabled state.
293 */
294void
296 if (selectedPort() == NULL) {
297 FindWindow(ID_DELETE_PORT)->Disable();
298 FindWindow(ID_MODIFY_PORT)->Disable();
299 } else {
300 FindWindow(ID_DELETE_PORT)->Enable();
301 FindWindow(ID_MODIFY_PORT)->Enable();
302 }
303}
304
305/**
306 * Event handler for the delete port button.
307 *
308 * Deletes the selected port.
309 */
310void
312
314
315 if (port == NULL) {
316 return;
317 }
318
320 update();
321}
322
323/**
324 * Event handler for the modify port button.
325 *
326 * Modifies the selected port.
327 */
328void
330
332
333 if (port == NULL) {
334 return;
335 }
336
337 RFPortImplementationDialog dialog(this, -1, *port);
338 dialog.ShowModal();
339 update();
340}
341
342/**
343 * Returns pointer to the port selected in the port list.
344 *
345 * @return Selected port.
346 */
349
350 long item = -1;
351 item = portList_->GetNextItem(item, wxLIST_NEXT_ALL,
352 wxLIST_STATE_SELECTED);
353
354 if (item == -1) {
355 return NULL;
356 }
357
358 return &implementation_.port(item);
359}
360
361
362/**
363 * Returns pointer to the external port selected in the external port list.
364 *
365 * @return Selected external port.
366 */
369
370 long item = -1;
371 item = externalPortList_->GetNextItem(
372 item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
373
374 if (item == -1) {
375 return NULL;
376 }
377
378 return &implementation_.externalPort(item);
379}
380
381
382/**
383 * Returns copy of the selected parameter in the parameter list.
384 *
385 * @return Selected parameter.
386 */
389 long item = -1;
390 item = parameterList_->GetNextItem(
391 item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
392
393 if (item == -1) {
394 RFImplementation::Parameter empty = {"", "", ""};
395 return empty;
396 }
397
398 return implementation_.parameter(item);
399}
400
401
402/**
403 * Event handler for the activate external port list item
404 *
405 * Opens a RFExternalPort for modifying the selected external port.
406 */
409 assert(port != NULL);
410
411 RFExternalPortDialog dialog(this, -1, *port, implementation_);
412
413 dialog.ShowModal();
414 update();
415}
416
417
418/**
419 * Event handler for the external port list selection changes.
420 *
421 * Updates edit/delete external port enabeld/disabled states.
422 */
424 if (selectedExternalPort() == NULL) {
427 } else {
430 }
431}
432
433
434/**
435 * Event handler for the add external port button.
436 *
437 * Opens a RFExternalPortDialog for adding a new external port.
438 */
440
441 RFExternalPort* port = new RFExternalPort(
442 "", IN, "", "", implementation_);
443
444 RFExternalPortDialog dialog(this, -1, *port, implementation_);
445
446 if (dialog.ShowModal() != wxID_OK) {
448 return;
449 }
450
451 update();
452}
453
454
455/**
456 * Event handler for the edit external port button.
457 *
458 * Opens a RFExternalPort for modifying the selected external port.
459 */
461
463
464 if (port == NULL) {
465 return;
466 }
467
468 RFExternalPortDialog dialog(this, -1, *port, implementation_);
469
470 dialog.ShowModal();
471 update();
472}
473
474
475/**
476 * Event handler for the delete external port button.
477 *
478 * Deletes the selected external port.
479 */
481
483
484 if (port == NULL) {
485 return;
486 }
487
489 update();
490}
491
492
493/**
494 * Event handler for the parameter list activation.
495 *
496 * Opens a RFImplementationParamaeterDialog for modifying the selected
497 * parameter.
498 */
499void
502 std::string oldName = parameter.name;
503
504 ImplementationParameterDialog dialog(this, -1, parameter);
505
506 if (dialog.ShowModal() == wxID_OK) {
509 parameter.name, parameter.type, parameter.value);
510
511 // update external port parameter dependencies if needed
512 for (int i = 0; i < implementation_.externalPortCount(); i++) {
514 if (port.unsetParameterDependency(oldName)) {
515 port.setParameterDependency(parameter.name);
516 }
517 }
518 }
519
520 update();
521}
522
523
524/**
525 * Event handler for the parameter list selection changes.
526 *
527 * Updates edit/delete parameter enabled/disabled states.
528 */
529void
531 if (selectedParameter().name == "") {
533 FindWindow(ID_EDIT_PARAMETER)->Disable();
534 } else {
536 FindWindow(ID_EDIT_PARAMETER)->Enable();
537 }
538}
539
540
541/**
542 * Event handler for the add parameter button.
543 *
544 * Opens a ImplementationParameterDialog for adding a new parameter.
545 */
546void
548
550
551 ImplementationParameterDialog dialog(this, -1, parameter);
552
553 bool error = false;
554 wxString message = _T("");
555
556 if (dialog.ShowModal() != wxID_OK) {
557 return;
558 }
559
560 if (error) {
561 ErrorDialog dialog(this, message);
562 dialog.ShowModal();
563 return;
564 }
565
566 try {
568 parameter.name, parameter.type, parameter.value);
569 } catch (IllegalParameters& e) {
570 message = _T("RF implementation already contains ");
571 message.Append(_T("a parameter\nwith name '"));
572 message.Append(WxConversion::toWxString(parameter.name));
573 message.Append(_T("'."));
574 error = true;
575 }
576
577 if (error) {
578 ErrorDialog dialog(this, message);
579 dialog.ShowModal();
580 return;
581 }
582
583 update();
584}
585
586
587/**
588 * Event handler for the edit parameter button.
589 *
590 * Opens a ImplementationParamaeterDialog for modifying the selected
591 * parameter.
592 */
593void
595
597 std::string oldName = parameter.name;
598
599 ImplementationParameterDialog dialog(this, -1, parameter);
600
601 if (dialog.ShowModal() == wxID_OK) {
604 parameter.name, parameter.type, parameter.value);
605
606 // update external port parameter dependencies if needed
607 for (int i = 0; i < implementation_.externalPortCount(); i++) {
609 if (port.unsetParameterDependency(oldName)) {
610 port.setParameterDependency(parameter.name);
611 }
612 }
613 }
614
615 update();
616}
617
618
619/**
620 * Event handler for the delete parameter button.
621 *
622 * Deletes the selected parameter.
623 */
626
628
629 // update external port parameter dependencies
630 for (int i = 0; i < implementation_.externalPortCount(); i++) {
632 port.unsetParameterDependency(parameter.name);
633 }
634 update();
635}
636
637
638
639/**
640 * Event handler for the add source file button.
641 *
642 * Opens a source file dialog for adding a new implementation file
643 * to the list.
644 */
645void
647
650
651 BlockImplementationFileDialog dialog(this, -1, *file);
652
653 if (dialog.ShowModal() == wxID_OK) {
655 update();
656 } else {
657 delete file;
658 }
659
660}
661
662/**
663 * Event handler for the delete source file button.
664 *
665 * Removes the selected source file.
666 */
667void
669
670 std::string fileName = WidgetTools::lcStringSelection(sourceList_, 0);
671
672 for (int i = 0; i < implementation_.implementationFileCount(); i++) {
674 if (file.pathToFile() == fileName) {
676 }
677 }
678 update();
679}
680
681/**
682 * Event handler for the move source file up button.
683 *
684 * Moves the selected source file up on the files list.
685 */
686void
688
690 std::string fileName = WidgetTools::lcStringSelection(sourceList_, 0);
691 std::vector<std::string> pathToFileList;
692 int originalImplementationFileCount =
694
695 for (int i = 0; i < originalImplementationFileCount; i++) {
697 pathToFileList.push_back(file.pathToFile());
699 }
700
701 for (unsigned int i = 1; i < pathToFileList.size(); i++) {
702 if (pathToFileList.at(i) == fileName) {
703 pathToFileList.erase(pathToFileList.begin() + i);
704 pathToFileList.insert(pathToFileList.begin() + i - 1,
705 fileName);
706 break;
707 }
708 }
709
710 for (unsigned int i = 0; i < pathToFileList.size(); i++) {
712 pathToFileList.at(i), BlockImplementationFile::VHDL);
714 }
715
716 pathToFileList.clear();
717 update();
718
719 for (int i = 0; i < implementation_.implementationFileCount(); i++) {
720 if (implementation_.file(i).pathToFile() == fileName) {
721 sourceList_->SetItemState(i, wxLIST_STATE_SELECTED,
722 wxLIST_STATE_SELECTED);
723 }
724 }
725 }
726}
727
728/**
729 * Event handler for the move source file down button.
730 *
731 * Moves the selected source file down on the files list.
732 */
733void
736 std::string fileName = WidgetTools::lcStringSelection(sourceList_, 0);
737 std::vector<std::string> pathToFileList;
738
739 int originalImplementationFileCount =
741
742 for (int i = 0; i < originalImplementationFileCount; i++) {
744 pathToFileList.push_back(file.pathToFile());
746 }
747
748 for (unsigned int i = 0; i < (pathToFileList.size() - 1); i++) {
749 if (pathToFileList.at(i) == fileName) {
750 pathToFileList.erase(pathToFileList.begin() + i);
751 pathToFileList.insert(pathToFileList.begin() + i + 1,
752 fileName);
753 break;
754 }
755 }
756
757 for (unsigned int i = 0; i < pathToFileList.size(); i++) {
759 pathToFileList.at(i), BlockImplementationFile::VHDL);
761 }
762
763 pathToFileList.clear();
764 update();
765
766 for (int i = 0; i < implementation_.implementationFileCount(); i++) {
767 if (implementation_.file(i).pathToFile() == fileName) {
768 sourceList_->SetItemState(i, wxLIST_STATE_SELECTED,
769 wxLIST_STATE_SELECTED);
770 }
771 }
772 }
773}
774
775/**
776 * Event handler for the source file list selection changes.
777 *
778 * Updates delete source file button enabeld/disabled states.
779 */
780void
783 FindWindow(ID_DELETE_SOURCE)->Disable();
784 FindWindow(ID_MOVE_SOURCE_UP)->Disable();
786 } else {
787 FindWindow(ID_DELETE_SOURCE)->Enable();
788 FindWindow(ID_MOVE_SOURCE_UP)->Enable();
790 }
791}
792
793/**
794 * Returns name of currently selected size parameter.
795 *
796 * @return Name of selected item or empty string if there is
797 * no valid selection.
798 */
799wxString
801 return sizeChoice_->GetString(sizeChoice_->GetSelection());
802}
803
804
805/**
806 * Returns name of currently selected width parameter.
807 *
808 * @return Name of selected item or empty string if there is
809 * no valid selection.
810 */
811wxString
813 return widthChoice_->GetString(widthChoice_->GetSelection());
814}
815
816
817/**
818 * Event handler for the OK button.
819 *
820 * Validates the dialog data and updates the RFImplementation object string
821 * attributes.
822 */
823void
825
826 TransferDataFromWindow();
827
828 name_ = name_.Trim(true).Trim(false);
829 clkPort_ = clkPort_.Trim(true).Trim(false);
830 rstPort_ = rstPort_.Trim(true).Trim(false);
831 gLockPort_ = gLockPort_.Trim(true).Trim(false);
832 guardPort_ = guardPort_.Trim(true).Trim(false);
833
834 if (name_.IsEmpty()) {
835 wxString message = _T("Name field must not be empty.");
836 InformationDialog dialog(this, message);
837 dialog.ShowModal();
838 return;
839 }
840
851
852 EndModal(wxID_OK);
853
854}
855
856/**
857 * Creates the dialog contents.
858 */
859wxSizer*
861 wxWindow *parent, bool call_fit, bool set_sizer) {
862
863 wxBoxSizer *item0 = new wxBoxSizer( wxVERTICAL );
864
865 wxBoxSizer *item1 = new wxBoxSizer( wxVERTICAL );
866
867 wxFlexGridSizer *item2 = new wxFlexGridSizer( 2, 0, 0 );
868
869 wxStaticText *item3 = new wxStaticText( parent, ID_LABEL_NAME,
870 wxT("Name:"), wxDefaultPosition, wxDefaultSize, 0 );
871 item2->Add( item3, 0, wxALIGN_RIGHT|wxALL, 5 );
872
873 wxTextCtrl *item4 = new wxTextCtrl( parent, ID_NAME, wxT(""),
874 wxDefaultPosition, wxSize(200,-1), 0 );
875 item2->Add( item4, 0, wxALIGN_CENTER|wxALL, 5 );
876
877 wxStaticText *item5 = new wxStaticText( parent, ID_LABEL_CLK_PORT,
878 wxT("Clock port:"), wxDefaultPosition, wxDefaultSize, 0 );
879 item2->Add( item5, 0, wxALIGN_RIGHT|wxALL, 5 );
880
881 wxTextCtrl *item6 = new wxTextCtrl( parent, ID_CLK_PORT, wxT(""),
882 wxDefaultPosition, wxSize(80,-1), 0 );
883 item2->Add( item6, 0, wxGROW|wxALL, 5 );
884
885 wxStaticText *item7 = new wxStaticText( parent, ID_LABEL_RESET_PORT,
886 wxT("Reset port:"), wxDefaultPosition, wxDefaultSize, 0 );
887 item2->Add( item7, 0, wxALIGN_RIGHT|wxALL, 5 );
888
889 wxTextCtrl *item8 = new wxTextCtrl( parent, ID_RESET_PORT, wxT(""),
890 wxDefaultPosition, wxSize(80,-1), 0 );
891 item2->Add( item8, 0, wxGROW|wxALL, 5 );
892
893 wxStaticText *item9 = new wxStaticText( parent, ID_LABEL_GLOCK_PORT,
894 wxT("Global lock port:"), wxDefaultPosition, wxDefaultSize, 0 );
895 item2->Add( item9, 0, wxALIGN_RIGHT|wxALL, 5 );
896
897 wxTextCtrl *item10 = new wxTextCtrl( parent, ID_GLOCK_PORT, wxT(""),
898 wxDefaultPosition, wxSize(80,-1), 0 );
899 item2->Add( item10, 0, wxGROW|wxALL, 5 );
900
901 wxStaticText *item11 = new wxStaticText( parent, ID_LABEL_GUARD_PORT,
902 wxT("Guard port:"), wxDefaultPosition, wxDefaultSize, 0 );
903 item2->Add( item11, 0, wxALIGN_RIGHT|wxALL, 5 );
904
905 wxTextCtrl *item12 = new wxTextCtrl( parent, ID_GUARD_PORT, wxT(""),
906 wxDefaultPosition, wxSize(80,-1), 0 );
907 item2->Add( item12, 0, wxGROW|wxALL, 5 );
908
909 wxStaticText *item13 = new wxStaticText( parent, ID_LABEL_SIZE_PARAMETER,
910 wxT("Size parameter:"), wxDefaultPosition, wxDefaultSize, 0 );
911 item2->Add( item13, 0, wxALIGN_RIGHT|wxALL, 5 );
912
913 wxChoice *sizeChoice = new wxChoice(parent, ID_SIZE_CHOICE,
914 wxDefaultPosition, wxSize(80,-1), 0, 0, wxCB_SORT);
915 item2->Add( sizeChoice, 0, wxGROW|wxALL, 5 );
916
917 wxStaticText *item15 = new wxStaticText( parent, ID_LABEL_WIDTH_PARAMETER,
918 wxT("Width parameter:"), wxDefaultPosition, wxDefaultSize, 0 );
919 item2->Add( item15, 0, wxALIGN_RIGHT|wxALL, 5 );
920
921 wxChoice *widthChoice = new wxChoice(parent, ID_WIDTH_CHOICE,
922 wxDefaultPosition, wxSize(80,-1), 0, 0, wxCB_SORT);
923 item2->Add(widthChoice, 0, wxGROW|wxALL, 5);
924
925 wxStaticText *saclabel = new wxStaticText(parent, ID_LABEL_SAC,
926 wxT("Separate address cycle:"), wxDefaultPosition, wxDefaultSize, 0);
927 item2->Add(saclabel, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL | wxALL,
928 5);
929
930 wxString choises[2] =
931 { wxT("False"), wxT("True") };
932 wxRadioBox *sacradiobox = new wxRadioBox(parent, ID_SAC, wxT(""),
933 wxDefaultPosition, wxDefaultSize, 2, choises, 0, wxRA_SPECIFY_COLS);
934 item2->Add(sacradiobox, 0, wxGROW | wxALIGN_CENTER_VERTICAL | wxALL, 5);
935
936 item1->Add( item2, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5 );
937
938 wxBoxSizer *item17 = new wxBoxSizer( wxHORIZONTAL );
939
940 wxStaticBox *item19 = new wxStaticBox( parent, -1, wxT("Ports:") );
941 wxStaticBoxSizer *item18 = new wxStaticBoxSizer( item19, wxVERTICAL );
942
943 wxListCtrl *item20 = new wxListCtrl( parent, ID_PORT_LIST,
944 wxDefaultPosition, wxSize(220,160), wxLC_REPORT|wxSUNKEN_BORDER );
945 item18->Add( item20, 0, wxGROW|wxALL, 5 );
946
947 wxBoxSizer *item21 = new wxBoxSizer( wxHORIZONTAL );
948
949 wxButton *item22 = new wxButton( parent, ID_ADD_PORT,
950 wxT("Add..."), wxDefaultPosition, wxDefaultSize, 0 );
951 item21->Add( item22, 0, wxALIGN_CENTER|wxALL, 5 );
952
953 wxButton *item23 = new wxButton( parent, ID_MODIFY_PORT,
954 wxT("Modify..."), wxDefaultPosition, wxDefaultSize, 0 );
955 item21->Add( item23, 0, wxALIGN_CENTER|wxALL, 5 );
956
957 wxButton *item24 = new wxButton( parent, ID_DELETE_PORT,
958 wxT("Delete"), wxDefaultPosition, wxDefaultSize, 0 );
959 item21->Add( item24, 0, wxALIGN_CENTER|wxALL, 5 );
960
961 item18->Add( item21, 0, wxALIGN_CENTER, 5 );
962
963 item17->Add( item18, 0, wxGROW|wxALL, 5 );
964
965 wxStaticBox *item26 = new wxStaticBox( parent, -1, wxT("Source files:") );
966 wxStaticBoxSizer *item25 = new wxStaticBoxSizer( item26, wxVERTICAL );
967
968 wxFlexGridSizer *item27_1 = new wxFlexGridSizer( 2, 0, 0 );
969
970 wxListCtrl *item27 = new wxListCtrl( parent, ID_SOURCE_LIST,
971 wxDefaultPosition, wxSize(300, 150), wxLC_REPORT|wxSUNKEN_BORDER );
972 item27_1->Add( item27, 0, wxGROW|wxALL, 5 );
973
974 wxBoxSizer *item27_2 = new wxBoxSizer( wxVERTICAL );
975
976 wxButton *item60 = new wxButton( parent, ID_MOVE_SOURCE_UP, wxT("▴"),
977 wxDefaultPosition, wxSize(20, 20), 0 );
978 item27_2->Add( item60, 0, wxALIGN_CENTER|wxALL, 5 );
979
980 wxButton *item61 = new wxButton( parent, ID_MOVE_SOURCE_DOWN, wxT("▾"),
981 wxDefaultPosition, wxSize(20, 20), 0 );
982 item27_2->Add( item61, 0, wxALIGN_CENTER|wxALL, 5 );
983
984 item27_1->Add( item27_2, 0, wxALIGN_CENTER, 5 );
985
986 item25->Add( item27_1, 0, wxGROW|wxALL, 5 );
987
988 wxBoxSizer *item28 = new wxBoxSizer( wxHORIZONTAL );
989
990 wxButton *item29 = new wxButton( parent, ID_ADD_SOURCE, wxT("Add..."),
991 wxDefaultPosition, wxDefaultSize, 0 );
992 item28->Add( item29, 0, wxALL, 5 );
993
994 wxButton *item30 = new wxButton( parent, ID_DELETE_SOURCE, wxT("Delete"),
995 wxDefaultPosition, wxDefaultSize, 0 );
996 item28->Add( item30, 0, wxALIGN_CENTER|wxALL, 5 );
997
998 item25->Add( item28, 0, 0, 5 );
999
1000 item17->Add( item25, 0, wxGROW|wxALL, 5 );
1001
1002 item1->Add( item17, 0, wxALIGN_CENTER|wxALL, 5 );
1003
1004 // External ports Box //
1005 wxBoxSizer *extPortAndParamSizer = new wxBoxSizer( wxHORIZONTAL );
1006
1007 wxStaticBox *extPortBox = new wxStaticBox(parent, -1,
1008 wxT("External ports:"));
1009 wxStaticBoxSizer *extPortBoxSizer = new wxStaticBoxSizer(extPortBox,
1010 wxVERTICAL);
1011 wxListCtrl *item35 = new wxListCtrl( parent, ID_EXTERNAL_PORT_LIST,
1012 wxDefaultPosition, wxSize(200,120), wxLC_REPORT|wxSUNKEN_BORDER );
1013 extPortBoxSizer->Add( item35, 0, wxGROW|wxALL, 5 );
1014 wxBoxSizer *extPortButtons = new wxBoxSizer( wxHORIZONTAL );
1015 wxButton *addExtPort = new wxButton( parent, ID_ADD_EXTERNAL_PORT,
1016 wxT("Add..."), wxDefaultPosition, wxDefaultSize, 0);
1017 extPortButtons->Add( addExtPort, 0, wxALL, 5 );
1018 wxButton *editExtPort = new wxButton( parent, ID_EDIT_EXTERNAL_PORT,
1019 wxT("Edit..."), wxDefaultPosition, wxDefaultSize, 0);
1020 extPortButtons->Add(editExtPort, 0, wxALIGN_CENTER|wxALL, 5);
1021 wxButton *deleteExtPort = new wxButton( parent, ID_DELETE_EXTERNAL_PORT,
1022 wxT("Delete"), wxDefaultPosition, wxDefaultSize, 0);
1023 extPortButtons->Add(deleteExtPort, 0, wxALIGN_CENTER|wxALL, 5);
1024 extPortBoxSizer->Add(extPortButtons, 0, wxALIGN_CENTER, 5);
1025 extPortAndParamSizer->Add(extPortBoxSizer, 0,
1026 wxALL, 5);
1027
1028 // Parameter box //
1029 wxStaticBox *paramBox = new wxStaticBox(parent, -1, wxT("Parameters:"));
1030 wxStaticBoxSizer *paramBoxSizer = new wxStaticBoxSizer(paramBox,
1031 wxVERTICAL);
1032
1033 wxListCtrl *item42 = new wxListCtrl( parent, ID_PARAMETER_LIST,
1034 wxDefaultPosition, wxSize(300,120), wxLC_REPORT|wxSUNKEN_BORDER );
1035 paramBoxSizer->Add( item42, 0, wxGROW|wxALL, 5 );
1036
1037 wxBoxSizer *item43 = new wxBoxSizer( wxHORIZONTAL );
1038
1039 wxButton *item44 = new wxButton( parent, ID_ADD_PARAMETER, wxT("Add..."),
1040 wxDefaultPosition, wxDefaultSize, 0 );
1041 item43->Add( item44, 0, wxALIGN_CENTER|wxALL, 5 );
1042
1043 wxButton *item45 = new wxButton( parent, ID_EDIT_PARAMETER, wxT("Edit..."),
1044 wxDefaultPosition, wxDefaultSize, 0 );
1045 item43->Add( item45, 0, wxALIGN_CENTER|wxALL, 5 );
1046
1047 wxButton *item46 = new wxButton( parent, ID_DELETE_PARAMETER,
1048 wxT("Delete"), wxDefaultPosition, wxDefaultSize, 0 );
1049 item43->Add( item46, 0, wxALIGN_CENTER|wxALL, 5 );
1050
1051 paramBoxSizer->Add( item43, 0,
1052 0, 5 );
1053
1054 extPortAndParamSizer->Add( paramBoxSizer, 0,
1055 wxGROW|wxALL, 5 );
1056
1057 item1 ->Add(extPortAndParamSizer, 0,
1058 wxGROW|wxALL, 5 );
1059
1060 item0->Add( item1, 0, wxGROW|wxALL, 5 );
1061
1062 wxStaticLine *item31 = new wxStaticLine( parent, ID_LINE,
1063 wxDefaultPosition, wxSize(20,-1), wxLI_HORIZONTAL );
1064 item0->Add( item31, 0, wxGROW|wxALL, 5 );
1065
1066 wxBoxSizer *item32 = new wxBoxSizer( wxHORIZONTAL );
1067
1068 wxButton *item33 = new wxButton( parent, wxID_OK, wxT("&OK"),
1069 wxDefaultPosition, wxDefaultSize, 0 );
1070 item32->Add( item33, 0, wxALIGN_CENTER|wxALL, 5 );
1071
1072 wxButton *item34 = new wxButton( parent, wxID_CANCEL, wxT("&Cancel"),
1073 wxDefaultPosition, wxDefaultSize, 0 );
1074 item32->Add( item34, 0, wxALIGN_CENTER|wxALL, 5 );
1075
1076 item0->Add( item32, 0, wxALL, 5);
1077
1078 if (set_sizer)
1079 {
1080 parent->SetSizer( item0 );
1081 if (call_fit)
1082 item0->SetSizeHints(parent);
1083 }
1084
1085 return item0;
1086}
#define assert(condition)
END_EVENT_TABLE() using namespace IDF
IDF::MachineImplementation * implementation
the implementation definition of the estimated processor
SimValue dummy(32)
a dummy simvalue which is given for operands that are not bound
RFImplementationDialog::onPortSelection RFImplementationDialog::onSourceFileSelection RFImplementationDialog::onAddExternalPort RFImplementationDialog::onDeleteExternalPort EVT_LIST_ITEM_SELECTED(ID_EXTERNAL_PORT_LIST, RFImplementationDialog::onExternalPortSelection) EVT_LIST_ITEM_ACTIVATED(ID_EXTERNAL_PORT_LIST
RFImplementationDialog::onPortSelection EVT_LIST_ITEM_DESELECTED(ID_PORT_LIST, RFImplementationDialog::onPortSelection) EVT_LIST_ITEM_SELECTED(ID_SOURCE_LIST
RFImplementationDialog::onPortSelection RFImplementationDialog::onSourceFileSelection RFImplementationDialog::onAddExternalPort RFImplementationDialog::onDeleteExternalPort RFImplementationDialog::onExternalPortActivation RFImplementationDialog::onParameterSelection EVT_LIST_ITEM_ACTIVATED(ID_PARAMETER_LIST, RFImplementationDialog::onParameterActivation) EVT_LIST_ITEM_DESELECTED(ID_PARAMETER_LIST
EVT_BUTTON(ID_MOVE_SOURCE_DOWN, RFImplementationDialog::onMoveSourceFileDown) EVT_LIST_ITEM_SELECTED(ID_PORT_LIST
bool setParameterDependency(const std::string &parameter)
std::string name() const
bool unsetParameterDependency(const std::string &parameter)
void setModuleName(const std::string &name)
void setClkPort(const std::string &name)
void addImplementationFile(BlockImplementationFile *file)
void removeImplementationFile(const BlockImplementationFile &file)
void setRstPort(const std::string &name)
BlockImplementationFile & file(int index) const
void setGlockPort(const std::string &name)
RFExternalPort & externalPort(int index) const
void setSizeParameter(const std::string &sizeParam)
RFPortImplementation & port(int index) const
void removeParameter(const std::string &name)
void deleteExternalPort(RFExternalPort *port)
void setGuardPort(const std::string &guardPort)
Parameter parameter(int index) const
void addParameter(const std::string &name, const std::string &type, const std::string &value)
void setSeparateAddressCycleParameter(bool enable)
void setWidthParameter(const std::string &widthParam)
void deletePort(RFPortImplementation *port)
wxChoice * sizeChoice_
Pointer to size parameter choice widget.
void onAddExternalPort(wxCommandEvent &event)
HDB::RFImplementation::Parameter selectedParameter()
void onExternalPortActivation(wxListEvent &event)
wxSizer * createContents(wxWindow *parent, bool call_fit, bool set_sizer)
void onAddPort(wxCommandEvent &event)
wxListCtrl * sourceList_
Pointer to the source file list widget.
void onPortSelection(wxListEvent &event)
void onExternalPortSelection(wxListEvent &event)
HDB::RFExternalPort * selectedExternalPort()
void onDeleteExternalPort(wxCommandEvent &event)
void onDeleteParameter(wxCommandEvent &event)
HDB::RFImplementation & implementation_
RF Implementation to modify.
void onParameterActivation(wxListEvent &event)
void onSourceFileSelection(wxListEvent &event)
wxListCtrl * parameterList_
Pointer to the parameter list widget.
void onAddSourceFile(wxCommandEvent &event)
wxListCtrl * portList_
Pointer to the port list widget.
wxListCtrl * externalPortList_
Pointer to the external port list widget.
void onMoveSourceFileDown(wxCommandEvent &)
void onModifyPort(wxCommandEvent &event)
void onEditParameter(wxCommandEvent &event)
void onSACchoise(wxCommandEvent &event)
void onMoveSourceFileUp(wxCommandEvent &)
void onDeletePort(wxCommandEvent &event)
void onParameterSelection(wxListEvent &event)
void onDeleteSourceFile(wxCommandEvent &event)
HDB::RFPortImplementation * selectedPort()
void onOK(wxCommandEvent &event)
void onEditExternalPort(wxCommandEvent &event)
wxChoice * widthChoice_
Pointer to width parameter choice widget.
void onAddParameter(wxCommandEvent &event)
static std::string lcStringSelection(wxListCtrl *list, int column)
static wxString toWxString(const std::string &source)
static std::string toString(const wxString &source)
@ IN
Input port.
Definition HDBTypes.hh:41
std::string value
Value of the parameter.
Definition HDBTypes.hh:49
std::string type
Type of the parameter.
Definition HDBTypes.hh:48
std::string name
Name of the parameter.
Definition HDBTypes.hh:47