OpenASIP 2.2
Loading...
Searching...
No Matches
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
45class Operation;
46class DataObject;
47class NumberControl;
49
50/**
51 * Class for simulating operation behavior.
52 */
53class SimulateDialog : public wxDialog {
54public:
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
68private:
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 {
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
void onSelection(wxListEvent &event)
static const std::string FORMAT_SIGNED_INT
Signed int format.
void onFormatChanged(wxCommandEvent &event)
void onLateResult(wxCommandEvent &event)
std::string pathName_
Path in which operation module belongs to.
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)
SimulateDialog & operator=(const SimulateDialog &)
Assignment not allowed.
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.
std::string modName_
Module in which operation belongs to.
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.
SimulateDialog(const SimulateDialog &)
Copying not allowed.
NumberControl * updateValue_
Text control for updating input values.
void onOK(wxCommandEvent &event)
void onClose(wxCloseEvent &)
static const wxString DIALOG_NAME
Name of the dialog so it can be found with wxWindow::FindWindowByName.
void onAdvanceClock(wxCommandEvent &event)
wxListCtrl * outputList_
Output list.
void onUpdateValue(wxCommandEvent &event)
static const std::string FORMAT_FLOAT
Float format.