OpenASIP 2.2
Loading...
Searching...
No Matches
Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
AddWatchDialog Class Reference

#include <AddWatchDialog.hh>

Inheritance diagram for AddWatchDialog:
Inheritance graph
Collaboration diagram for AddWatchDialog:
Collaboration graph

Public Member Functions

 AddWatchDialog (wxWindow *parent, wxWindowID id, Watch *watch=NULL)
 
virtual ~AddWatchDialog ()
 

Private Types

enum  {
  ID_RB_MEMORY , ID_RB_PORT , ID_RB_REGISTER , ID_RB_EXPRESSION ,
  ID_RB_BUS , ID_LABEL_AS , ID_LABEL_UNIT , ID_LABEL_PORT ,
  ID_LABEL_RF , ID_LABEL_BUS , ID_LABEL_EXPRESSION , ID_LABEL_CONDITION ,
  ID_LABEL_START_ADDRESS , ID_LABEL_END_ADDRESS , ID_LABEL_INDEX , ID_START_ADDRESS ,
  ID_END_ADDRESS , ID_BUS_CHOICE , ID_RF_CHOICE , ID_FU_CHOICE ,
  ID_PORT_CHOICE , ID_INDEX_CHOICE , ID_EXPRESSION , ID_ADDRESS_SPACE ,
  ID_LINE
}
 Widget ids. More...
 

Private Member Functions

void onWatchTypeChange (wxCommandEvent &event)
 
void onFUChoice (wxCommandEvent &event)
 
void onRFChoice (wxCommandEvent &event)
 
void onASChoice (wxCommandEvent &event)
 
void initialize ()
 
void onOK (wxCommandEvent &event)
 
wxSizer * createContents (wxWindow *parent, bool call_fit, bool set_sizer)
 

Private Attributes

wxChoice * asChoice_
 Address space choicer for memory watch.
 
wxChoice * fuChoice_
 Function unit choicer for port watch.
 
wxChoice * portChoice_
 Port choicer for port watch.
 
wxChoice * rfChoice_
 Register file choicer for register watch.
 
wxChoice * indexChoice_
 Register index choicer for register watch.
 
wxChoice * busChoice_
 Bus choicer for bus watch.
 
wxSpinCtrl * endAddressCtrl_
 End adderss widget for memory watch.
 
wxSpinCtrl * startAddressCtrl_
 Start address widget for memory watch.
 

Detailed Description

Dialog for creating watch points.

Definition at line 43 of file AddWatchDialog.hh.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private

Widget ids.

Enumerator
ID_RB_MEMORY 
ID_RB_PORT 
ID_RB_REGISTER 
ID_RB_EXPRESSION 
ID_RB_BUS 
ID_LABEL_AS 
ID_LABEL_UNIT 
ID_LABEL_PORT 
ID_LABEL_RF 
ID_LABEL_BUS 
ID_LABEL_EXPRESSION 
ID_LABEL_CONDITION 
ID_LABEL_START_ADDRESS 
ID_LABEL_END_ADDRESS 
ID_LABEL_INDEX 
ID_START_ADDRESS 
ID_END_ADDRESS 
ID_BUS_CHOICE 
ID_RF_CHOICE 
ID_FU_CHOICE 
ID_PORT_CHOICE 
ID_INDEX_CHOICE 
ID_EXPRESSION 
ID_ADDRESS_SPACE 
ID_LINE 

Definition at line 57 of file AddWatchDialog.hh.

57 {
63
74
85 };

Constructor & Destructor Documentation

◆ AddWatchDialog()

AddWatchDialog::AddWatchDialog ( wxWindow *  parent,
wxWindowID  id,
Watch watch = NULL 
)

The Constructor.

Parameters
parentParent window of the dialog.
idDialog identifier.
watchWatch point to edit, or NULL to create a new watch point.

Definition at line 79 of file AddWatchDialog.cc.

