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

#include <FUArchitectureDialog.hh>

Inheritance diagram for FUArchitectureDialog:
Inheritance graph
Collaboration diagram for FUArchitectureDialog:
Collaboration graph

Public Member Functions

 FUArchitectureDialog (wxWindow *parent, wxWindowID id, HDB::FUArchitecture &arch)
 
virtual ~FUArchitectureDialog ()
 

Private Types

enum  { ID_PARAM_WIDTH_LIST = 10000, ID_GUARD_SUPPORT_LIST, ID_LINE }
 Widget IDs. More...
 

Private Member Functions

void onOK (wxCommandEvent &event)
 
wxSizer * createContents (wxWindow *parent, bool call_fit, bool set_sizer)
 
void update ()
 

Private Attributes

HDB::FUArchitecturearch_
 
wxCheckListBox * paramWidthList_
 
wxCheckListBox * guardSupportList_
 

Detailed Description

Dialog for defining FU architecture paramters to HDB.

Definition at line 46 of file FUArchitectureDialog.hh.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private

Widget IDs.

Enumerator
ID_PARAM_WIDTH_LIST 
ID_GUARD_SUPPORT_LIST 
ID_LINE 

Definition at line 58 of file FUArchitectureDialog.hh.

58  {
59  ID_PARAM_WIDTH_LIST = 10000,
61  ID_LINE
62  };

Constructor & Destructor Documentation

◆ FUArchitectureDialog()

FUArchitectureDialog::FUArchitectureDialog ( wxWindow *  parent,
wxWindowID  id,
HDB::FUArchitecture arch 
)

The Constructor.

Parameters
parentParent window of the dialog.
idWindow identifier for the dialog.
fuFunction unit to parametrize.

Definition at line 51 of file FUArchitectureDialog.cc.

52  :
53  wxDialog(parent, id, _T("Function unit architecture.")),
54  arch_(arch) {
55 
56  createContents(this, true, true);
57 
58 
60  dynamic_cast<wxCheckListBox*>(FindWindow(ID_PARAM_WIDTH_LIST));
62  dynamic_cast<wxCheckListBox*>(FindWindow(ID_GUARD_SUPPORT_LIST));
63 
64  update();
65 }

◆ ~FUArchitectureDialog()

FUArchitectureDialog::~FUArchitectureDialog ( )
virtual

The Destructor.

Definition at line 70 of file FUArchitectureDialog.cc.

70  {
71 }

Member Function Documentation

◆ createContents()

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

Creates the dialog widgets.

Definition at line 118 of file FUArchitectureDialog.cc.

119  {
120 
121  wxBoxSizer *item0 = new wxBoxSizer( wxVERTICAL );
122 
123  wxBoxSizer *item1 = new wxBoxSizer( wxHORIZONTAL );
124 
125  wxStaticBox *item3 = new wxStaticBox( parent, -1, wxT("Parametrized width:") );
126  wxStaticBoxSizer *item2 = new wxStaticBoxSizer( item3, wxVERTICAL );
127 
128  wxWindow *item4 = new wxCheckListBox(parent, ID_PARAM_WIDTH_LIST, wxDefaultPosition, wxSize(200, 240));
129  wxASSERT( item4 );
130  item2->Add( item4, 0, wxALIGN_CENTER|wxALL, 5 );
131 
132  item1->Add( item2, 0, wxALIGN_CENTER|wxALL, 5 );
133 
134  wxStaticBox *item6 = new wxStaticBox( parent, -1, wxT("Guard support:") );
135  wxStaticBoxSizer *item5 = new wxStaticBoxSizer( item6, wxVERTICAL );
136 
137  wxWindow *item7 = new wxCheckListBox(parent, ID_GUARD_SUPPORT_LIST, wxDefaultPosition, wxSize(200, 240));
138  wxASSERT( item7 );
139  item5->Add( item7, 0, wxALIGN_CENTER|wxALL, 5 );
140 
141  item1->Add( item5, 0, wxALIGN_CENTER|wxALL, 5 );
142 
143  item0->Add( item1, 0, wxALIGN_CENTER|wxALL, 5 );
144 
145  wxStaticLine *item8 = new wxStaticLine( parent, ID_LINE, wxDefaultPosition, wxSize(20,-1), wxLI_HORIZONTAL );
146  item0->Add( item8, 0, wxGROW|wxALL, 5 );
147 
148  wxBoxSizer *item9 = new wxBoxSizer( wxHORIZONTAL );
149 
150  wxButton *item10 = new wxButton( parent, wxID_OK, wxT("&OK"), wxDefaultPosition, wxDefaultSize, 0 );
151  item9->Add( item10, 0, wxALIGN_CENTER|wxALL, 5 );
152 
153  wxButton *item11 = new wxButton( parent, wxID_CANCEL, wxT("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
154  item9->Add( item11, 0, wxALIGN_CENTER|wxALL, 5 );
155 
156  item0->Add( item9, 0, wxALIGN_CENTER|wxALL, 5 );
157 
158  if (set_sizer)
159  {
160  parent->SetSizer( item0 );
161  if (call_fit)
162  item0->SetSizeHints( parent );
163  }
164 
165  return item0;
166 }

References ID_GUARD_SUPPORT_LIST, ID_LINE, and ID_PARAM_WIDTH_LIST.

◆ onOK()

void FUArchitectureDialog::onOK ( wxCommandEvent &  event)
private

Event handler for the dialog OK-button.

Definition at line 99 of file FUArchitectureDialog.cc.

99  {
101  for (int i = 0; i < fu.portCount(); i++) {
102  std::string port = fu.port(i)->name();
103  if (paramWidthList_->IsChecked(i)) {
105  }
106  if (guardSupportList_->IsChecked(i)) {
107  arch_.setGuardSupport(port);
108  }
109  }
110 
111  EndModal(wxID_OK);
112 }

References arch_, HDB::FUArchitecture::architecture(), guardSupportList_, TTAMachine::Port::name(), paramWidthList_, TTAMachine::FunctionUnit::port(), TTAMachine::Unit::portCount(), HDB::FUArchitecture::setGuardSupport(), and HDB::FUArchitecture::setParameterizedWidth().

Here is the call graph for this function:

◆ update()

void FUArchitectureDialog::update ( )
private

Updates the dialog list widgets.

Definition at line 78 of file FUArchitectureDialog.cc.

78  {
79  paramWidthList_->Clear();
80  guardSupportList_->Clear();
82  for (int i = 0; i < fu.portCount(); i++) {
83  std::string port = fu.port(i)->name();
86  if (arch_.hasParameterizedWidth(port)) {
87  paramWidthList_->Check(i);
88  }
89  if (arch_.hasGuardSupport(port)) {
90  guardSupportList_->Check(i);
91  }
92  }
93 }

References arch_, HDB::FUArchitecture::architecture(), guardSupportList_, HDB::FUArchitecture::hasGuardSupport(), HDB::FUArchitecture::hasParameterizedWidth(), TTAMachine::Port::name(), paramWidthList_, TTAMachine::FunctionUnit::port(), TTAMachine::Unit::portCount(), and WxConversion::toWxString().

Here is the call graph for this function:

Member Data Documentation

◆ arch_

HDB::FUArchitecture& FUArchitectureDialog::arch_
private

Definition at line 64 of file FUArchitectureDialog.hh.

Referenced by onOK(), and update().

◆ guardSupportList_

wxCheckListBox* FUArchitectureDialog::guardSupportList_
private

Definition at line 67 of file FUArchitectureDialog.hh.

Referenced by onOK(), and update().

◆ paramWidthList_

wxCheckListBox* FUArchitectureDialog::paramWidthList_
private

Definition at line 66 of file FUArchitectureDialog.hh.

Referenced by onOK(), and update().


The documentation for this class was generated from the following files:
FUArchitectureDialog::ID_GUARD_SUPPORT_LIST
@ ID_GUARD_SUPPORT_LIST
Definition: FUArchitectureDialog.hh:60
WxConversion::toWxString
static wxString toWxString(const std::string &source)
HDB::FUArchitecture::hasParameterizedWidth
bool hasParameterizedWidth(const std::string &port) const
Definition: FUArchitecture.cc:86
FUArchitectureDialog::ID_LINE
@ ID_LINE
Definition: FUArchitectureDialog.hh:61
HDB::FUArchitecture::architecture
TTAMachine::FunctionUnit & architecture() const
Definition: FUArchitecture.cc:131
TTAMachine::FunctionUnit::port
virtual BaseFUPort * port(const std::string &name) const
Definition: FunctionUnit.cc:145
FindWindow
Definition: FindWindow.hh:49
FUArchitectureDialog::paramWidthList_
wxCheckListBox * paramWidthList_
Definition: FUArchitectureDialog.hh:66
TTAMachine::FunctionUnit
Definition: FunctionUnit.hh:55
HDB::FUArchitecture::setParameterizedWidth
void setParameterizedWidth(const std::string &port)
Definition: FUArchitecture.cc:97
HDB::FUArchitecture::hasGuardSupport
bool hasGuardSupport(const std::string &port) const
Definition: FUArchitecture.cc:109
FUArchitectureDialog::arch_
HDB::FUArchitecture & arch_
Definition: FUArchitectureDialog.hh:64
FUArchitectureDialog::guardSupportList_
wxCheckListBox * guardSupportList_
Definition: FUArchitectureDialog.hh:67
HDB::FUArchitecture::setGuardSupport
void setGuardSupport(const std::string &port)
Definition: FUArchitecture.cc:120
TTAMachine::Unit::portCount
virtual int portCount() const
Definition: Unit.cc:135
FUArchitectureDialog::createContents
wxSizer * createContents(wxWindow *parent, bool call_fit, bool set_sizer)
Definition: FUArchitectureDialog.cc:118
TTAMachine::Port::name
virtual std::string name() const
Definition: Port.cc:141
FUArchitectureDialog::ID_PARAM_WIDTH_LIST
@ ID_PARAM_WIDTH_LIST
Definition: FUArchitectureDialog.hh:59
FUArchitectureDialog::update
void update()
Definition: FUArchitectureDialog.cc:78