OpenASIP  2.0
Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
RFDialog Class Reference

#include <RFDialog.hh>

Inheritance diagram for RFDialog:
Inheritance graph
Collaboration diagram for RFDialog:
Collaboration graph

Public Member Functions

 RFDialog (wxWindow *parent, TTAMachine::RegisterFile *registerFile)
 
virtual ~RFDialog ()
 

Private Types

enum  {
  ID_NAME = 10000, ID_TYPE, ID_SIZE, ID_WIDTH,
  ID_MAX_READS, ID_MAX_WRITES, ID_GUARD_LATENCY, ID_PORT_LIST,
  ID_ADD_PORT, ID_EDIT_PORT, ID_DELETE_PORT, ID_HELP,
  ID_LABEL_NAME, ID_LABEL_SIZE, ID_LABEL_WIDTH, ID_LABEL_TYPE,
  ID_LABEL_MAX_READS, ID_LABEL_MAX_WRITES, ID_LABEL_GUARD_LATENCY, ID_ZERO_REGISTER
}
 enumerated IDs for the dialog controls More...
 

Private Member Functions

wxSizer * createContents (wxWindow *parent, bool call_fit, bool set_sizer)
 
virtual bool TransferDataToWindow ()
 
TTAMachine::PortselectedPort () const
 
void onOK (wxCommandEvent &event)
 
void onHelp (wxCommandEvent &event)
 
void onName (wxCommandEvent &event)
 
void onPortSelection (wxListEvent &event)
 
void onPortRightClick (wxListEvent &event)
 
void onAddPort (wxCommandEvent &event)
 
void onActivatePort (wxListEvent &event)
 
void onEditPort (wxCommandEvent &event)
 
void onDeletePort (wxCommandEvent &event)
 
void updateWidgets ()
 
void updatePortList ()
 
void setTexts ()
 

Private Attributes

wxStaticBoxSizer * portsSizer_
 Sizer containing the port list and associated buttons. More...
 
TTAMachine::RegisterFileregisterFile_
 Register file to modify. More...
 
wxString name_
 Name of the register file. More...
 
int size_
 Number of registers. More...
 
int width_
 Width. More...
 
int maxReads_
 Max reads. More...
 
int maxWrites_
 Maximum writes. More...
 
int guardLatency_
 Guard latency. More...
 
bool zeroRegister_
 Zero register. More...
 
wxListCtrl * portListCtrl_
 Port list control. More...
 
wxChoice * typeChoice_
 Opcode choice control. More...
 

Detailed Description

Dialog for editing register file parameters.

Definition at line 47 of file RFDialog.hh.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private

enumerated IDs for the dialog controls

Enumerator
ID_NAME 
ID_TYPE 
ID_SIZE 
ID_WIDTH 
ID_MAX_READS 
ID_MAX_WRITES 
ID_GUARD_LATENCY 
ID_PORT_LIST 
ID_ADD_PORT 
ID_EDIT_PORT 
ID_DELETE_PORT 
ID_HELP 
ID_LABEL_NAME 
ID_LABEL_SIZE 
ID_LABEL_WIDTH 
ID_LABEL_TYPE 
ID_LABEL_MAX_READS 
ID_LABEL_MAX_WRITES 
ID_LABEL_GUARD_LATENCY 
ID_ZERO_REGISTER 

Definition at line 95 of file RFDialog.hh.

95  {
96  ID_NAME = 10000,
97  ID_TYPE,
98  ID_SIZE,
99  ID_WIDTH,
100  ID_MAX_READS,
103  ID_PORT_LIST,
104  ID_ADD_PORT,
105  ID_EDIT_PORT,
107  ID_HELP,
116  };

Constructor & Destructor Documentation

◆ RFDialog()

RFDialog::RFDialog ( wxWindow *  parent,
TTAMachine::RegisterFile registerFile 
)

The Constructor.

Parameters
parentParent window of the dialog.
registerFileRegister file to add/edit.

Definition at line 82 of file RFDialog.cc.

84  :
85  wxDialog(parent, -1, _T(""), wxDefaultPosition),
86  registerFile_(registerFile),
87  name_(_T("")),
88  size_(1),
90  maxReads_(0),
91  maxWrites_(0),
92  zeroRegister_(false),
93  portListCtrl_(NULL),
94  typeChoice_(NULL) {
95 
96  //registerFile_->updateMaxReadsAndWrites();
97  createContents(this, true, true);
98 
99  FindWindow(wxID_OK)->Disable();
100  FindWindow(ID_EDIT_PORT)->Disable();
101  FindWindow(ID_DELETE_PORT)->Disable();
102 
103  FindWindow(ID_NAME)->SetValidator(wxTextValidator(wxFILTER_ASCII, &name_));
104 
105  portListCtrl_ = dynamic_cast<wxListCtrl*>(FindWindow(ID_PORT_LIST));
106  typeChoice_ = dynamic_cast<wxChoice*>(FindWindow(ID_TYPE));
107 
108  // Set widget validators.
109  FindWindow(ID_WIDTH)->SetValidator(wxGenericValidator(&width_));
110  FindWindow(ID_SIZE)->SetValidator(wxGenericValidator(&size_));
111  FindWindow(ID_GUARD_LATENCY)->SetValidator(
112  wxGenericValidator(&guardLatency_));
113 
114  FindWindow(ID_ZERO_REGISTER)->SetValidator(
115  wxGenericValidator(&zeroRegister_));
116 
117  // set widget texts
118  setTexts();
119 
121 }

