OpenASIP 2.2
Loading...
Searching...
No Matches
SimulateDialog.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 SimulateDialog.cc
26 *
27 * Definition of SimulateDialog class.
28 *
29 * @author Jussi Nykänen 2004 (nykanen-no.spam-cs.tut.fi)
30 * @note rating: red
31 */
32
33#include <wx/valgen.h>
34#include <boost/format.hpp>
35
36#include "SimulateDialog.hh"
37#include "SequenceTools.hh"
38#include "OSEdTextGenerator.hh"
39#include "GUITextGenerator.hh"
40#include "WidgetTools.hh"
41#include "WxConversion.hh"
42#include "OSEdConstants.hh"
43#include "Conversion.hh"
44#include "OperationSimulator.hh"
45#include "ErrorDialog.hh"
46#include "DialogPosition.hh"
48#include "Operation.hh"
49#include "DataObject.hh"
50#include "OperationContext.hh"
51#include "NumberControl.hh"
52#include "SimValue.hh"
53#include "ContainerTools.hh"
54#include "OSEdMainFrame.hh"
55#include "Memory.hh"
56#include "OperationContainer.hh"
57#include "OSEd.hh"
58#include "OSEdInformer.hh"
59#include "TCEString.hh"
61
62using boost::format;
63using std::string;
64using std::vector;
65
66const string SimulateDialog::FORMAT_SIGNED_INT = "signed int";
67const string SimulateDialog::FORMAT_UNSIGNED_INT = "unsigned int";
68const string SimulateDialog::FORMAT_DOUBLE = "double";
69const string SimulateDialog::FORMAT_FLOAT = "float";
70const string SimulateDialog::FORMAT_BINARY = "binary";
71const string SimulateDialog::FORMAT_HEXA_DECIMAL = "hexadecimal";
72
73BEGIN_EVENT_TABLE(SimulateDialog, wxDialog)
76
78 EVT_BUTTON(ID_BUTTON_TRIGGER, SimulateDialog::onTrigger)
79 EVT_BUTTON(ID_BUTTON_ADVANCE_LOCK, SimulateDialog::onAdvanceClock)
80 EVT_BUTTON(ID_BUTTON_RESET, SimulateDialog::onReset)
81 EVT_BUTTON(ID_BUTTON_SHOW_HIDE_REGISTERS, SimulateDialog::showOrHideRegisters)
83
84 EVT_CHOICE(ID_FORMAT, SimulateDialog::onFormatChanged)
85
88
89
90const wxString SimulateDialog::DIALOG_NAME = _T("SimulateDialog");
91
92/**
93 * Constructor.
94 *
95 * @param parent Parent window.
96 * @param operation Operation to be simulated.
97 */
99 wxWindow* parent,
100 Operation* operation,
101 const std::string& pathName,
102 const std::string& modName) :
103 wxDialog(parent, -1, _T(""),
104 DialogPosition::getPosition(DialogPosition::DIALOG_SIMULATE),
105 wxDefaultSize, wxRESIZE_BORDER, DIALOG_NAME),
106 operation_(operation), pathName_(pathName), modName_(modName), clock_(0) {
107
108 createContents(this, true, true);
109
110 for (int i = 0; i < operation_->numberOfInputs(); i++) {
111 inputs_.push_back(new DataObject());
112 inputs_[i]->setString("0");
113 }
114
115 for (int i = 0; i < operation_->numberOfOutputs(); i++) {
116 outputs_.push_back(new DataObject());
117 outputs_[i]->setString("0");
118 }
119
120 inputList_ = dynamic_cast<wxListCtrl*>(FindWindow(ID_INPUT_LIST));
121 outputList_ = dynamic_cast<wxListCtrl*>(FindWindow(ID_OUTPUT_LIST));
122 updateValue_ = dynamic_cast<NumberControl*>(FindWindow(ID_VALUE));
123 format_ = dynamic_cast<wxChoice*>(FindWindow(ID_FORMAT));
124 //triggerBM_ = dynamic_cast<wxStaticBitmap*>(FindWindow(ID_BITMAP_READY));
125
126 //lateResultBM_ =
127 // dynamic_cast<wxStaticBitmap*>(FindWindow(ID_BITMAP_UPDATE));
128
129 FindWindow(wxID_OK)->SetFocus();
130
131 format_->Append(WxConversion::toWxString(FORMAT_SIGNED_INT));
132 format_->Append(WxConversion::toWxString(FORMAT_UNSIGNED_INT));
133 format_->Append(WxConversion::toWxString(FORMAT_DOUBLE));
134 format_->Append(WxConversion::toWxString(FORMAT_FLOAT));
135 format_->Append(WxConversion::toWxString(FORMAT_BINARY));
136 format_->Append(WxConversion::toWxString(FORMAT_HEXA_DECIMAL));
137
138 format_->SetSelection(0);
139
140 setTexts();
141
142 infoDialog_ = new SimulationInfoDialog(
144 OSEdInformer* informer = wxGetApp().mainFrame()->informer();
145 informer->registerListener(OSEdInformer::EVENT_REGISTER, infoDialog_);
146 informer->registerListener(OSEdInformer::EVENT_RESET, infoDialog_);
147
148 /* Ensure we won't refresh the behavior from the plugin file again
149 during the simulation. This leads to crashes due to using a state
150 instance created by a behavior definition created by a previously
151 loaded behavior instance. This effectively "freezes" the behavior
152 to the one loaded in the next behavior function call. */
153 behaviorProxy_ =
154 dynamic_cast<OperationBehaviorProxy*>(&operation->behavior());
155 assert(behaviorProxy_ != NULL);
156 behaviorProxy_->setAlwaysReloadBehavior(false);
157}
158
159/**
160 * Destructor.
161 */
163
166
167 int x, y;
168 GetPosition(&x, &y);
169 wxPoint point(x, y);
171
172 /* Ensure we won't use the old state object the next time because
173 the behavior will be reloaded from the dynlib. It would crash. */
176
177 /* "Unfreeze" the OperationBehavior. Now it will be reloaded always
178 when accessing the methods to enable the dynamic menu items in
179 the operation list. */
182
183}
184
185/**
186 * Transfers data to window.
187 */
188bool
190 updateLists();
191 return wxWindow::TransferDataToWindow();
192}
193
194/**
195 * Set texts to widgets.
196 */
197void
199
202
203 // title
205 fmt % operation_->name();
206 SetTitle(WxConversion::toWxString(fmt.str()));
207
208 // static texts
209 //WidgetTools::setLabel(&osedText, FindWindow(ID_TEXT_READY),
210 // OSEdTextGenerator::TXT_LABEL_READY);
211
212 //WidgetTools::setLabel(&osedText, FindWindow(ID_TEXT_UPDATE),
213 // OSEdTextGenerator::TXT_LABEL_UPDATE);
214
217
220
221 // buttons
222 WidgetTools::setLabel(&guiText, FindWindow(wxID_OK),
224
227
230
233
236
239
240 // column titles
242 inputList_->InsertColumn(
243 0, WxConversion::toWxString(fmt.str()), wxLIST_FORMAT_LEFT,
245
246 outputList_->InsertColumn(
247 0, WxConversion::toWxString(fmt.str()), wxLIST_FORMAT_LEFT,
249
251 inputList_->InsertColumn(
252 1, WxConversion::toWxString(fmt.str()), wxLIST_FORMAT_LEFT,
254
255 outputList_->InsertColumn(
256 1, WxConversion::toWxString(fmt.str()), wxLIST_FORMAT_LEFT,
258
259 // box sizers
262
265}
266
267/**
268 * Updates input and output value lists.
269 */
270void
272
273 inputList_->DeleteAllItems();
274 outputList_->DeleteAllItems();
275 for (unsigned int i = 0; i < inputs_.size(); i++) {
276 wxString id = WxConversion::toWxString(i + 1);
277 inputList_->InsertItem(i, id);
278 inputList_->SetItem(
279 i, 1, WxConversion::toWxString(inputs_[i]->stringValue()));
280 }
281
282 int k = inputs_.size() + 1;
283 for (unsigned int i = 0; i < outputs_.size(); i++) {
284 wxString id = WxConversion::toWxString(k);
285 outputList_->InsertItem(i, id);
286 outputList_->SetItem(
287 i, 1, WxConversion::toWxString(outputs_[i]->stringValue()));
288 k++;
289 }
290
291 wxListEvent dummy;
293}
294
295/**
296 * Handles the event when a value is selected or deselected on input list.
297 */
298void
300 if (inputList_->GetSelectedItemCount() != 1) {
301 FindWindow(ID_BUTTON_UPDATE)->Disable();
302 } else {
303 FindWindow(ID_BUTTON_UPDATE)->Enable();
304 }
305}
306
307/**
308 * Handles the event when input value is updated.
309 */
310void
312 TransferDataFromWindow();
313 string inputString = WidgetTools::lcStringSelection(inputList_, 0);
314 if (inputString != "") {
315 int input = Conversion::toInt(inputString);
316 SimValue* temp = new SimValue(32);
318 double value = updateValue_->doubleValue();
319 *temp = value;
320 } else {
321 int value = updateValue_->intValue();
322 *temp = value;
323 }
324 inputs_[input - 1]->setString(formattedValue(temp));
325 delete temp;
326 updateLists();
327 }
328}
329
330/**
331 * Handles the event when Reset button is pushed.
332 *
333 * Reset sets all values to their defaults.
334 */
335void
336SimulateDialog::onReset(wxCommandEvent&) {
337
340
341 for (size_t i = 0; i < inputs_.size(); i++) {
342 inputs_[i]->setString("0");
343 }
344
345 for (size_t i = 0; i < outputs_.size(); i++) {
346 outputs_[i]->setString("0");
347 }
348
349 //triggerBM_->SetBitmap(createBitmap(2));
350 //lateResultBM_->SetBitmap(createBitmap(2));
351 clock_ = 0;
354 updateLists();
355 OSEdInformer* informer = wxGetApp().mainFrame()->informer();
357}
358
359/**
360 * Handles the event when Trigger button is pushed.
361 */
362void
364
366 vector<SimValue*> outputs;
367 vector<DataObject> inputs;
368 for (size_t i = 0; i < inputs_.size(); i++) {
369 inputs.push_back(*inputs_[i]);
370 }
371
372 string result = "";
373
374 createState();
376 if (simulator.simulateTrigger(
377 *operation_, inputs, outputs, context, result)) {
378
379 //triggerBM_->SetBitmap(createBitmap(1));
380 setOutputValues(outputs);
381 updateLists();
382 } else {
383 //triggerBM_->SetBitmap(createBitmap(0));
384 if (result != "") {
385 ErrorDialog dialog(this, WxConversion::toWxString(result));
386 dialog.ShowModal();
387 }
388 }
390 OSEdInformer* informer = wxGetApp().mainFrame()->informer();
393}
394
395/**
396 * Handles the event when advance clock button is pushed.
397 */
398void
408
409/**
410 * Handles the event when intput and output format is changed.
411 */
412void
414
415 vector<SimValue*> outputs;
416
418 string result = "";
419
420 for (size_t i = 0; i < inputs_.size(); i++) {
421 SimValue* sim = new SimValue(32);
422 string value = inputs_[i]->stringValue();
423 simulator.initializeSimValue(value, sim, result);
424 outputs.push_back(sim);
425 }
426
427 for (size_t i = 0; i < outputs_.size(); i++) {
428 SimValue* sim = new SimValue(32);
429 string value = outputs_[i]->stringValue();
430 simulator.initializeSimValue(value, sim, result);
431 outputs.push_back(sim);
432 }
433
434 setInputValues(outputs);
435 setOutputValues(outputs);
436 updateLists();
438 OSEdInformer* informer = wxGetApp().mainFrame()->informer();
440}
441
442/**
443 * Handles the event when registers are shown or hidden.
444 */
445void
447 wxButton* button =
448 dynamic_cast<wxButton*>(FindWindow(ID_BUTTON_SHOW_HIDE_REGISTERS));
451 if (button->GetLabel() == WxConversion::toWxString(fmt.str())) {
452 int x, y;
453 GetPosition(&x, &y);
454 int width, height;
455 GetSize(&width, &height);
456 y += height + 25;
457 infoDialog_->Move(x, y);
458 infoDialog_->Show(true);
460 button->SetLabel(WxConversion::toWxString(fmt.str()));
461 } else {
462 infoDialog_->Show(false);
463 button->SetLabel(WxConversion::toWxString(fmt.str()));
464 }
465}
466
467/**
468 * Handles the event when OK button is pushed.
469 */
470void
471SimulateDialog::onOK(wxCommandEvent&) {
472 OSEdInformer* informer = wxGetApp().mainFrame()->informer();
475 infoDialog_->Destroy();
476 Destroy();
477}
478
479/**
480 * Handles the event when window is closed.
481 *
482 * @param event Event to be handled.
483 */
484void
485SimulateDialog::onClose(wxCloseEvent& event){
486 OSEdInformer* informer = wxGetApp().mainFrame()->informer();
489 infoDialog_->Destroy();
490 event.Skip();
491}
492
493/**
494 * Sets the input values after the format has changed.
495 *
496 * @param inputs Input values of operation.
497 */
498void
499SimulateDialog::setInputValues(std::vector<SimValue*> inputs) {
500
501 string inputFormat = WxConversion::toString(format_->GetStringSelection());
502
503 for (size_t i = 0; i < inputs_.size(); i++) {
504 SimValue* current = inputs[i];
505 inputs_[i]->setString(formattedValue(current));
506 }
507}
508
509/**
510 * Sets the output values of the operation after executing a command.
511 *
512 * @param outputs Output values of operation.
513 */
514void
515SimulateDialog::setOutputValues(std::vector<SimValue*> outputs) {
516
517 int k = 0;
518 size_t upperBound = inputs_.size() + outputs_.size();
519 for (size_t i = inputs_.size(); i < upperBound; i++) {
520 SimValue* current = outputs[i];
521 outputs_[k]->setString(formattedValue(current));
522 k++;
523 }
524}
525
526/**
527 * Formats the value of the SimValue.
528 *
529 * @param value Value to be formatted.
530 */
531string
533
534 string format = WxConversion::toString(format_->GetStringSelection());
535 if (format == FORMAT_SIGNED_INT) {
536 SIntWord intSigned = value->sIntWordValue();
537 return Conversion::toString(static_cast<int>(intSigned));
538 } else if (format == FORMAT_UNSIGNED_INT) {
539 UIntWord intUnsigned = value->uIntWordValue();
540 return Conversion::toString(intUnsigned);
541 } else if (format == FORMAT_DOUBLE) {
542 DoubleWord doubleWord = value->doubleWordValue();
543 return Conversion::toString(doubleWord);
544 } else if (format == FORMAT_FLOAT) {
545 FloatWord floatWord = value->floatWordValue();
546 string floatString = Conversion::toString(floatWord);
547 if (floatString.find(".") == string::npos) {
548 floatString += ".0";
549 }
550 floatString += "f";
551 return floatString;
552 } else if (format == FORMAT_BINARY) {
553 UIntWord binary = value->uIntWordValue();
554 return Conversion::toBinString(static_cast<int>(binary));
555 } else if (format == FORMAT_HEXA_DECIMAL) {
556 UIntWord hex = value->uIntWordValue();
557 return Conversion::toHexString(hex);
558 }
559 return "";
560}
561
562/**
563 * Creates the state for the operation.
564 */
565void
570
571/**
572 * Creates the contents of the dialog.
573 *
574 * NOTE! This function was generated by wxDesigner.
575 *
576 * @param parent Parent window.
577 * @param call_fit If true fits the contenst inside the dialog.
578 * @param set_sizer If true sets the main sizer as dialog contents.
579 * @return The created sizer.
580 */
581wxSizer*
583 wxWindow *parent,
584 bool call_fit,
585 bool set_sizer ) {
586
587 wxBoxSizer *item0 = new wxBoxSizer( wxVERTICAL );
588
589 wxBoxSizer *item1 = new wxBoxSizer( wxHORIZONTAL );
590
591 wxStaticBox *item3 = new wxStaticBox( parent, -1, wxT("Input values") );
592 wxStaticBoxSizer *item2 = new wxStaticBoxSizer( item3, wxVERTICAL );
593 inputSizer_ = item2;
594
595 wxListCtrl *item4 = new wxListCtrl( parent, ID_INPUT_LIST, wxDefaultPosition, wxSize(160,120), wxLC_REPORT|wxSUNKEN_BORDER );
596 item2->Add( item4, 1, wxGROW|wxALL, 5 );
597
598 wxBoxSizer *item5 = new wxBoxSizer( wxHORIZONTAL );
599
600 NumberControl *item6 = new NumberControl(
601 parent, ID_VALUE, wxDefaultPosition, wxSize(200, -1),
605
606 item5->Add( item6, 0, wxALIGN_CENTER|wxALL, 5 );
607
608 wxButton *item7 = new wxButton( parent, ID_BUTTON_UPDATE, wxT("Update"), wxDefaultPosition, wxDefaultSize, 0 );
609 item5->Add( item7, 0, wxALIGN_CENTER|wxALL, 5 );
610
611 item2->Add( item5, 0, wxALIGN_CENTER|wxALL, 5 );
612
613 item1->Add( item2, 1, wxGROW|wxALL, 5 );
614
615 wxStaticBox *item9 = new wxStaticBox( parent, -1, wxT("Output values") );
616 wxStaticBoxSizer *item8 = new wxStaticBoxSizer( item9, wxVERTICAL );
617 outputSizer_ = item8;
618
619 wxListCtrl *item10 = new wxListCtrl( parent, ID_OUTPUT_LIST, wxDefaultPosition, wxSize(200,120), wxLC_REPORT|wxSUNKEN_BORDER );
620 item8->Add( item10, 1, wxGROW|wxALL, 5 );
621
622 item1->Add( item8, 1, wxGROW|wxALL, 5 );
623
624 wxGridSizer *item11 = new wxGridSizer( 2, 0, 0 );
625
626 //wxStaticText *item12 = new wxStaticText( parent, ID_TEXT_READY, wxT("Ready"), wxDefaultPosition, wxDefaultSize, 0 );
627 //item11->Add( item12, 0, wxALIGN_CENTER|wxALL, 5 );
628
629 //wxStaticBitmap *item13 = new wxStaticBitmap( parent, ID_BITMAP_READY, createBitmap( 2 ), wxDefaultPosition, wxDefaultSize );
630 //item11->Add( item13, 0, wxALIGN_CENTER|wxALL, 5 );
631
632 //wxStaticText *item14 = new wxStaticText( parent, ID_TEXT_UPDATE, wxT("Update"), wxDefaultPosition, wxDefaultSize, 0 );
633 //item11->Add( item14, 0, wxALIGN_CENTER|wxALL, 5 );
634
635 //wxStaticBitmap *item15 = new wxStaticBitmap( parent, ID_BITMAP_UPDATE, createBitmap( 2 ), wxDefaultPosition, wxDefaultSize );
636 //item11->Add( item15, 0, wxALIGN_CENTER|wxALL, 5 );
637
638 wxStaticText *item16 = new wxStaticText( parent, ID_TEXT_CLOCK, wxT("Clock count:"), wxDefaultPosition, wxDefaultSize, 0 );
639 item11->Add( item16, 0, wxALIGN_CENTER|wxALL, 5 );
640
641 wxStaticText *item17 = new wxStaticText( parent, ID_TEXT_CLOCK_VALUE, wxT("0"), wxDefaultPosition, wxDefaultSize, 0 );
642 item11->Add( item17, 0, wxALIGN_CENTER|wxALL, 5 );
643
644 item1->Add( item11, 0, wxGROW|wxALL, 5 );
645
646 item0->Add( item1, 1, wxGROW|wxALL, 5 );
647
648 wxBoxSizer *item18 = new wxBoxSizer( wxHORIZONTAL );
649
650 wxStaticText *item19 = new wxStaticText( parent, ID_FORMAT_TEXT, wxT("Format:"), wxDefaultPosition, wxDefaultSize, 0 );
651 item18->Add( item19, 0, wxALIGN_CENTER|wxALL, 5 );
652
653 wxString *strs20 = (wxString*) NULL;
654 wxChoice *item20 = new wxChoice( parent, ID_FORMAT, wxDefaultPosition, wxSize(130,-1), 0, strs20, 0 );
655 item18->Add( item20, 0, wxALIGN_CENTER|wxALL, 5 );
656
657 item0->Add( item18, 0, wxALIGN_CENTER|wxALL, 5 );
658
659 wxBoxSizer *item21 = new wxBoxSizer( wxHORIZONTAL );
660
661 wxButton *item22 = new wxButton( parent, ID_BUTTON_RESET, wxT("Reset"), wxDefaultPosition, wxDefaultSize, 0 );
662 item21->Add( item22, 0, wxALIGN_CENTER|wxALL, 5 );
663
664 wxButton *item23 = new wxButton( parent, ID_BUTTON_TRIGGER, wxT("Trigger"), wxDefaultPosition, wxDefaultSize, 0 );
665 item21->Add( item23, 0, wxALIGN_CENTER|wxALL, 5 );
666
667 wxButton *item25 = new wxButton( parent, ID_BUTTON_ADVANCE_LOCK, wxT("Advance Clock"), wxDefaultPosition, wxDefaultSize, 0 );
668 item21->Add( item25, 0, wxALIGN_CENTER|wxALL, 5 );
669
670 wxButton *item26 = new wxButton( parent, ID_BUTTON_SHOW_HIDE_REGISTERS, wxT("Show registers"), wxDefaultPosition, wxDefaultSize, 0 );
671 item21->Add( item26, 0, wxALIGN_CENTER|wxALL, 5 );
672
673 wxButton *item27 = new wxButton( parent, wxID_OK, wxT("&OK"), wxDefaultPosition, wxDefaultSize, 0 );
674 item21->Add( item27, 0, wxALIGN_CENTER|wxALL, 5 );
675
676 item0->Add( item21, 0, wxALIGN_CENTER|wxALL, 5 );
677
678 if (set_sizer)
679 {
680 parent->SetSizer( item0 );
681 if (call_fit)
682 item0->SetSizeHints( parent );
683 }
684
685 return item0;
686
687}
688
689/**
690 *
691 */
692wxBitmap
693SimulateDialog::createBitmap(unsigned int index) {
694
695 if (index == 0)
696 {
697 /* XPM */
698 static const char *xpm_data[] = {
699 /* columns rows colors chars-per-pixel */
700 "16 15 2 1",
701 " c None",
702 "a c #FF0000",
703 /* pixels */
704 " ",
705 " aaaaaaaaaaaaaa ",
706 " aaaaaaaaaaaaaa ",
707 " aaaaaaaaaaaaaa ",
708 " aaaaaaaaaaaaaa ",
709 " aaaaaaaaaaaaaa ",
710 " aaaaaaaaaaaaaa ",
711 " aaaaaaaaaaaaaa ",
712 " aaaaaaaaaaaaaa ",
713 " aaaaaaaaaaaaaa ",
714 " aaaaaaaaaaaaaa ",
715 " aaaaaaaaaaaaaa ",
716 " aaaaaaaaaaaaaa ",
717 " aaaaaaaaaaaaaa ",
718 " "
719 };
720 wxBitmap bitmap( xpm_data );
721 return bitmap;
722 }
723 if (index == 1)
724 {
725 /* XPM */
726 static const char *xpm_data[] = {
727 /* columns rows colors chars-per-pixel */
728 "16 15 2 1",
729 " c None",
730 "b c #00FF00",
731 /* pixels */
732 " ",
733 " bbbbbbbbbbbbbb ",
734 " bbbbbbbbbbbbbb ",
735 " bbbbbbbbbbbbbb ",
736 " bbbbbbbbbbbbbb ",
737 " bbbbbbbbbbbbbb ",
738 " bbbbbbbbbbbbbb ",
739 " bbbbbbbbbbbbbb ",
740 " bbbbbbbbbbbbbb ",
741 " bbbbbbbbbbbbbb ",
742 " bbbbbbbbbbbbbb ",
743 " bbbbbbbbbbbbbb ",
744 " bbbbbbbbbbbbbb ",
745 " bbbbbbbbbbbbbb ",
746 " "
747 };
748 wxBitmap bitmap( xpm_data );
749 return bitmap;
750 }
751 if (index == 2)
752 {
753 /* XPM */
754 static const char *xpm_data[] = {
755 /* columns rows colors chars-per-pixel */
756 "16 15 2 1",
757 " c None",
758 "a c Black",
759 /* pixels */
760 " ",
761 " aaaaaaaaaaaaaa ",
762 " aaaaaaaaaaaaaa ",
763 " aaaaaaaaaaaaaa ",
764 " aaaaaaaaaaaaaa ",
765 " aaaaaaaaaaaaaa ",
766 " aaaaaaaaaaaaaa ",
767 " aaaaaaaaaaaaaa ",
768 " aaaaaaaaaaaaaa ",
769 " aaaaaaaaaaaaaa ",
770 " aaaaaaaaaaaaaa ",
771 " aaaaaaaaaaaaaa ",
772 " aaaaaaaaaaaaaa ",
773 " aaaaaaaaaaaaaa ",
774 " "
775 };
776 wxBitmap bitmap( xpm_data );
777 return bitmap;
778 }
779 return wxNullBitmap;
780}
#define assert(condition)
Word UIntWord
Definition BaseType.hh:144
float FloatWord
Definition BaseType.hh:160
double DoubleWord
Definition BaseType.hh:166
SignedWord SIntWord
Definition BaseType.hh:149
END_EVENT_TABLE() using namespace IDF
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
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 toBinString(int source)
Definition Conversion.cc:81
static std::string toHexString(T source, std::size_t digits=0, bool include0x=true)
static std::string toString(const T &source)
static int toInt(const T &source)
static void setPosition(Dialogs dialog, wxPoint point)
@ DIALOG_SIMULATE
Simulation dialog.
@ TXT_BUTTON_OK
Label for OK button.
static GUITextGenerator * instance()
virtual void advanceClock()
Definition Memory.cc:819
int intValue() const
static const long MODE_INT
Style flag for signed integer mode availablity.
static const long MODE_UNSIGNED
Style flag for unsigned integer mode availability.
static const long MODE_DOUBLE
Style flag for double mode availability.
static const long MODE_FLOAT
Style flag for float mode availability.
double doubleValue() const
static const long MODE_BINARY
Style flag for binary mode availability.
long mode() const
static const long MODE_HEXADECIMAL
Style flag for hexadecimal mode availability.
static const int DEFAULT_COLUMN_WIDTH
Default column width.
void handleEvent(EventId event)
@ EVENT_REGISTER
Event when register value might change.
@ EVENT_RESET
Event when operation is reseted.
@ EVENT_MEMORY
Event when memory may be changed.
void registerListener(EventId event, OSEdListener *listener)
void unregisterListener(EventId event, OSEdListener *listener)
static OSEdTextGenerator & instance()
@ TXT_BOX_INPUT_VALUES
Input values sizer label.
@ TXT_BUTTON_ADVANCE_LOCK
Advance Lock button label.
@ TXT_BUTTON_RESET
Reset button label.
@ TXT_COLUMN_OPERAND
Operand column header.
@ TXT_SIMULATE_DIALOG_TITLE
Simulate dialog title.
@ TXT_COLUMN_VALUE
Value column header.
@ TXT_BUTTON_HIDE_REGISTERS
Hide registers button label.
@ TXT_LABEL_CLOCK
Clock label.
@ TXT_BOX_OUTPUT_VALUES
Output values sizer label.
@ TXT_BUTTON_TRIGGER
Trigger button label.
@ TXT_LABEL_FORMAT
Format label.
@ TXT_BUTTON_UPDATE
Update button label.
@ TXT_BUTTON_SHOW_REGISTERS
Show registers button label.
virtual void setAlwaysReloadBehavior(bool f)
virtual void createState(OperationContext &context) const
virtual void deleteState(OperationContext &context) const
static Memory & memory()
static OperationContext & operationContext()
static OperationSimulator & instance()
bool simulateTrigger(Operation &op, std::vector< DataObject > inputs, std::vector< SimValue * > &outputs, OperationContext &context, std::string &result)
bool initializeSimValue(std::string value, SimValue *sim, std::string &result)
virtual TCEString name() const
Definition Operation.cc:93
virtual OperationBehavior & behavior() const
Definition Operation.cc:388
static void deleteAllItems(SequenceType &aSequence)
SIntWord sIntWordValue() const
Definition SimValue.cc:944
UIntWord uIntWordValue() const
Definition SimValue.cc:972
DoubleWord doubleWordValue() const
Definition SimValue.cc:1052
FloatWord floatWordValue() const
Definition SimValue.cc:1075
void onSelection(wxListEvent &event)
static const std::string FORMAT_SIGNED_INT
Signed int format.
void onFormatChanged(wxCommandEvent &event)
wxChoice * format_
Choice list of possible output formats.
static const std::string FORMAT_BINARY
Binary format.
std::string formattedValue(SimValue *value)
void setOutputValues(std::vector< SimValue * > outputs)
static const std::string FORMAT_UNSIGNED_INT
Unsigned int format.
wxListCtrl * inputList_
Input list.
void onTrigger(wxCommandEvent &event)
SimulationInfoDialog * infoDialog_
Dialog for showing additional information.
void setInputValues(std::vector< SimValue * > inputs)
wxStaticBoxSizer * inputSizer_
Input operand sizer.
std::vector< DataObject * > outputs_
List of output values.
wxStaticBoxSizer * outputSizer_
Output operand sizer.
wxSizer * createContents(wxWindow *parent, bool call_fit, bool set_sizer)
virtual ~SimulateDialog()
static const std::string FORMAT_HEXA_DECIMAL
Hexadecimal format.
void showOrHideRegisters(wxCommandEvent &event)
unsigned int clock_
Variable where the value of clock is kept.
OperationBehaviorProxy * behaviorProxy_
The behavior proxy that loads the behavior. Used to "freeze" the behavior loading for the duration of...
Operation * operation_
Bitmap for Trigger result.
virtual bool TransferDataToWindow()
void onReset(wxCommandEvent &event)
wxBitmap createBitmap(unsigned int index)
static const std::string FORMAT_DOUBLE
Double format.
std::vector< DataObject * > inputs_
List of input values.
NumberControl * updateValue_
Text control for updating input values.
void onOK(wxCommandEvent &event)
void onClose(wxCloseEvent &)
void onAdvanceClock(wxCommandEvent &event)
wxListCtrl * outputList_
Output list.
void onUpdateValue(wxCommandEvent &event)
static const std::string FORMAT_FLOAT
Float format.
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)