80 :
81 wxDialog(parent, id, _T("Watch point"), wxDefaultPosition) {
82
83 createContents(this, true, true);
84
85 // Initialize widget pointers.
86 asChoice_ = dynamic_cast<wxChoice*>(FindWindow(ID_ADDRESS_SPACE));
87 rfChoice_ = dynamic_cast<wxChoice*>(FindWindow(ID_RF_CHOICE));
88 indexChoice_ = dynamic_cast<wxChoice*>(FindWindow(ID_INDEX_CHOICE));
89 fuChoice_ = dynamic_cast<wxChoice*>(FindWindow(ID_FU_CHOICE));
90 portChoice_ = dynamic_cast<wxChoice*>(FindWindow(ID_PORT_CHOICE));
91 busChoice_ = dynamic_cast<wxChoice*>(FindWindow(ID_BUS_CHOICE));
92
93 endAddressCtrl_ = dynamic_cast<wxSpinCtrl*>(FindWindow(ID_END_ADDRESS));
95 dynamic_cast<wxSpinCtrl*>(FindWindow(ID_START_ADDRESS));
96
97 initialize();
98}
wxSpinCtrl * endAddressCtrl_
End adderss widget for memory watch.
wxChoice * fuChoice_
Function unit choicer for port watch.
wxChoice * asChoice_
Address space choicer for memory watch.
wxChoice * portChoice_
Port choicer for port watch.
wxSizer * createContents(wxWindow *parent, bool call_fit, bool set_sizer)
wxSpinCtrl * startAddressCtrl_
Start address widget for memory watch.
wxChoice * rfChoice_
Register file choicer for register watch.
wxChoice * indexChoice_
Register index choicer for register watch.
wxChoice * busChoice_
Bus choicer for bus watch.

◆ ~AddWatchDialog()

AddWatchDialog::~AddWatchDialog ( )
virtual

The Destructor.

Definition at line 104 of file AddWatchDialog.cc.

104 {
105}

Member Function Documentation

◆ createContents()

wxSizer * AddWatchDialog::createContents ( wxWindow *  parent,
bool  call_fit,
bool  set_sizer 
)
private

Creates the dialog widgets.

Code generated by wxDesigner. Do not modify manually.

Parameters
parentParent window for the dialog widgets.
call_fitIf true, the dialog is resized to fit the widgets.
set_sizerIf true, the created widgets are set as the dialog contents.

Definition at line 415 of file AddWatchDialog.cc.