◆ ~RFDialog()

RFDialog::~RFDialog ( )
virtual

The Destructor.

Definition at line 127 of file RFDialog.cc.

127  {
128 }

Member Function Documentation

◆ createContents()

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

Creates the dialog window contents.

This method was generated with wxDesigner.

Returns
Main sizer of the created contents.
Parameters
parentThe dialog window.
call_fitIf true, fits the contents inside the dialog.
set_sizerIf true, sets the main sizer as dialog contents.

Definition at line 536 of file RFDialog.cc.

536  {
537 
538  wxBoxSizer *item0 = new wxBoxSizer( wxVERTICAL );
539 
540  wxFlexGridSizer *item1 = new wxFlexGridSizer( 2, 0, 0 );
541 
542  wxStaticText *item2 = new wxStaticText( parent, ID_LABEL_NAME, wxT("Name:"), wxDefaultPosition, wxDefaultSize, 0 );
543  item1->Add( item2, 0, wxALIGN_RIGHT|wxALL, 5 );
544 
545  wxTextCtrl *item3 = new wxTextCtrl( parent, ID_NAME, wxT(""), wxDefaultPosition, wxSize(200,-1), 0 );
546  item1->Add( item3, 0, wxGROW|wxALL, 5 );
547 
548  wxStaticText *item4 = new wxStaticText( parent, ID_LABEL_TYPE, wxT("Type:"), wxDefaultPosition, wxDefaultSize, 0 );
549  item1->Add( item4, 0, wxALIGN_RIGHT|wxALL, 5 );
550 
551  wxString *strs5 = (wxString*) NULL;
552  wxChoice *item5 = new wxChoice( parent, ID_TYPE, wxDefaultPosition, wxSize(100,-1), 0, strs5, 0 );
553  item1->Add( item5, 0, wxGROW|wxALL, 5 );
554 
555  wxStaticText *item6 = new wxStaticText( parent, ID_LABEL_SIZE, wxT("Size:"), wxDefaultPosition, wxDefaultSize, 0 );
556  item1->Add( item6, 0, wxALIGN_RIGHT|wxALL, 5 );
557 
558  wxSpinCtrl *item7 = new wxSpinCtrl( parent, ID_SIZE, wxT("1"), wxDefaultPosition, wxSize(-1,-1), 0, 1, 10000, 1 );
559  item1->Add( item7, 0, wxGROW|wxALL, 5 );
560 
561  wxStaticText *item8 = new wxStaticText( parent, ID_LABEL_WIDTH, wxT("Width:"), wxDefaultPosition, wxDefaultSize, 0 );
562  item1->Add( item8, 0, wxALIGN_RIGHT|wxALL, 5 );
563 
564  wxSpinCtrl *item9 = new wxSpinCtrl( parent, ID_WIDTH, wxT("1"), wxDefaultPosition, wxSize(-1,-1), 0, 1, 10000, 1 );
565  item1->Add( item9, 0, wxGROW|wxALL, 5 );
566 
567  wxStaticText *item10 = new wxStaticText( parent, ID_LABEL_MAX_READS, wxT("Max-Reads:"), wxDefaultPosition, wxDefaultSize, 0 );
568  item1->Add( item10, 0, wxALIGN_RIGHT|wxALL, 5 );
569 
570  wxStaticText *item11 = new wxStaticText( parent, ID_MAX_READS, wxT("0"), wxDefaultPosition, wxSize(100,-1), 0);
571  item1->Add( item11, 0, wxGROW|wxALL, 5 );
572 
573  wxStaticText *item12 = new wxStaticText( parent, ID_LABEL_MAX_WRITES, wxT("Max-Writes:"), wxDefaultPosition, wxDefaultSize, 0 );
574  item1->Add( item12, 0, wxALIGN_RIGHT|wxALL, 5 );
575 
576  wxStaticText *item13 = new wxStaticText( parent, ID_MAX_WRITES, wxT("0"), wxDefaultPosition, wxSize(100,-1), 0);
577  item1->Add( item13, 0, wxGROW|wxALL, 5 );
578 
579  wxStaticText *item14 = new wxStaticText( parent, ID_LABEL_GUARD_LATENCY, wxT("Guard Latency:"), wxDefaultPosition, wxDefaultSize, 0 );
580  item1->Add( item14, 0, wxALIGN_RIGHT|wxALL, 5 );
581 
582  wxSpinCtrl *item15 = new wxSpinCtrl( parent, ID_GUARD_LATENCY, wxT("0"), wxDefaultPosition, wxSize(-1,-1), 0, 0, 1, 0 );
583  item1->Add( item15, 0, wxGROW|wxALL, 5 );
584 
585  item0->Add( item1, 0, wxGROW|wxALL, 5 );
586 
587  wxStaticBox *item17 = new wxStaticBox( parent, -1, wxT("Ports:") );
588  wxStaticBoxSizer *item16 = new wxStaticBoxSizer( item17, wxVERTICAL );
589  portsSizer_ = item16;
590 
591  wxListCtrl *item18 = new wxListCtrl( parent, ID_PORT_LIST, wxDefaultPosition, wxSize(160,120), wxLC_REPORT|wxSUNKEN_BORDER );
592  item16->Add( item18, 0, wxGROW|wxALL, 5 );
593 
594  wxBoxSizer *item19 = new wxBoxSizer( wxHORIZONTAL );
595 
596  wxButton *item20 = new wxButton( parent, ID_ADD_PORT, wxT("&Add.."), wxDefaultPosition, wxDefaultSize, 0 );
597  item19->Add( item20, 0, wxALIGN_CENTER|wxALL, 5 );
598 
599  wxButton *item21 = new wxButton( parent, ID_EDIT_PORT, wxT("&Edit..."), wxDefaultPosition, wxDefaultSize, 0 );
600  item19->Add( item21, 0, wxALIGN_CENTER|wxALL, 5 );
601 
602  wxButton *item22 = new wxButton( parent, ID_DELETE_PORT, wxT("&Delete"), wxDefaultPosition, wxDefaultSize, 0 );
603  item19->Add( item22, 0, wxALIGN_CENTER|wxALL, 5 );
604 
605  item16->Add( item19, 0, wxALIGN_CENTER|wxLEFT|wxRIGHT, 5 );
606 
607  item0->Add( item16, 0, wxALIGN_CENTER|wxALL, 5 );
608 
609  wxBoxSizer *item23 = new wxBoxSizer( wxHORIZONTAL );
610 
611  wxButton *item24 = new wxButton( parent, ID_HELP, wxT("&Help"), wxDefaultPosition, wxDefaultSize, 0 );
612  item23->Add( item24, 0, wxALIGN_CENTER|wxALL, 5 );
613 
614  wxButton *item25 = new wxButton( parent, wxID_OK, wxT("&OK"), wxDefaultPosition, wxDefaultSize, 0 );
615  item23->Add( item25, 0, wxALIGN_CENTER|wxALL, 5 );
616 
617  wxButton *item26 = new wxButton( parent, wxID_CANCEL, wxT("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
618  item23->Add( item26, 0, wxALIGN_CENTER|wxALL, 5 );
619 
620  item0->Add( item23, 0, wxALIGN_CENTER|wxALL, 5 );
621 
622  wxCheckBox *item27 = new wxCheckBox( parent, ID_ZERO_REGISTER, wxT("Zero register"), wxDefaultPosition, wxDefaultSize, 0);
623  item1->Add( item27, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
624 
625  if (set_sizer)
626  {
627  parent->SetSizer( item0 );
628  if (call_fit)
629  item0->SetSizeHints( parent );
630  }
631 
632  return item0;
633 }

◆ onActivatePort()

void RFDialog::onActivatePort ( wxListEvent &  event)
private

Handles left mouse button double clicks on the port list.

Definition at line 455 of file RFDialog.cc.

455  {
456  wxCommandEvent dummy;
457  onEditPort(dummy);
458 }

References dummy.

◆ onAddPort()

void RFDialog::onAddPort ( wxCommandEvent &  event)
private

Creates and shows an empty RFPortDialog for adding ports.

Definition at line 412 of file RFDialog.cc.

412  {
413 
414  // Generate name for the new port.
415  int i = 1;
418  while (registerFile_->hasPort(newName)) {
421  i++;
422  }
423 
424  RFPort* port = new RFPort(newName, *registerFile_);
425  RFPortDialog portDialog(this, port);
426  if (portDialog.ShowModal() == wxID_OK) {
427  updatePortList();
428  } else {
429  delete port;
430  }
431 
432  updateWidgets();
433 
434 }

References ProDeConstants::COMP_NEW_NAME_PREFIX_PORT, and Conversion::toString().

Here is the call graph for this function:

◆ onDeletePort()

void RFDialog::onDeletePort ( wxCommandEvent &  event)
private

Deletes selected port from the port list.

Definition at line 441 of file RFDialog.cc.

441  {
442  Port* selected = selectedPort();
443  assert(selected != NULL);
444  delete selected;
445  updatePortList();
446 
447  updateWidgets();
448 }

References assert.

◆ onEditPort()

void RFDialog::onEditPort ( wxCommandEvent &  event)
private

Handles the 'Edit Port' button event.

Opens a RFPortDialog with the selected port's attributes set.

Definition at line 467 of file RFDialog.cc.

467  {
468 
469  Port* port = selectedPort();
470  if (port == NULL) {
471  // No port selected.
472  return;
473  }
474 
475  RFPortDialog portDialog(this, port);
476  if (portDialog.ShowModal() == wxID_OK) {
477  updatePortList();
478  }
479 }

◆ onHelp()

void RFDialog::onHelp ( wxCommandEvent &  event)
private

◆ onName()

void RFDialog::onName ( wxCommandEvent &  event)
private

Checks whether name field is empty and disables OK button of the dialog if it is.

Definition at line 373 of file RFDialog.cc.

373  {
374  if (!TransferDataFromWindow()) {
375  assert(false);
376  }
377  wxString trimmedName = name_.Trim(false).Trim(true);
378  if (trimmedName == _T("")) {
379  FindWindow(wxID_OK)->Disable();
380  } else {
381  FindWindow(wxID_OK)->Enable();
382  }
383 }

References assert.

◆ onOK()

void RFDialog::onOK ( wxCommandEvent &  event)
private

Validates input in the controls, and updates the RegisterFile.

Definition at line 285 of file RFDialog.cc.

285  {
286  if (!Validate()) {
287  return;
288  }
289 
290  if (!TransferDataFromWindow()) {
291  return;
292  }
293 
294  string trimmedName =
295  WxConversion::toString(name_.Trim(false).Trim(true));
296 
297  // Check the name validity.
298  if (!MachineTester::isValidComponentName(trimmedName)) {
300  format message =
302  InformationDialog warning(
303  this, WxConversion::toWxString(message.str()));
304  warning.ShowModal();
305  return;
306  }
307 
308  if (registerFile_->name() != trimmedName) {
309 
312 
313  for (int i = 0; i < navigator.count(); i++) {
314  RegisterFile* rf = navigator.item(i);
315  if (trimmedName == rf->name()) {
316  ProDeTextGenerator* prodeTexts =
318  format message =
320  format a_rf =
322  format machine =
324  format rf =
326  message % trimmedName % a_rf.str() % machine.str() % rf.str();
327  WarningDialog warning(
328  this, WxConversion::toWxString(message.str()));
329  warning.ShowModal();
330  return;
331  }
332  }
333  }
334 
335  try {
336  registerFile_->setName(trimmedName);
341  } catch (Exception& e) {
342  InformationDialog dialog(
344  dialog.ShowModal();
345  return;
346  }
347 
348  // set register file type
349  switch (typeChoice_->GetSelection()) {
350  case 0:
352  break;
353  case 1:
354  registerFile_->setType(RegisterFile::RESERVED);
355  break;
356  case 2:
357  registerFile_->setType(RegisterFile::VOLATILE);
358  break;
359  default:
360  assert(false);
361  }
362 
363  //registerFile_->updateMaxReadsAndWrites();
364  EndModal(wxID_OK);
365 }

References assert, ProDeTextGenerator::COMP_A_REGISTER_FILE, ProDeTextGenerator::COMP_MACHINE, ProDeTextGenerator::COMP_REGISTER_FILE, TTAMachine::Machine::Navigator< ComponentType >::count(), Exception::errorMessage(), ProDeTextGenerator::instance(), MachineTester::isValidComponentName(), TTAMachine::Machine::Navigator< ComponentType >::item(), machine, ProDeTextGenerator::MSG_ERROR_ILLEGAL_NAME, ProDeTextGenerator::MSG_ERROR_SAME_NAME, TTAMachine::Component::name(), TTAMachine::RegisterFile::NORMAL, TTAMachine::RegisterFile::RESERVED, Texts::TextGenerator::text(), WxConversion::toString(), WxConversion::toWxString(), and TTAMachine::RegisterFile::VOLATILE.

Here is the call graph for this function:

◆ onPortRightClick()

void RFDialog::onPortRightClick ( wxListEvent &  event)
private

Opens a pop-up menu when right mouse button was pressed.

Parameters
eventInformation about right mouse click event.

Definition at line 505 of file RFDialog.cc.

505  {
506 
507  portListCtrl_->SetItemState(event.GetIndex(), wxLIST_STATE_SELECTED,
508  wxLIST_STATE_SELECTED);
509 
510  wxMenu* contextMenu = new wxMenu();
511 
513  format button = prodeTexts->text(
515  contextMenu->Append(
516  ID_EDIT_PORT, WxConversion::toWxString(button.str()));
517  button = prodeTexts->text(
519  contextMenu->Append(
521  portListCtrl_->PopupMenu(contextMenu, event.GetPoint());
522 }

References ProDeTextGenerator::instance(), Texts::TextGenerator::text(), WxConversion::toWxString(), ProDeTextGenerator::TXT_LABEL_BUTTON_DELETE, and ProDeTextGenerator::TXT_LABEL_BUTTON_EDIT.

Here is the call graph for this function:

◆ onPortSelection()

void RFDialog::onPortSelection ( wxListEvent &  event)
private

Disables and enables Edit and Delete buttons under the port list.

If a port is selected, buttons are enabled. If no port is selected the buttons will be disabled.

Definition at line 488 of file RFDialog.cc.

488  {
489  if (portListCtrl_->GetSelectedItemCount() != 1) {
490  FindWindow(ID_DELETE_PORT)->Disable();
491  FindWindow(ID_EDIT_PORT)->Disable();
492  return;
493  }
494  FindWindow(ID_DELETE_PORT)->Enable();
495  FindWindow(ID_EDIT_PORT)->Enable();
496 }

◆ selectedPort()

Port * RFDialog::selectedPort ( ) const
private

Returns pointer to the port which is selected on the port list.

Returns
Pointer to the port which is selected on the port list.

Definition at line 392 of file RFDialog.cc.

392  {
393  long item = -1;
394  item = portListCtrl_->GetNextItem(
395  item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
396 
397  if (item == -1) {
398  return NULL;
399  }
400 
401  string portName =
402  WxConversion::toString(portListCtrl_->GetItemText(item));
403 
404  return registerFile_->port(portName);
405 }

References WxConversion::toString().

Here is the call graph for this function:

◆ setTexts()

void RFDialog::setTexts ( )
private

Sets texts for widgets.

Definition at line 135 of file RFDialog.cc.

135  {
138 
139  // Dialog title
140  format fmt = prodeTexts->text(ProDeTextGenerator::TXT_RF_DIALOG_TITLE);
141  SetTitle(WxConversion::toWxString(fmt.str()));
142 
143  // buttons
144  WidgetTools::setLabel(generator, FindWindow(wxID_OK),
146 
147  WidgetTools::setLabel(generator, FindWindow(wxID_CANCEL),
149 
152 
155 
158 
161 
162  // widget labels
165 
168 
171 
174 
177 
180 
183 
184  // choicer texts
185  fmt = prodeTexts->text(ProDeTextGenerator::TXT_RF_TYPE_NORMAL);
186  typeChoice_->Append(WxConversion::toWxString(fmt.str()));
188  typeChoice_->Append(WxConversion::toWxString(fmt.str()));
190  typeChoice_->Append(WxConversion::toWxString(fmt.str()));
191 
192  // box sizer label
193  fmt = prodeTexts->text(ProDeTextGenerator::TXT_RF_PORTS_BOX);
195 
196  // Create port list column.
197  wxListCtrl* portList =
198  dynamic_cast<wxListCtrl*>(FindWindow(ID_PORT_LIST));
199  fmt = prodeTexts->text(ProDeTextGenerator::TXT_COLUMN_NAME);
200  portList->InsertColumn(0, WxConversion::toWxString(fmt.str()),
201  wxLIST_FORMAT_LEFT, 200);
202 }

References GUITextGenerator::instance(), ProDeTextGenerator::instance(), WidgetTools::setLabel(), WidgetTools::setWidgetLabel(), Texts::TextGenerator::text(), WxConversion::toWxString(), GUITextGenerator::TXT_BUTTON_ADD_DIALOG, GUITextGenerator::TXT_BUTTON_CANCEL, GUITextGenerator::TXT_BUTTON_DELETE, GUITextGenerator::TXT_BUTTON_EDIT_DIALOG, GUITextGenerator::TXT_BUTTON_HELP, GUITextGenerator::TXT_BUTTON_OK, ProDeTextGenerator::TXT_COLUMN_NAME, ProDeTextGenerator::TXT_LABEL_GUARD_LATENCY, ProDeTextGenerator::TXT_LABEL_MAX_READS, ProDeTextGenerator::TXT_LABEL_MAX_WRITES, ProDeTextGenerator::TXT_LABEL_NAME, ProDeTextGenerator::TXT_LABEL_SIZE, ProDeTextGenerator::TXT_LABEL_TYPE, ProDeTextGenerator::TXT_LABEL_WIDTH, ProDeTextGenerator::TXT_RF_DIALOG_TITLE, ProDeTextGenerator::TXT_RF_PORTS_BOX, ProDeTextGenerator::TXT_RF_TYPE_NORMAL, ProDeTextGenerator::TXT_RF_TYPE_RESERVED, and ProDeTextGenerator::TXT_RF_TYPE_VOLATILE.

Here is the call graph for this function:

◆ TransferDataToWindow()

bool RFDialog::TransferDataToWindow ( )
privatevirtual

Transfers data from the RegisterFile object to the dialog widgets.

Returns
false, if an error occured in the transfer.

Definition at line 210 of file RFDialog.cc.

210  {
211 
212  updateWidgets();
213 
214  return wxWindow::TransferDataToWindow();
215 }

◆ updatePortList()

void RFDialog::updatePortList ( )
private

Updates the port list widget.

Definition at line 269 of file RFDialog.cc.

269  {
270  portListCtrl_->DeleteAllItems();
271  for (int i=0; i < registerFile_->portCount(); i++) {
272 
273  wxString name =
275 
276  portListCtrl_->InsertItem(i, name);
277  }
278 }

References WxConversion::toWxString().

Here is the call graph for this function:

◆ updateWidgets()

void RFDialog::updateWidgets ( )
private

Reads data form the RegisterFile and updates GUI.

Definition at line 223 of file RFDialog.cc.

223  {
224 
225  //registerFile_->updateMaxReadsAndWrites();
226 
234 
235  switch (registerFile_->type()) {
237  typeChoice_->SetSelection(0);
238  break;
239  case RegisterFile::RESERVED:
240  typeChoice_->SetSelection(1);
241  break;
242  case RegisterFile::VOLATILE:
243  typeChoice_->SetSelection(2);
244  break;
245  default:
246  assert(false);
247  }
248 
249  updatePortList();
250 
251  // wxWidgets GTK1 version seems to bug with spincontrol validators.
252  // The widget value has to be set manually.
253  dynamic_cast<wxSpinCtrl*>(FindWindow(ID_SIZE))->SetValue(size_);
254  dynamic_cast<wxSpinCtrl*>(FindWindow(ID_WIDTH))->SetValue(width_);
255  dynamic_cast<wxStaticText*>(FindWindow(ID_MAX_READS))->SetLabel(
257  dynamic_cast<wxStaticText*>(FindWindow(ID_MAX_WRITES))->SetLabel(
259  dynamic_cast<wxSpinCtrl*>(
261  dynamic_cast<wxCheckBox*>(
263 }

References assert, TTAMachine::RegisterFile::NORMAL, TTAMachine::RegisterFile::RESERVED, WxConversion::toWxString(), and TTAMachine::RegisterFile::VOLATILE.

Here is the call graph for this function:

Member Data Documentation

◆ guardLatency_

int RFDialog::guardLatency_
private

Guard latency.

Definition at line 85 of file RFDialog.hh.

◆ maxReads_

int RFDialog::maxReads_
private

Max reads.

Definition at line 81 of file RFDialog.hh.

◆ maxWrites_

int RFDialog::maxWrites_
private

Maximum writes.

Definition at line 83 of file RFDialog.hh.

◆ name_

wxString RFDialog::name_
private

Name of the register file.

Definition at line 75 of file RFDialog.hh.

◆ portListCtrl_

wxListCtrl* RFDialog::portListCtrl_
private

Port list control.

Definition at line 90 of file RFDialog.hh.

◆ portsSizer_

wxStaticBoxSizer* RFDialog::portsSizer_
private

Sizer containing the port list and associated buttons.

Definition at line 70 of file RFDialog.hh.

◆ registerFile_

TTAMachine::RegisterFile* RFDialog::registerFile_
private

Register file to modify.

Definition at line 73 of file RFDialog.hh.

◆ size_

int RFDialog::size_
private

Number of registers.

Definition at line 77 of file RFDialog.hh.

◆ typeChoice_

wxChoice* RFDialog::typeChoice_
private

Opcode choice control.

Definition at line 92 of file RFDialog.hh.

◆ width_

int RFDialog::width_
private

Width.

Definition at line 79 of file RFDialog.hh.

◆ zeroRegister_

bool RFDialog::zeroRegister_
private

Zero register.

Definition at line 87 of file RFDialog.hh.


The documentation for this class was generated from the following files:
RFDialog::name_
wxString name_
Name of the register file.
Definition: RFDialog.hh:75
RFDialog::portsSizer_
wxStaticBoxSizer * portsSizer_
Sizer containing the port list and associated buttons.
Definition: RFDialog.hh:70
RFDialog::ID_LABEL_MAX_READS
@ ID_LABEL_MAX_READS
Definition: RFDialog.hh:112
TTAMachine::BaseRegisterFile::setWidth
virtual void setWidth(int width)
Definition: BaseRegisterFile.cc:112
WarningDialog
Definition: WarningDialog.hh:42
RFDialog::ID_LABEL_MAX_WRITES
@ ID_LABEL_MAX_WRITES
Definition: RFDialog.hh:113
RFDialog::ID_LABEL_TYPE
@ ID_LABEL_TYPE
Definition: RFDialog.hh:111
ProDeTextGenerator::TXT_LABEL_MAX_READS
@ TXT_LABEL_MAX_READS
Label for Max-Reads widget.
Definition: ProDeTextGenerator.hh:70
RFDialog::maxWrites_
int maxWrites_
Maximum writes.
Definition: RFDialog.hh:83
WxConversion::toWxString
static wxString toWxString(const std::string &source)
RFDialog::createContents
wxSizer * createContents(wxWindow *parent, bool call_fit, bool set_sizer)
Definition: RFDialog.cc:536
TTAMachine::Component::name
virtual TCEString name() const
Definition: MachinePart.cc:125
ProDeTextGenerator::TXT_LABEL_BUTTON_DELETE
@ TXT_LABEL_BUTTON_DELETE
Label for &Delete button.
Definition: ProDeTextGenerator.hh:95
machine
TTAMachine::Machine * machine
the architecture definition of the estimated processor
Definition: EstimatorCmdLineUI.cc:59
RFDialog::portListCtrl_
wxListCtrl * portListCtrl_
Port list control.
Definition: RFDialog.hh:90
RFDialog::ID_LABEL_WIDTH
@ ID_LABEL_WIDTH
Definition: RFDialog.hh:110
WidgetTools::setLabel
static void setLabel(Texts::TextGenerator *generator, wxWindow *widget, int textID)
Definition: WidgetTools.cc:92
RFDialog::ID_WIDTH
@ ID_WIDTH
Definition: RFDialog.hh:99
RFDialog::ID_LABEL_SIZE
@ ID_LABEL_SIZE
Definition: RFDialog.hh:109
GUITextGenerator::instance
static GUITextGenerator * instance()
Definition: GUITextGenerator.cc:67
RFDialog::typeChoice_
wxChoice * typeChoice_
Opcode choice control.
Definition: RFDialog.hh:92
GUITextGenerator
Definition: GUITextGenerator.hh:46
GUITextGenerator::TXT_BUTTON_HELP
@ TXT_BUTTON_HELP
Label for help button.
Definition: GUITextGenerator.hh:60
RFDialog::ID_DELETE_PORT
@ ID_DELETE_PORT
Definition: RFDialog.hh:106
FindWindow
Definition: FindWindow.hh:49
TTAMachine::RegisterFile::setType
virtual void setType(RegisterFile::Type type)
Definition: RegisterFile.cc:304
ProDeConstants::COMP_NEW_NAME_PREFIX_PORT
static const std::string COMP_NEW_NAME_PREFIX_PORT
Prefix for new port names.
Definition: ProDeConstants.hh:373
TTAMachine::Machine::Navigator::count
int count() const
Texts::TextGenerator::text
virtual boost::format text(int textId)
Definition: TextGenerator.cc:94
RFPortDialog
Definition: RFPortDialog.hh:44
RFDialog::guardLatency_
int guardLatency_
Guard latency.
Definition: RFDialog.hh:85
TTAMachine::RegisterFile::maxWrites
virtual int maxWrites() const
Definition: RegisterFile.cc:135
RFDialog::ID_ZERO_REGISTER
@ ID_ZERO_REGISTER
Definition: RFDialog.hh:115
Conversion::toString
static std::string toString(const T &source)
ProDeTextGenerator::TXT_LABEL_BUTTON_EDIT
@ TXT_LABEL_BUTTON_EDIT
Label for &Edit... button.
Definition: ProDeTextGenerator.hh:96
ProDeTextGenerator
Definition: ProDeTextGenerator.hh:49
ProDeTextGenerator::MSG_ERROR_ILLEGAL_NAME
@ MSG_ERROR_ILLEGAL_NAME
Error: Illegal component name.
Definition: ProDeTextGenerator.hh:223
RFDialog::ID_LABEL_NAME
@ ID_LABEL_NAME
Definition: RFDialog.hh:108
TTAMachine::RFPort
Definition: RFPort.hh:45
TTAMachine::BaseRegisterFile::numberOfRegisters
virtual int numberOfRegisters() const
RFDialog::ID_MAX_READS
@ ID_MAX_READS
Definition: RFDialog.hh:100
ProDeTextGenerator::MSG_ERROR_SAME_NAME
@ MSG_ERROR_SAME_NAME
Error: Same name exists.
Definition: ProDeTextGenerator.hh:229
RFDialog::ID_ADD_PORT
@ ID_ADD_PORT
Definition: RFDialog.hh:104
assert
#define assert(condition)
Definition: Application.hh:86
TTAMachine::RegisterFile::setGuardLatency
virtual void setGuardLatency(int latency)
Definition: RegisterFile.cc:346
ProDeTextGenerator::TXT_RF_TYPE_NORMAL
@ TXT_RF_TYPE_NORMAL
Register file type: normal.
Definition: ProDeTextGenerator.hh:157
RFDialog::setTexts
void setTexts()
Definition: RFDialog.cc:135
ProDeTextGenerator::TXT_LABEL_MAX_WRITES
@ TXT_LABEL_MAX_WRITES
Label for Max-Writes widget.
Definition: ProDeTextGenerator.hh:69
GUITextGenerator::TXT_BUTTON_CANCEL
@ TXT_BUTTON_CANCEL
Label for cancel button.
Definition: GUITextGenerator.hh:55
ProDeTextGenerator::TXT_LABEL_TYPE
@ TXT_LABEL_TYPE
Label for type widget.
Definition: ProDeTextGenerator.hh:67
RFDialog::updatePortList
void updatePortList()
Definition: RFDialog.cc:269
ModelConstants::DEFAULT_WIDTH
static const int DEFAULT_WIDTH
Default bit width.
Definition: ModelConstants.hh:46
TTAMachine::RegisterFile::maxReads
virtual int maxReads() const
Definition: RegisterFile.cc:123
RFDialog::ID_EDIT_PORT
@ ID_EDIT_PORT
Definition: RFDialog.hh:105
RFDialog::ID_LABEL_GUARD_LATENCY
@ ID_LABEL_GUARD_LATENCY
Definition: RFDialog.hh:114
TTAMachine::Port
Definition: Port.hh:54
dummy
SimValue dummy(32)
a dummy simvalue which is given for operands that are not bound
ProDeTextGenerator::COMP_REGISTER_FILE
@ COMP_REGISTER_FILE
Register file (w/o article).
Definition: ProDeTextGenerator.hh:269
ProDeTextGenerator::TXT_LABEL_NAME
@ TXT_LABEL_NAME
Label for component name widget.
Definition: ProDeTextGenerator.hh:56
RFDialog::onEditPort
void onEditPort(wxCommandEvent &event)
Definition: RFDialog.cc:467
TTAMachine::Unit::hasPort
virtual bool hasPort(const std::string &name) const
Definition: Unit.cc:96
RFDialog::ID_MAX_WRITES
@ ID_MAX_WRITES
Definition: RFDialog.hh:101
ProDeTextGenerator::TXT_LABEL_SIZE
@ TXT_LABEL_SIZE
Label for size widget.
Definition: ProDeTextGenerator.hh:68
NORMAL
@ NORMAL
Definition: tceopgen.cc:45
Exception
Definition: Exception.hh:54
ProDeTextGenerator::TXT_LABEL_GUARD_LATENCY
@ TXT_LABEL_GUARD_LATENCY
Label for guard latency.
Definition: ProDeTextGenerator.hh:92
MachineTester::isValidComponentName
static bool isValidComponentName(const std::string &name)
Definition: MachineTester.cc:312
RFDialog::ID_SIZE
@ ID_SIZE
Definition: RFDialog.hh:98
RFDialog::maxReads_
int maxReads_
Max reads.
Definition: RFDialog.hh:81
TTAMachine::Unit::portCount
virtual int portCount() const
Definition: Unit.cc:135
RFDialog::width_
int width_
Width.
Definition: RFDialog.hh:79
Exception::errorMessage
std::string errorMessage() const
Definition: Exception.cc:123
GUITextGenerator::TXT_BUTTON_DELETE
@ TXT_BUTTON_DELETE
Label for delete button.
Definition: GUITextGenerator.hh:56
ProDeTextGenerator::instance
static ProDeTextGenerator * instance()
Definition: ProDeTextGenerator.cc:382
TTAMachine::BaseRegisterFile::port
virtual RFPort * port(const std::string &name) const
Definition: BaseRegisterFile.cc:129
RFDialog::ID_TYPE
@ ID_TYPE
Definition: RFDialog.hh:97
TTAMachine::Machine::registerFileNavigator
virtual RegisterFileNavigator registerFileNavigator() const
Definition: Machine.cc:450
RFDialog::TransferDataToWindow
virtual bool TransferDataToWindow()
Definition: RFDialog.cc:210
GUITextGenerator::TXT_BUTTON_ADD_DIALOG
@ TXT_BUTTON_ADD_DIALOG
Label for add button (with trailing ...).
Definition: GUITextGenerator.hh:54
RFDialog::size_
int size_
Number of registers.
Definition: RFDialog.hh:77
GUITextGenerator::TXT_BUTTON_EDIT_DIALOG
@ TXT_BUTTON_EDIT_DIALOG
Label for edit button (with trailing ...).
Definition: GUITextGenerator.hh:58
RFDialog::zeroRegister_
bool zeroRegister_
Zero register.
Definition: RFDialog.hh:87
RFDialog::selectedPort
TTAMachine::Port * selectedPort() const
Definition: RFDialog.cc:392
TTAMachine::Component::machine
virtual Machine * machine() const
RFDialog::registerFile_
TTAMachine::RegisterFile * registerFile_
Register file to modify.
Definition: RFDialog.hh:73
TTAMachine::Port::name
virtual std::string name() const
Definition: Port.cc:141
TTAMachine::RegisterFile::setZeroRegister
virtual void setZeroRegister(const bool &value)
Definition: RegisterFile.cc:634
RFDialog::ID_NAME
@ ID_NAME
Definition: RFDialog.hh:96
ProDeTextGenerator::TXT_RF_DIALOG_TITLE
@ TXT_RF_DIALOG_TITLE
Register file Dialog title.
Definition: ProDeTextGenerator.hh:155
RFDialog::ID_GUARD_LATENCY
@ ID_GUARD_LATENCY
Definition: RFDialog.hh:102
RFDialog::updateWidgets
void updateWidgets()
Definition: RFDialog.cc:223
ProDeTextGenerator::TXT_RF_TYPE_RESERVED
@ TXT_RF_TYPE_RESERVED
Register file type: reserved.
Definition: ProDeTextGenerator.hh:159
ProDeTextGenerator::COMP_MACHINE
@ COMP_MACHINE
Text for machine description.
Definition: ProDeTextGenerator.hh:252
RFDialog::ID_PORT_LIST
@ ID_PORT_LIST
Definition: RFDialog.hh:103
TTAMachine::Machine::Navigator::item
ComponentType * item(int index) const
WidgetTools::setWidgetLabel
static void setWidgetLabel(wxWindow *widget, std::string text)
Definition: WidgetTools.cc:52
TTAMachine::RegisterFile::guardLatency
virtual int guardLatency() const
Definition: RegisterFile.cc:333
TTAMachine::RegisterFile
Definition: RegisterFile.hh:47
ProDeTextGenerator::TXT_RF_TYPE_VOLATILE
@ TXT_RF_TYPE_VOLATILE
Register file type: volatile.
Definition: ProDeTextGenerator.hh:158
InformationDialog
Definition: InformationDialog.hh:42
TTAMachine::BaseRegisterFile::width
virtual int width() const
ProDeTextGenerator::TXT_LABEL_WIDTH
@ TXT_LABEL_WIDTH
Label for bit width widget.
Definition: ProDeTextGenerator.hh:57
WxConversion::toString
static std::string toString(const wxString &source)
TTAMachine::RegisterFile::type
virtual RegisterFile::Type type() const
Definition: RegisterFile.cc:147
ProDeTextGenerator::TXT_COLUMN_NAME
@ TXT_COLUMN_NAME
Label for name column in a list.
Definition: ProDeTextGenerator.hh:105
TTAMachine::Machine::Navigator
Definition: Machine.hh:186
RFDialog::ID_HELP
@ ID_HELP
Definition: RFDialog.hh:107
TTAMachine::RegisterFile::setNumberOfRegisters
virtual void setNumberOfRegisters(int registers)
Definition: RegisterFile.cc:320
ProDeTextGenerator::COMP_A_REGISTER_FILE
@ COMP_A_REGISTER_FILE
Register file (w/ article).
Definition: ProDeTextGenerator.hh:268
TTAMachine::RegisterFile::zeroRegister
virtual bool zeroRegister() const
Definition: RegisterFile.cc:629
TTAMachine::RegisterFile::setName
virtual void setName(const std::string &name)
Definition: RegisterFile.cc:198
ProDeTextGenerator::TXT_RF_PORTS_BOX
@ TXT_RF_PORTS_BOX
Ports box title.
Definition: ProDeTextGenerator.hh:156
GUITextGenerator::TXT_BUTTON_OK
@ TXT_BUTTON_OK
Label for OK button.
Definition: GUITextGenerator.hh:59