OpenASIP  2.0
SimulateDialog.hh
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.hh
26  *
27  * Declaration of SimulateDialog class.
28  *
29  * @author Jussi Nykänen 2004 (nykanen-no.spam-cs.tut.fi)
30  * @note rating: red
31  */
32 
33 #ifndef TTA_SIMULATE_DIALOG_HH
34 #define TTA_SIMULATE_DIALOG_HH
35 
36 #include <wx/wx.h>
37 #include <wx/listctrl.h>
38 #include <vector>
39 #include <string>
40 
41 #include "OperationContext.hh"
42 #include "SimValue.hh"
43 
45 class Operation;
46 class DataObject;
47 class NumberControl;
49 
50 /**
51  * Class for simulating operation behavior.
52  */
53 class SimulateDialog : public wxDialog {
54 public:
55 
57  wxWindow* parent,
58  Operation* operation,
59  const std::string& pathName,
60  const std::string& modName);
61  virtual ~SimulateDialog();
62 
63  std::string formattedValue(SimValue* value);
64 
65  /// Name of the dialog so it can be found with wxWindow::FindWindowByName
66  static const wxString DIALOG_NAME;
67 
68 private:
69  /// Copying not allowed.
71  /// Assignment not allowed.
73 
74  wxSizer* createContents(wxWindow* parent, bool call_fit, bool set_sizer);
75  wxBitmap createBitmap(unsigned int index);
76  virtual bool TransferDataToWindow();
77  void updateLists();
78  void setTexts();
79  void onSelection(wxListEvent& event);
80  void onUpdateValue(wxCommandEvent& event);
81  void onReset(wxCommandEvent& event);
82  void onTrigger(wxCommandEvent& event);
83  void onLateResult(wxCommandEvent& event);
84  void onAdvanceClock(wxCommandEvent& event);
85  void onFormatChanged(wxCommandEvent& event);
86  void showOrHideRegisters(wxCommandEvent& event);
87  void onOK(wxCommandEvent& event);
88  void onClose(wxCloseEvent&);
89  void setInputValues(std::vector<SimValue*> inputs);
90  void setOutputValues(std::vector<SimValue*> outputs);
91  void createState();
92 
93  /// Signed int format.
94  static const std::string FORMAT_SIGNED_INT;
95  /// Unsigned int format.
96  static const std::string FORMAT_UNSIGNED_INT;
97  /// Double format.
98  static const std::string FORMAT_DOUBLE;
99  /// Float format.
100  static const std::string FORMAT_FLOAT;
101  /// Binary format.
102  static const std::string FORMAT_BINARY;
103  /// Hexadecimal format.
104  static const std::string FORMAT_HEXA_DECIMAL;
105 
106  /**
107  * Component ids.
108  */
109  enum {
110  ID_INPUT_LIST = 12000,
127  };
128 
129  /// Input operand sizer.
130  wxStaticBoxSizer* inputSizer_;
131  /// Output operand sizer.
132  wxStaticBoxSizer* outputSizer_;
133  /// Input list.
134  wxListCtrl* inputList_;
135  /// Output list.
136  wxListCtrl* outputList_;
137  /// Text control for updating input values.
139  /// Choice list of possible output formats.
140  wxChoice* format_;
141  /// Bitmap for Trigger result.
142  //wxStaticBitmap* triggerBM_;
143  /// Bitmap for Late Result result.
144  //wxStaticBitmap* lateResultBM_;
145  /// Operation to be simulated.
147  /// Path in which operation module belongs to.
148  std::string pathName_;
149  /// Module in which operation belongs to.
150  std::string modName_;
151  /// List of input values.
152  std::vector<DataObject*> inputs_;
153  /// List of output values.
154  std::vector<DataObject*> outputs_;
155  /// Variable where the value of clock is kept.
156  unsigned int clock_;
157  /// Dialog for showing additional information.
159  /// The behavior proxy that loads the behavior.
160  /// Used to "freeze" the behavior loading for the duration of the simulation.
162 
163  DECLARE_EVENT_TABLE()
164 };
165 
166 #endif
SimulateDialog::~SimulateDialog
virtual ~SimulateDialog()
Definition: SimulateDialog.cc:162
SimulateDialog::ID_BUTTON_ADVANCE_LOCK
@ ID_BUTTON_ADVANCE_LOCK
Definition: SimulateDialog.hh:123
SimulateDialog::ID_VALUE
@ ID_VALUE
Definition: SimulateDialog.hh:111
SimulateDialog::ID_OUTPUT_LIST
@ ID_OUTPUT_LIST
Definition: SimulateDialog.hh:113
SimulateDialog::onUpdateValue
void onUpdateValue(wxCommandEvent &event)
Definition: SimulateDialog.cc:311
SimulateDialog::ID_FORMAT_TEXT
@ ID_FORMAT_TEXT
Definition: SimulateDialog.hh:125
SimulateDialog::ID_TEXT_READY
@ ID_TEXT_READY
Definition: SimulateDialog.hh:114
SimulateDialog::infoDialog_
SimulationInfoDialog * infoDialog_
Dialog for showing additional information.
Definition: SimulateDialog.hh:158
SimulateDialog::ID_TEXT_CLOCK
@ ID_TEXT_CLOCK
Definition: SimulateDialog.hh:118
SimulateDialog::clock_
unsigned int clock_
Variable where the value of clock is kept.
Definition: SimulateDialog.hh:156
SimulateDialog::operator=
SimulateDialog & operator=(const SimulateDialog &)
Assignment not allowed.
SimulateDialog::ID_BUTTON_UPDATE
@ ID_BUTTON_UPDATE
Definition: SimulateDialog.hh:112
SimulateDialog::updateValue_
NumberControl * updateValue_
Text control for updating input values.
Definition: SimulateDialog.hh:138
SimulateDialog::outputSizer_
wxStaticBoxSizer * outputSizer_
Output operand sizer.
Definition: SimulateDialog.hh:132
SimulateDialog::outputList_
wxListCtrl * outputList_
Output list.
Definition: SimulateDialog.hh:136
SimulateDialog::inputSizer_
wxStaticBoxSizer * inputSizer_
Input operand sizer.
Definition: SimulateDialog.hh:130
DataObject
Definition: DataObject.hh:50
SimulateDialog::createContents
wxSizer * createContents(wxWindow *parent, bool call_fit, bool set_sizer)
Definition: SimulateDialog.cc:582
SimulateDialog
Definition: SimulateDialog.hh:53
SimulateDialog::operation_
Operation * operation_
Bitmap for Trigger result.
Definition: SimulateDialog.hh:146
SimulateDialog::FORMAT_FLOAT
static const std::string FORMAT_FLOAT
Float format.
Definition: SimulateDialog.hh:100
SimulateDialog::ID_BUTTON_SHOW_HIDE_REGISTERS
@ ID_BUTTON_SHOW_HIDE_REGISTERS
Definition: SimulateDialog.hh:124
SimulateDialog::ID_TEXT_CLOCK_VALUE
@ ID_TEXT_CLOCK_VALUE
Definition: SimulateDialog.hh:119
SimulateDialog::TransferDataToWindow
virtual bool TransferDataToWindow()
Definition: SimulateDialog.cc:189
SimulateDialog::onTrigger
void onTrigger(wxCommandEvent &event)
Definition: SimulateDialog.cc:363
SimValue
Definition: SimValue.hh:96
SimulateDialog::FORMAT_UNSIGNED_INT
static const std::string FORMAT_UNSIGNED_INT
Unsigned int format.
Definition: SimulateDialog.hh:96
SimulateDialog::onSelection
void onSelection(wxListEvent &event)
Definition: SimulateDialog.cc:299
SimulateDialog::ID_BITMAP_READY
@ ID_BITMAP_READY
Definition: SimulateDialog.hh:115
SimulateDialog::behaviorProxy_
OperationBehaviorProxy * behaviorProxy_
The behavior proxy that loads the behavior. Used to "freeze" the behavior loading for the duration of...
Definition: SimulateDialog.hh:161
SimulateDialog::updateLists
void updateLists()
Definition: SimulateDialog.cc:271
SimulateDialog::FORMAT_HEXA_DECIMAL
static const std::string FORMAT_HEXA_DECIMAL
Hexadecimal format.
Definition: SimulateDialog.hh:104
SimulateDialog::inputList_
wxListCtrl * inputList_
Input list.
Definition: SimulateDialog.hh:134
SimulateDialog::ID_TEXT_UPDATE
@ ID_TEXT_UPDATE
Definition: SimulateDialog.hh:116
OperationBehaviorProxy
Definition: OperationBehaviorProxy.hh:58
SimulateDialog::setOutputValues
void setOutputValues(std::vector< SimValue * > outputs)
Definition: SimulateDialog.cc:515
SimulateDialog::setInputValues
void setInputValues(std::vector< SimValue * > inputs)
Definition: SimulateDialog.cc:499
SimulateDialog::showOrHideRegisters
void showOrHideRegisters(wxCommandEvent &event)
Definition: SimulateDialog.cc:446
SimulateDialog::pathName_
std::string pathName_
Path in which operation module belongs to.
Definition: SimulateDialog.hh:148
SimulateDialog::ID_INPUT_LIST
@ ID_INPUT_LIST
Definition: SimulateDialog.hh:110
SimulateDialog::modName_
std::string modName_
Module in which operation belongs to.
Definition: SimulateDialog.hh:150
SimulateDialog::ID_BUTTON_RESET
@ ID_BUTTON_RESET
Definition: SimulateDialog.hh:120
SimulateDialog::inputs_
std::vector< DataObject * > inputs_
List of input values.
Definition: SimulateDialog.hh:152
Operation
Definition: Operation.hh:59
SimulateDialog::outputs_
std::vector< DataObject * > outputs_
List of output values.
Definition: SimulateDialog.hh:154
SimulationInfoDialog
Definition: SimulationInfoDialog.hh:48
SimulateDialog::DIALOG_NAME
static const wxString DIALOG_NAME
Name of the dialog so it can be found with wxWindow::FindWindowByName.
Definition: SimulateDialog.hh:66
SimulateDialog::SimulateDialog
SimulateDialog(wxWindow *parent, Operation *operation, const std::string &pathName, const std::string &modName)
Definition: SimulateDialog.cc:98
SimulateDialog::setTexts
void setTexts()
Definition: SimulateDialog.cc:198
SimulateDialog::onFormatChanged
void onFormatChanged(wxCommandEvent &event)
Definition: SimulateDialog.cc:413
SimValue.hh
SimulateDialog::createState
void createState()
Definition: SimulateDialog.cc:566
SimulateDialog::ID_BUTTON_TRIGGER
@ ID_BUTTON_TRIGGER
Definition: SimulateDialog.hh:121
NumberControl
Definition: NumberControl.hh:59
SimulateDialog::onClose
void onClose(wxCloseEvent &)
Definition: SimulateDialog.cc:485
SimulateDialog::FORMAT_BINARY
static const std::string FORMAT_BINARY
Binary format.
Definition: SimulateDialog.hh:102
SimulateDialog::onAdvanceClock
void onAdvanceClock(wxCommandEvent &event)
Definition: SimulateDialog.cc:399
SimulateDialog::FORMAT_SIGNED_INT
static const std::string FORMAT_SIGNED_INT
Signed int format.
Definition: SimulateDialog.hh:94
SimulateDialog::ID_BITMAP_UPDATE
@ ID_BITMAP_UPDATE
Definition: SimulateDialog.hh:117
SimulateDialog::onOK
void onOK(wxCommandEvent &event)
Definition: SimulateDialog.cc:471
SimulateDialog::onLateResult
void onLateResult(wxCommandEvent &event)
SimulateDialog::FORMAT_DOUBLE
static const std::string FORMAT_DOUBLE
Double format.
Definition: SimulateDialog.hh:98
SimulateDialog::ID_FORMAT
@ ID_FORMAT
Definition: SimulateDialog.hh:126
SimulateDialog::createBitmap
wxBitmap createBitmap(unsigned int index)
Definition: SimulateDialog.cc:693
SimulateDialog::formattedValue
std::string formattedValue(SimValue *value)
Definition: SimulateDialog.cc:532
OperationContext.hh
SimulateDialog::ID_BUTTON_LATE_RESULT
@ ID_BUTTON_LATE_RESULT
Definition: SimulateDialog.hh:122
SimulateDialog::onReset
void onReset(wxCommandEvent &event)
Definition: SimulateDialog.cc:336
SimulateDialog::format_
wxChoice * format_
Choice list of possible output formats.
Definition: SimulateDialog.hh:140