OpenASIP 2.2
Loading...
Searching...
No Matches
SimulatorSettingsDialog.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 SimulatorSettingsDialog.cc
26 *
27 * Implementation of SimulatorSettingsDialog class.
28 *
29 * @author Veli-Pekka Jääskeläinen 2005 (vjaaskel-no.spam-cs.tut.fi)
30 * @note rating: red
31 */
32
33#include <wx/spinctrl.h>
34#include <wx/statline.h>
35#include <wx/valgen.h>
37#include "ProximLineReader.hh"
38#include "WxConversion.hh"
39#include "SimulatorFrontend.hh"
40#include "ProximConstants.hh"
41#include "Conversion.hh"
42
43BEGIN_EVENT_TABLE(SimulatorSettingsDialog, wxDialog)
46
47/**
48 * The Constructor.
49 *
50 * @param parent Parent window of the dialog.
51 * @param id Dialog window identifier.
52 * @param simulator Simulator frontend to configure.
53 */
55 wxWindow* parent, wxWindowID id, SimulatorFrontend& simulator,
56 ProximLineReader& lineReader) :
57 wxDialog(parent, id, _T("Simulator Settings"), wxDefaultPosition),
58 simulator_(simulator), lineReader_(lineReader) {
59
60 createContents(this, true, true);
61
62 FindWindow(ID_EXEC_TRACE)->SetValidator(wxGenericValidator(&execTrace_));
63 FindWindow(ID_BUS_TRACE)->SetValidator(wxGenericValidator(&busTrace_));
64 FindWindow(ID_PT_TRACKING)->SetValidator(wxGenericValidator(&ptTrace_));
65 FindWindow(ID_RF_TRACKING)->SetValidator(wxGenericValidator(&rfTrace_));
66 FindWindow(ID_FU_CONFLICT_DETECTION)->SetValidator(
67 wxGenericValidator(&fuConflictDetection_));
68
69 FindWindow(ID_PROFILE_DATA_SAVING)->SetValidator(
70 wxGenericValidator(&profileDataSaving_));
71 FindWindow(ID_UTILIZATION_DATA_SAVING)->SetValidator(
72 wxGenericValidator(&utilizationDataSaving_));
73 FindWindow(ID_NEXT_INSTRUCTION_PRINTING)->SetValidator(
74 wxGenericValidator(&nextInstructionPrinting_));
75 FindWindow(ID_SIMULATION_TIME_STATISTICS)->SetValidator(
76 wxGenericValidator(&simulationTimeStatistics_));
77
78 FindWindow(ID_SAVE_HISTORY)->SetValidator(
79 wxGenericValidator(&historySave_));
80
81 FindWindow(ID_HISTORY_FILE)->SetValidator(
82 wxGenericValidator(&historyFile_));
83
84 FindWindow(ID_HISTORY_SIZE)->SetValidator(
85 wxGenericValidator(&historySize_));
86}
87
88/**
89 * The Destructor.
90 */
93
94
95/**
96 * Transfers settings data from the simulator frontend to the dialog widgets.
97 */
98bool
120
121
122/**
123 * Updates the simulator settings and closes the dialog when the OK-button
124 * is pressed.
125 */
126void
128
129 TransferDataFromWindow();
130
131 std::string command;
132 std::string historyFile =
133 WxConversion::toString(historyFile_.Trim(false).Trim(true));
134
136 command += ProximConstants::SCL_SET + " ";
140 }
141
143 command += ProximConstants::SCL_SET + " ";
147 }
148
150 command += ProximConstants::SCL_SET + " ";
152 command += Conversion::toString(ptTrace_);
154 }
155
157 command += ProximConstants::SCL_SET + " ";
159 command += Conversion::toString(rfTrace_);
161 }
162
164 command += ProximConstants::SCL_SET + " ";
168 }
169
171 command += ProximConstants::SCL_SET + " ";
175 }
176
178 command += ProximConstants::SCL_SET + " ";
182
183 }
184
185 if (lineReader_.inputHistoryFilename() != historyFile) {
186 command += ProximConstants::SCL_SET + " ";
188 command += historyFile;
190 }
191
193 command += ProximConstants::SCL_SET + " ";
197 }
198
200 command += ProximConstants::SCL_SET + " ";
204 }
205
207 command += ProximConstants::SCL_SET + " ";
211 }
212
214 command += ProximConstants::SCL_SET + " ";
218 }
219
220 lineReader_.input(command);
221
222 EndModal(wxID_OK);
223}
224
225
226/**
227 * Creates the dialog widgets.
228 *
229 * Source code generated by wxDesigner. Do not modify by hand!
230 *
231 * @param parent Parent dialog of the widgets.
232 * @param call_fit If true, resize the dialog to fit the widgets.
233 * @param set_sizer If true, set the created widgets as the dialog contents.
234 * @return Top level sizer of the dialog contents.
235 */
236wxSizer*
238 wxWindow *parent, bool call_fit, bool set_sizer) {
239
240 wxBoxSizer *item0 = new wxBoxSizer( wxVERTICAL );
241
242 wxStaticBox *item2 = new wxStaticBox( parent, -1, wxT("Tracing:") );
243 wxStaticBoxSizer *item1 = new wxStaticBoxSizer( item2, wxVERTICAL );
244
245 wxCheckBox *item3 = new wxCheckBox( parent, ID_EXEC_TRACE, wxT("Write basic execution trace."), wxDefaultPosition, wxDefaultSize, 0 );
246 item1->Add( item3, 0, wxALL, 5 );
247
248 wxCheckBox *item4 = new wxCheckBox( parent, ID_BUS_TRACE, wxT("Write bus trace."), wxDefaultPosition, wxDefaultSize, 0 );
249 item1->Add( item4, 0, wxALL, 5 );
250
251 wxCheckBox *item19 = new wxCheckBox( parent, ID_PT_TRACKING, wxT("Procedure transfer tracking."), wxDefaultPosition, wxDefaultSize, 0 );
252 item1->Add( item19, 0, wxALL, 5 );
253
254 wxCheckBox *item5 = new wxCheckBox( parent, ID_RF_TRACKING, wxT("Concurrent register file access tracking."), wxDefaultPosition, wxDefaultSize, 0 );
255 item1->Add( item5, 0, wxALL, 5 );
256
257 wxCheckBox *item6 = new wxCheckBox( parent, ID_FU_CONFLICT_DETECTION, wxT("Function unit resouce conflict detection."), wxDefaultPosition, wxDefaultSize, 0 );
258 item1->Add( item6, 0, wxALL, 5 );
259
260 wxCheckBox *profiledata = new wxCheckBox( parent, ID_PROFILE_DATA_SAVING, wxT("Profile data saving."), wxDefaultPosition, wxDefaultSize, 0 );
261 item1->Add( profiledata, 0, wxALL, 5 );
262
263 wxCheckBox *utildata = new wxCheckBox( parent, ID_UTILIZATION_DATA_SAVING, wxT("Utilization data saving."), wxDefaultPosition, wxDefaultSize, 0 );
264 item1->Add( utildata, 0, wxALL, 5 );
265
266 wxCheckBox *nextinstr = new wxCheckBox( parent, ID_NEXT_INSTRUCTION_PRINTING, wxT("Next instruction printing."), wxDefaultPosition, wxDefaultSize, 0 );
267 item1->Add( nextinstr, 0, wxALL, 5 );
268
269 wxCheckBox *timestat = new wxCheckBox( parent, ID_SIMULATION_TIME_STATISTICS, wxT("Simulation time statistics."), wxDefaultPosition, wxDefaultSize, 0 );
270 item1->Add( timestat, 0, wxALL, 5 );
271
272 item0->Add( item1, 0, wxGROW|wxALL, 5 );
273
274 wxStaticBox *item8 = new wxStaticBox( parent, -1, wxT("Command history:") );
275 wxStaticBoxSizer *item7 = new wxStaticBoxSizer( item8, wxVERTICAL );
276
277 wxBoxSizer *item9 = new wxBoxSizer( wxHORIZONTAL );
278
279 wxStaticText *item10 = new wxStaticText( parent, ID_LABEL_HISTORY_SIZE, wxT("Maximum size of command history:"), wxDefaultPosition, wxDefaultSize, 0 );
280 item9->Add( item10, 0, wxALIGN_CENTER|wxALL, 5 );
281
282 wxSpinCtrl *item11 = new wxSpinCtrl( parent, ID_HISTORY_SIZE, wxT("0"), wxDefaultPosition, wxSize(-1,-1), 0, 0, 10000, 0 );
283 item9->Add( item11, 0, wxALIGN_CENTER|wxALL, 5 );
284
285 item7->Add( item9, 0, wxGROW|wxALL, 5 );
286
287 wxBoxSizer *item12 = new wxBoxSizer( wxVERTICAL );
288
289 wxCheckBox *item13 = new wxCheckBox( parent, ID_SAVE_HISTORY, wxT("Save command history to file:"), wxDefaultPosition, wxDefaultSize, 0 );
290 item12->Add( item13, 0, wxALL, 5 );
291
292 wxTextCtrl *item14 = new wxTextCtrl( parent, ID_HISTORY_FILE, wxT(""), wxDefaultPosition, wxSize(300,-1), 0 );
293 item12->Add( item14, 0, wxALIGN_CENTER|wxALL, 5 );
294
295 item7->Add( item12, 0, wxGROW|wxALL, 5 );
296
297 item0->Add( item7, 0, wxGROW|wxALL, 5 );
298
299 wxStaticLine *item15 = new wxStaticLine( parent, ID_LINE, wxDefaultPosition, wxSize(20,-1), wxLI_HORIZONTAL );
300 item0->Add( item15, 0, wxGROW|wxALL, 5 );
301
302 wxBoxSizer *item16 = new wxBoxSizer( wxHORIZONTAL );
303
304 wxButton *item17 = new wxButton( parent, wxID_CANCEL, wxT("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
305 item16->Add( item17, 0, wxALL, 5 );
306
307 wxButton *item18 = new wxButton( parent, wxID_OK, wxT("&OK"), wxDefaultPosition, wxDefaultSize, 0 );
308 item16->Add( item18, 0, wxALIGN_CENTER|wxALL, 5 );
309
310 item0->Add( item16, 0, 0, 5 );
311
312 if (set_sizer)
313 {
314 parent->SetSizer( item0 );
315 if (call_fit)
316 item0->SetSizeHints( parent );
317 }
318
319 return item0;
320}
END_EVENT_TABLE() using namespace IDF
EVT_BUTTON(ID_EDIT_ARCH_PORT, FUImplementationDialog::onEditArchitecturePort) EVT_BUTTON(ID_ADD_EXTERNAL_PORT
static std::string toString(const T &source)
virtual size_t inputHistoryMaxLength() const
virtual bool saveInputHistoryToFile() const
static const std::string SCL_SETTING_SIMULATION_TIME_STATISTICS
Name of the simulation time statistics setting.
static const std::string SCL_SETTING_FU_CONFLICT_DETECTION
Name of the fu conflict detection setting.
static const std::string SCL_SETTING_HISTORY_SIZE
Name of the input history size setting.
static const std::string SCL_SETTING_HISTORY_FILE
Name of the input history file name setting.
static const std::string SCL_SETTING_RF_TRACE
Name of the rf access trace setting.
static const std::string SCL_SETTING_EXEC_TRACE
Name of the execution trace setting.
static const std::string SCL_SETTING_UTILIZATION_DATA_SAVING
Name of the utilization data saving setting.
static const std::string SCL_SETTING_HISTORY_SAVE
Name of the input history saving setting,.
static const std::string SCL_SETTING_BUS_TRACE
Name of the bus trace setting.
static const std::string SCL_SETTING_NEXT_INSTRUCTION_PRINTING
Name of the fu next insturction printing setting.
static const std::string SCL_SET
Command for configuring simulator settings.
static const std::string SCL_DELIM
Command delimeter for the simulator commands.
static const std::string SCL_SETTING_PROCEDURE_TRANSFER_TRACE
Name of the procedure transfer trace setting.
static const std::string SCL_SETTING_PROFILE_DATA_SAVING
Name of the profile data saving setting.
void input(std::string command)
std::string inputHistoryFilename() const
bool simulationTimeStatistics() const
bool utilizationDataSaving() const
bool fuResourceConflictDetection() const
bool profileDataSaving() const
bool executionTracing() const
bool procedureTransferTracing() const
bool nextInstructionPrinting() const
SimulatorFrontend & simulator_
Frontend of the simulator to configure.
bool execTrace_
Execution trace enabled/disabled.
bool historySave_
Input history log file enabled/disabled.
bool rfTrace_
Register file access tracing enabled/disabled.
ProximLineReader & lineReader_
Line reader to configure.
bool nextInstructionPrinting_
Next instruction printing enabled/disabled.
wxString historyFile_
History log file name.
bool fuConflictDetection_
FU conflict detection enabled/disabled.
bool ptTrace_
Procedure transfer tracing enabled/disabled.
bool simulationTimeStatistics_
Profile data saving enabled/disabled.
wxSizer * createContents(wxWindow *parent, bool set_sizer, bool call_fit)
bool busTrace_
Bus trace enabled/disabled.
bool profileDataSaving_
Profile data saving enabled/disabled.
int historySize_
History log max size.
void onOK(wxCommandEvent &event)
bool utilizationDataSaving_
Utilization data saving enabled/disabled.
static wxString toWxString(const std::string &source)
static std::string toString(const wxString &source)