415 {
416
417 wxBoxSizer *item0 = new wxBoxSizer( wxVERTICAL );
418
419 wxBoxSizer *item1 = new wxBoxSizer( wxVERTICAL );
420
421 wxBoxSizer *item2 = new wxBoxSizer( wxHORIZONTAL );
422
423 wxRadioButton *item3 = new wxRadioButton( parent, ID_RB_PORT, wxT("Port watch"), wxDefaultPosition, wxDefaultSize, 0 );
424 item2->Add( item3, 0, wxALL, 5 );
425
426 wxBoxSizer *item4 = new wxBoxSizer( wxHORIZONTAL );
427
428 item4->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 );
429
430 wxStaticText *item5 = new wxStaticText( parent, ID_LABEL_UNIT, wxT("Unit:"), wxDefaultPosition, wxDefaultSize, 0 );
431 item4->Add( item5, 0, wxALIGN_CENTER|wxALL, 5 );
432
433 wxString *strs6 = (wxString*) NULL;
434 wxChoice *item6 = new wxChoice( parent, ID_FU_CHOICE, wxDefaultPosition, wxSize(100,-1), 0, strs6, 0 );
435 item4->Add( item6, 0, wxALIGN_CENTER|wxALL, 5 );
436
437 wxStaticText *item7 = new wxStaticText( parent, ID_LABEL_PORT, wxT("Port:"), wxDefaultPosition, wxDefaultSize, 0 );
438 item4->Add( item7, 0, wxALIGN_CENTER|wxALL, 5 );
439
440 wxString *strs8 = (wxString*) NULL;
441 wxChoice *item8 = new wxChoice( parent, ID_PORT_CHOICE, wxDefaultPosition, wxSize(100,-1), 0, strs8, 0 );
442 item4->Add( item8, 0, wxALIGN_CENTER|wxALL, 5 );
443
444 item2->Add( item4, 0, wxALIGN_CENTER|wxALL, 5 );
445
446 item1->Add( item2, 0, wxALL, 5 );
447
448 wxBoxSizer *item9 = new wxBoxSizer( wxHORIZONTAL );
449
450 wxRadioButton *item10 = new wxRadioButton( parent, ID_RB_REGISTER, wxT("Register watch"), wxDefaultPosition, wxDefaultSize, 0 );
451 item9->Add( item10, 0, wxALL, 5 );
452
453 wxBoxSizer *item11 = new wxBoxSizer( wxHORIZONTAL );
454
455 item11->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 );
456
457 wxStaticText *item12 = new wxStaticText( parent, ID_LABEL_RF, wxT("Register file:"), wxDefaultPosition, wxDefaultSize, 0 );
458 item11->Add( item12, 0, wxALIGN_CENTER|wxALL, 5 );
459
460 wxString *strs13 = (wxString*) NULL;
461 wxChoice *item13 = new wxChoice( parent, ID_RF_CHOICE, wxDefaultPosition, wxSize(100,-1), 0, strs13, 0 );
462 item11->Add( item13, 0, wxALIGN_CENTER|wxALL, 5 );
463
464 wxStaticText *item14 = new wxStaticText( parent, ID_LABEL_INDEX, wxT("Index:"), wxDefaultPosition, wxDefaultSize, 0 );
465 item11->Add( item14, 0, wxALIGN_CENTER|wxALL, 5 );
466
467 wxString *strs15 = (wxString*) NULL;
468 wxChoice *item15 = new wxChoice( parent, ID_INDEX_CHOICE, wxDefaultPosition, wxSize(100,-1), 0, strs15, 0 );
469 item11->Add( item15, 0, wxALIGN_CENTER|wxALL, 5 );
470
471 item9->Add( item11, 0, wxALIGN_CENTER|wxALL, 5 );
472
473 item1->Add( item9, 0, wxALL, 5 );
474
475 wxBoxSizer *item16 = new wxBoxSizer( wxHORIZONTAL );
476
477 wxRadioButton *item17 = new wxRadioButton( parent, ID_RB_BUS, wxT("Bus watch"), wxDefaultPosition, wxDefaultSize, 0 );
478 item16->Add( item17, 0, wxALL, 5 );
479
480 wxBoxSizer *item18 = new wxBoxSizer( wxHORIZONTAL );
481
482 item18->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 );
483
484 wxStaticText *item19 = new wxStaticText( parent, ID_LABEL_BUS, wxT("Bus:"), wxDefaultPosition, wxDefaultSize, 0 );
485 item18->Add( item19, 0, wxALIGN_CENTER|wxALL, 5 );
486
487 wxString *strs20 = (wxString*) NULL;
488 wxChoice *item20 = new wxChoice( parent, ID_BUS_CHOICE, wxDefaultPosition, wxSize(100,-1), 0, strs20, 0 );
489 item18->Add( item20, 0, wxALIGN_CENTER|wxALL, 5 );
490
491 item16->Add( item18, 0, wxALIGN_CENTER|wxALL, 5 );
492
493 item1->Add( item16, 0, wxALL, 5 );
494
495 wxBoxSizer *item21 = new wxBoxSizer( wxVERTICAL );
496
497 wxRadioButton *item22 = new wxRadioButton( parent, ID_RB_MEMORY, wxT("Memory watch"), wxDefaultPosition, wxDefaultSize, 0 );
498 item21->Add( item22, 0, wxALL, 5 );
499
500 wxBoxSizer *item23 = new wxBoxSizer( wxHORIZONTAL );
501
502 item23->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 );
503
504 wxStaticText *item24 = new wxStaticText( parent, ID_LABEL_AS, wxT("Address space:"), wxDefaultPosition, wxDefaultSize, 0 );
505 item23->Add( item24, 0, wxALIGN_CENTER|wxALL, 5 );
506
507 wxString *strs25 = (wxString*) NULL;
508 wxChoice *item25 = new wxChoice( parent, ID_ADDRESS_SPACE, wxDefaultPosition, wxSize(100,-1), 0, strs25, 0 );
509 item23->Add( item25, 0, wxALIGN_CENTER|wxALL, 5 );
510
511 wxStaticText *item26 = new wxStaticText( parent, ID_LABEL_START_ADDRESS, wxT("Start address:"), wxDefaultPosition, wxDefaultSize, 0 );
512 item23->Add( item26, 0, wxALIGN_CENTER|wxALL, 5 );
513
514 wxSpinCtrl *item27 = new wxSpinCtrl( parent, ID_START_ADDRESS, wxT("0"), wxDefaultPosition, wxSize(-1,-1), 0, 0, 100, 0 );
515 item23->Add( item27, 0, wxALIGN_CENTER|wxALL, 5 );
516
517 wxStaticText *item28 = new wxStaticText( parent, ID_LABEL_END_ADDRESS, wxT("End address:"), wxDefaultPosition, wxDefaultSize, 0 );
518 item23->Add( item28, 0, wxALIGN_CENTER|wxALL, 5 );
519
520 wxSpinCtrl *item29 = new wxSpinCtrl( parent, ID_END_ADDRESS, wxT("0"), wxDefaultPosition, wxSize(-1,-1), 0, 0, 100, 0 );
521 item23->Add( item29, 0, wxALIGN_CENTER|wxALL, 5 );
522
523 item21->Add( item23, 0, wxALIGN_CENTER|wxALL, 5 );
524
525 item1->Add( item21, 0, wxALL, 5 );
526
527 wxBoxSizer *item30 = new wxBoxSizer( wxHORIZONTAL );
528
529 wxRadioButton *item31 = new wxRadioButton( parent, ID_RB_EXPRESSION, wxT("Experession:"), wxDefaultPosition, wxDefaultSize, 0 );
530 item30->Add( item31, 0, wxALL, 5 );
531
532 wxTextCtrl *item32 = new wxTextCtrl( parent, ID_EXPRESSION, wxT(""), wxDefaultPosition, wxSize(500,-1), 0 );
533 item30->Add( item32, 0, wxALIGN_CENTER|wxALL, 5 );
534
535 item1->Add( item30, 0, wxGROW|wxALL, 5 );
536
537 item0->Add( item1, 0, wxGROW|wxALL, 5 );
538
539 wxBoxSizer *item33 = new wxBoxSizer( wxVERTICAL );
540
541 wxStaticLine *item34 = new wxStaticLine( parent, ID_LINE, wxDefaultPosition, wxSize(20,-1), wxLI_HORIZONTAL );
542 item33->Add( item34, 0, wxGROW|wxALL, 5 );
543
544 wxBoxSizer *item35 = new wxBoxSizer( wxHORIZONTAL );
545
546 wxButton *item36 = new wxButton( parent, wxID_OK, wxT("&OK"), wxDefaultPosition, wxDefaultSize, 0 );
547 item35->Add( item36, 0, wxALIGN_CENTER|wxALL, 5 );
548
549 wxButton *item37 = new wxButton( parent, wxID_CANCEL, wxT("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
550 item35->Add( item37, 0, wxALIGN_CENTER|wxALL, 5 );
551
552 item33->Add( item35, 0, wxALL, 5 );
553
554 item0->Add( item33, 0, wxGROW|wxALL, 5 );
555
556 if (set_sizer)
557 {
558 parent->SetSizer( item0 );
559 if (call_fit)
560 item0->SetSizeHints( parent );
561 }
562
563 return item0;
564}

References ID_ADDRESS_SPACE, ID_BUS_CHOICE, ID_END_ADDRESS, ID_EXPRESSION, ID_FU_CHOICE, ID_INDEX_CHOICE, ID_LABEL_AS, ID_LABEL_BUS, ID_LABEL_END_ADDRESS, ID_LABEL_INDEX, ID_LABEL_PORT, ID_LABEL_RF, ID_LABEL_START_ADDRESS, ID_LABEL_UNIT, ID_LINE, ID_PORT_CHOICE, ID_RB_BUS, ID_RB_EXPRESSION, ID_RB_MEMORY, ID_RB_PORT, ID_RB_REGISTER, ID_RF_CHOICE, and ID_START_ADDRESS.

◆ initialize()

void AddWatchDialog::initialize ( )
private

Initializes the dialog choicer items.

Definition at line 111 of file AddWatchDialog.cc.

111 {
112
114
115 // Address space choicer.
116 const Machine::AddressSpaceNavigator asNavigator =
118 for (int i = 0; i < asNavigator.count(); i++) {
119 string asName = asNavigator.item(i)->name();
120 asChoice_->Append(WxConversion::toWxString(asName));
121 }
122
123 // Register file choicer.
124 const Machine::RegisterFileNavigator rfNavigator =
126 for (int i = 0; i < rfNavigator.count(); i++) {
127 string rfName = rfNavigator.item(i)->name();
128 rfChoice_->Append(WxConversion::toWxString(rfName));
129 }
130
131 // Function unit choicer.
132 const Machine::FunctionUnitNavigator fuNavigator =
134 for (int i = 0; i < fuNavigator.count(); i++) {
135 string fuName = fuNavigator.item(i)->name();
136 fuChoice_->Append(WxConversion::toWxString(fuName));
137 }
138
139 // Bus choicer.
140 const Machine::BusNavigator busNavigator = machine.busNavigator();
141 for (int i = 0; i < busNavigator.count(); i++) {
142 string busName = busNavigator.item(i)->name();
143 busChoice_->Append(WxConversion::toWxString(busName));
144 }
145
146 wxCommandEvent dummy;
147 dummy.SetId(ID_RB_PORT);
149}
TTAMachine::Machine * machine
the architecture definition of the estimated processor
SimValue dummy(32)
a dummy simvalue which is given for operands that are not bound
void onWatchTypeChange(wxCommandEvent &event)
static const TTAMachine::Machine & machine()
ComponentType * item(int index) const
virtual RegisterFileNavigator registerFileNavigator() const
Definition Machine.cc:450
virtual FunctionUnitNavigator functionUnitNavigator() const
Definition Machine.cc:380
virtual BusNavigator busNavigator() const
Definition Machine.cc:356
virtual AddressSpaceNavigator addressSpaceNavigator() const
Definition Machine.cc:392
static wxString toWxString(const std::string &source)

References TTAMachine::Machine::addressSpaceNavigator(), asChoice_, busChoice_, TTAMachine::Machine::busNavigator(), TTAMachine::Machine::Navigator< ComponentType >::count(), dummy, fuChoice_, TTAMachine::Machine::functionUnitNavigator(), ID_RB_PORT, TTAMachine::Machine::Navigator< ComponentType >::item(), machine, ProximToolbox::machine(), onWatchTypeChange(), TTAMachine::Machine::registerFileNavigator(), rfChoice_, and WxConversion::toWxString().

Here is the call graph for this function:

◆ onASChoice()

void AddWatchDialog::onASChoice ( wxCommandEvent &  event)
private

Event handler for the address space choicer.

Sets the minimum and maximum start/end address values of the memory watch spin-buttons when the address space selection is changed.

Definition at line 268 of file AddWatchDialog.cc.

268 {
269
270 string asName =
271 WxConversion::toString(asChoice_->GetStringSelection());
272
273 const Machine::AddressSpaceNavigator asNavigator =
275
276 AddressSpace* as = asNavigator.item(asName);
277
278 assert(as != NULL);
279
280 startAddressCtrl_->SetRange(as->start(), as->end());
281 endAddressCtrl_->SetRange(as->start(), as->end());
282
283 startAddressCtrl_->SetValue(as->start());
284 endAddressCtrl_->SetValue(as->end());
285}
#define assert(condition)
virtual ULongWord end() const
virtual ULongWord start() const
static std::string toString(const wxString &source)

References TTAMachine::Machine::addressSpaceNavigator(), asChoice_, assert, TTAMachine::AddressSpace::end(), endAddressCtrl_, TTAMachine::Machine::Navigator< ComponentType >::item(), ProximToolbox::machine(), TTAMachine::AddressSpace::start(), startAddressCtrl_, and WxConversion::toString().

Here is the call graph for this function:

◆ onFUChoice()

void AddWatchDialog::onFUChoice ( wxCommandEvent &  event)
private

Sets the function unit port choicer items when the function unit selection changes.

Definition at line 213 of file AddWatchDialog.cc.

213 {
214
215 string fuName =
216 WxConversion::toString(fuChoice_->GetStringSelection());
217
218 const Machine::FunctionUnitNavigator fuNavigator =
220
221 FunctionUnit* fu = fuNavigator.item(fuName);
222
223 assert(fu != NULL);
224
225 // Set the port choicer to contain an item for each of the selected
226 // function unit's ports.
227 portChoice_->Clear();
228 for (int i = 0; i < fu->portCount(); i++) {
229 string portName = fu->port(i)->name();
230 portChoice_->Append(WxConversion::toWxString(portName));
231 }
232 portChoice_->SetSelection(0);
233}
virtual BaseFUPort * port(const std::string &name) const
virtual std::string name() const
Definition Port.cc:141
virtual int portCount() const
Definition Unit.cc:135

References assert, fuChoice_, TTAMachine::Machine::functionUnitNavigator(), TTAMachine::Machine::Navigator< ComponentType >::item(), ProximToolbox::machine(), TTAMachine::Port::name(), TTAMachine::FunctionUnit::port(), portChoice_, TTAMachine::Unit::portCount(), WxConversion::toString(), and WxConversion::toWxString().

Here is the call graph for this function:

◆ onOK()

void AddWatchDialog::onOK ( wxCommandEvent &  event)
private

Event handler for the dialog OK-button.

Definition at line 291 of file AddWatchDialog.cc.

291 {
292 string expression;
293
294
295 // Memory watch.
296 if (dynamic_cast<wxRadioButton*>(FindWindow(ID_RB_MEMORY))->GetValue()) {
297
298 string asName =
299 WxConversion::toString(asChoice_->GetStringSelection());
300
301 unsigned start = startAddressCtrl_->GetValue();
302 unsigned end = endAddressCtrl_->GetValue();
303 int count = end - start + 1;
304
305 string startStr = Conversion::toString(start);
306 string countStr = Conversion::toString(count);
307
308 if (asName == "") {
309 wxString message = _T("Invalid address space.");
310 ErrorDialog error(this, message);
311 error.ShowModal();
312 return;
313 }
314 if (count < 1) {
315 wxString message = _T("The memory watch end address must be\n");
316 message.Append(_T("greater than the start address."));
317 ErrorDialog error(this, message);
318 error.ShowModal();
319 return;
320 }
321
322 expression = "x " " /a " + asName + " /n " + countStr + " " + startStr;
323 }
324
325 // Port Watch.
326 if (dynamic_cast<wxRadioButton*>(FindWindow(ID_RB_PORT))->GetValue()) {
327
328 string fuName =
329 WxConversion::toString(fuChoice_->GetStringSelection());
330 string portName =
331 WxConversion::toString(portChoice_->GetStringSelection());
332 if (fuName == "" || portName == "") {
333 wxString message = _T("Invalid port.");
334 ErrorDialog error(this, message);
335 error.ShowModal();
336 return;
337 }
338 expression = "info ports " + fuName + " " + portName;
339 }
340
341 // Register watch.
342 if (dynamic_cast<wxRadioButton*>(FindWindow(ID_RB_REGISTER))->GetValue()) {
343
344 string rfName =
345 WxConversion::toString(rfChoice_->GetStringSelection());
346 string index = Conversion::toString(indexChoice_->GetSelection());
347
348 if (rfName == "") {
349 wxString message = _T("Invalid register.");
350 ErrorDialog error(this, message);
351 error.ShowModal();
352 return;
353 }
354 expression = "info registers " + rfName + " " + index;
355 }
356
357 // Bus watch.
358 if (dynamic_cast<wxRadioButton*>(FindWindow(ID_RB_BUS))->GetValue()) {
359
360 string busName =
361 WxConversion::toString(busChoice_->GetStringSelection());
362
363 if (busName == "") {
364 wxString message = _T("Invalid bus.");
365 ErrorDialog error(this, message);
366 error.ShowModal();
367 return;
368 }
369 expression = "info segments " + busName;
370 }
371
372 // User defined expression watch.
373 bool expressionWatch =
374 dynamic_cast<wxRadioButton*>(FindWindow(ID_RB_EXPRESSION))->GetValue();
375 if (expressionWatch) {
376 wxTextCtrl* expressionCtrl =
377 dynamic_cast<wxTextCtrl*>(FindWindow(ID_EXPRESSION));
378
379 expression = WxConversion::toString(
380 expressionCtrl->GetValue().Trim(true).Trim(false));
381 }
382
383 if (expression == "") {
384 wxString message = _T("No expression defined for the watch");
385 ErrorDialog error(this, message);
386 error.ShowModal();
387 return;
388 }
389
390 // Test expression script.
391 if (!ProximToolbox::testExpression(this, expression)) {
392 // Invalid expression, error dialog is displayed by the toolbox.
393 return;
394 }
395
398 lineReader.input(expression);
399
400 EndModal(wxID_OK);
401}
static std::string toString(const T &source)
static const std::string SCL_ADD_WATCH
Command for adding watches in the simulator control language.
void input(std::string command)
static bool testExpression(wxWindow *parent, const std::string &expression)
static ProximLineReader & lineReader()

References asChoice_, busChoice_, endAddressCtrl_, fuChoice_, ID_EXPRESSION, ID_RB_BUS, ID_RB_EXPRESSION, ID_RB_MEMORY, ID_RB_PORT, ID_RB_REGISTER, indexChoice_, ProximLineReader::input(), ProximToolbox::lineReader(), portChoice_, rfChoice_, ProximConstants::SCL_ADD_WATCH, startAddressCtrl_, ProximToolbox::testExpression(), Conversion::toString(), and WxConversion::toString().

Here is the call graph for this function:

◆ onRFChoice()

void AddWatchDialog::onRFChoice ( wxCommandEvent &  event)
private

Sets the register index choicer items when the register file selection changes.

Definition at line 240 of file AddWatchDialog.cc.

240 {
241
242 string rfName =
243 WxConversion::toString(rfChoice_->GetStringSelection());
244
245 const Machine::RegisterFileNavigator rfNavigator =
247
248 RegisterFile* rf = rfNavigator.item(rfName);
249
250 assert(rf != NULL);
251
252 // Set the index choicer to contain an item for each of the selected
253 // register file's indexes.
254 indexChoice_->Clear();
255 for (int i = 0; i < rf->numberOfRegisters(); i++) {
257 }
258 indexChoice_->SetSelection(0);
259}
virtual int numberOfRegisters() const

References assert, indexChoice_, TTAMachine::Machine::Navigator< ComponentType >::item(), ProximToolbox::machine(), TTAMachine::BaseRegisterFile::numberOfRegisters(), TTAMachine::Machine::registerFileNavigator(), rfChoice_, WxConversion::toString(), and WxConversion::toWxString().

Here is the call graph for this function:

◆ onWatchTypeChange()

void AddWatchDialog::onWatchTypeChange ( wxCommandEvent &  event)
private

Disables and enables dialog widgets when the watch type selection changes.

Parameters
eventRadio-button event of the watch type changing.

Definition at line 157 of file AddWatchDialog.cc.

157 {
158
159 // Disable all watch type specific widgets.
160 FindWindow(ID_LABEL_AS)->Disable();
161 FindWindow(ID_LABEL_UNIT)->Disable();
162 FindWindow(ID_LABEL_PORT)->Disable();
163 FindWindow(ID_LABEL_RF)->Disable();
164 FindWindow(ID_LABEL_BUS)->Disable();
167 FindWindow(ID_LABEL_INDEX)->Disable();
168 FindWindow(ID_START_ADDRESS)->Disable();
169 FindWindow(ID_END_ADDRESS)->Disable();
170 FindWindow(ID_BUS_CHOICE)->Disable();
171 FindWindow(ID_RF_CHOICE)->Disable();
172 FindWindow(ID_FU_CHOICE)->Disable();
173 FindWindow(ID_PORT_CHOICE)->Disable();
174 FindWindow(ID_INDEX_CHOICE)->Disable();
175 FindWindow(ID_EXPRESSION)->Disable();
176 FindWindow(ID_ADDRESS_SPACE)->Disable();
177
178 // Enable widgets associated to the selected watch type.
179
180 if (event.GetId() == ID_RB_MEMORY) {
181 FindWindow(ID_LABEL_AS)->Enable();
184 FindWindow(ID_START_ADDRESS)->Enable();
185 FindWindow(ID_END_ADDRESS)->Enable();
186 }
187 if (event.GetId() == ID_RB_PORT) {
188 FindWindow(ID_LABEL_UNIT)->Enable();
189 FindWindow(ID_LABEL_PORT)->Enable();
190 FindWindow(ID_FU_CHOICE)->Enable();
191 FindWindow(ID_PORT_CHOICE)->Enable();
192 }
193 if (event.GetId() == ID_RB_REGISTER) {
194 FindWindow(ID_LABEL_RF)->Enable();
195 FindWindow(ID_LABEL_INDEX)->Enable();
196 FindWindow(ID_RF_CHOICE)->Enable();
197 FindWindow(ID_INDEX_CHOICE)->Enable();
198 }
199 if (event.GetId() == ID_RB_BUS) {
200 FindWindow(ID_LABEL_BUS)->Enable();
201 FindWindow(ID_BUS_CHOICE)->Enable();
202 }
203 if (event.GetId() == ID_RB_EXPRESSION) {
204 FindWindow(ID_EXPRESSION)->Enable();
205 }
206}

References ID_ADDRESS_SPACE, ID_BUS_CHOICE, ID_END_ADDRESS, ID_EXPRESSION, ID_FU_CHOICE, ID_INDEX_CHOICE, ID_LABEL_AS, ID_LABEL_BUS, ID_LABEL_END_ADDRESS, ID_LABEL_INDEX, ID_LABEL_PORT, ID_LABEL_RF, ID_LABEL_START_ADDRESS, ID_LABEL_UNIT, ID_PORT_CHOICE, ID_RB_BUS, ID_RB_EXPRESSION, ID_RB_MEMORY, ID_RB_PORT, ID_RB_REGISTER, ID_RF_CHOICE, and ID_START_ADDRESS.

Referenced by initialize().

Member Data Documentation

◆ asChoice_

wxChoice* AddWatchDialog::asChoice_
private

Address space choicer for memory watch.

Definition at line 88 of file AddWatchDialog.hh.

Referenced by initialize(), onASChoice(), and onOK().

◆ busChoice_

wxChoice* AddWatchDialog::busChoice_
private

Bus choicer for bus watch.

Definition at line 98 of file AddWatchDialog.hh.

Referenced by initialize(), and onOK().

◆ endAddressCtrl_

wxSpinCtrl* AddWatchDialog::endAddressCtrl_
private

End adderss widget for memory watch.

Definition at line 101 of file AddWatchDialog.hh.

Referenced by onASChoice(), and onOK().

◆ fuChoice_

wxChoice* AddWatchDialog::fuChoice_
private

Function unit choicer for port watch.

Definition at line 90 of file AddWatchDialog.hh.

Referenced by initialize(), onFUChoice(), and onOK().

◆ indexChoice_

wxChoice* AddWatchDialog::indexChoice_
private

Register index choicer for register watch.

Definition at line 96 of file AddWatchDialog.hh.

Referenced by onOK(), and onRFChoice().

◆ portChoice_

wxChoice* AddWatchDialog::portChoice_
private

Port choicer for port watch.

Definition at line 92 of file AddWatchDialog.hh.

Referenced by onFUChoice(), and onOK().

◆ rfChoice_

wxChoice* AddWatchDialog::rfChoice_
private

Register file choicer for register watch.

Definition at line 94 of file AddWatchDialog.hh.

Referenced by initialize(), onOK(), and onRFChoice().

◆ startAddressCtrl_

wxSpinCtrl* AddWatchDialog::startAddressCtrl_
private

Start address widget for memory watch.

Definition at line 103 of file AddWatchDialog.hh.

Referenced by onASChoice(), and onOK().


The documentation for this class was generated from the following files: