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

#include <RFPortImplementationDialog.hh>

Inheritance diagram for RFPortImplementationDialog:
Inheritance graph
Collaboration diagram for RFPortImplementationDialog:
Collaboration graph

Public Member Functions

 RFPortImplementationDialog (wxWindow *parent, wxWindowID id, HDB::RFPortImplementation &implementation)
 
virtual ~RFPortImplementationDialog ()
 

Private Types

enum  {
  ID_LABEL_NAME = 10000, ID_NAME, ID_LABEL_LOAD_PORT, ID_LOAD_PORT,
  ID_LABEL_OPCODE_PORT, ID_OPCODE_PORT, ID_LABEL_OPCODE_PORT_WIDTH, ID_OPCODE_PORT_WIDTH,
  ID_DIRECTION, ID_LINE
}
 Enumerated IDs for dialog widgets. More...
 

Private Member Functions

void onOK (wxCommandEvent &event)
 
wxSizer * createContents (wxWindow *parent, bool call_fit, bool set_sizer)
 Creates the dialog contents. More...
 

Private Attributes

HDB::RFPortImplementationport_
 FU port implementation to modify. More...
 
wxString name_
 
wxString loadPort_
 
wxString opcodePort_
 
wxString opcodePortWidth_
 
int direction_
 

Detailed Description

Dialog for editing register file port implementations.

Definition at line 45 of file RFPortImplementationDialog.hh.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private

Enumerated IDs for dialog widgets.

Enumerator
ID_LABEL_NAME 
ID_NAME 
ID_LABEL_LOAD_PORT 
ID_LOAD_PORT 
ID_LABEL_OPCODE_PORT 
ID_OPCODE_PORT 
ID_LABEL_OPCODE_PORT_WIDTH 
ID_OPCODE_PORT_WIDTH 
ID_DIRECTION 
ID_LINE 

Definition at line 57 of file RFPortImplementationDialog.hh.

Constructor & Destructor Documentation

◆ RFPortImplementationDialog()

RFPortImplementationDialog::RFPortImplementationDialog ( wxWindow *  parent,
wxWindowID  id,
HDB::RFPortImplementation implementation 
)

The Constructor.

Parameters
parentParent window of the dialog.
idWindow identifier for the dialog window.
portRF port implementation to modify.

Definition at line 53 of file RFPortImplementationDialog.cc.

54  :
55  wxDialog(parent, id, _T("Register File Port Implementation")),
56  port_(port) {
57 
58  createContents(this, true, true);
59 
65 
67 
68  FindWindow(ID_NAME)->SetValidator(wxTextValidator(wxFILTER_ASCII, &name_));
69  FindWindow(ID_LOAD_PORT)->SetValidator(
70  wxTextValidator(wxFILTER_ASCII, &loadPort_));
71  FindWindow(ID_OPCODE_PORT)->SetValidator(
72  wxTextValidator(wxFILTER_ASCII, &opcodePort_));
73  FindWindow(ID_OPCODE_PORT_WIDTH)->SetValidator(
74  wxTextValidator(wxFILTER_ASCII, &opcodePortWidth_));
75  FindWindow(ID_DIRECTION)->SetValidator(wxGenericValidator(&direction_));
76 
77  TransferDataToWindow();
78 }

References WxConversion::toWxString().

Here is the call graph for this function:

◆ ~RFPortImplementationDialog()

RFPortImplementationDialog::~RFPortImplementationDialog ( )
virtual

The Destructor.

Definition at line 83 of file RFPortImplementationDialog.cc.

83  {
84 }

Member Function Documentation

◆ createContents()

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

Creates the dialog contents.

Creates the dialog contents.

Definition at line 128 of file RFPortImplementationDialog.cc.

129  {
130 
131  wxBoxSizer *item0 = new wxBoxSizer( wxVERTICAL );
132 
133  wxBoxSizer *item1 = new wxBoxSizer( wxHORIZONTAL );
134 
135  wxFlexGridSizer *item2 = new wxFlexGridSizer( 2, 0, 0 );
136 
137  wxStaticText *item3 = new wxStaticText( parent, ID_LABEL_NAME, wxT("Name:"), wxDefaultPosition, wxDefaultSize, 0 );
138  item2->Add( item3, 0, wxALL, 5 );
139 
140  wxTextCtrl *item4 = new wxTextCtrl( parent, ID_NAME, wxT(""), wxDefaultPosition, wxSize(200,-1), 0 );
141  item2->Add( item4, 0, wxALIGN_CENTER|wxALL, 5 );
142 
143  wxStaticText *item5 = new wxStaticText( parent, ID_LABEL_LOAD_PORT, wxT("Load port:"), wxDefaultPosition, wxDefaultSize, 0 );
144  item2->Add( item5, 0, wxALL, 5 );
145 
146  wxTextCtrl *item6 = new wxTextCtrl( parent, ID_LOAD_PORT, wxT(""), wxDefaultPosition, wxSize(200,-1), 0 );
147  item2->Add( item6, 0, wxGROW|wxALL, 5 );
148 
149  wxStaticText *item7 = new wxStaticText( parent, ID_LABEL_OPCODE_PORT, wxT("Opcode port:"), wxDefaultPosition, wxDefaultSize, 0 );
150  item2->Add( item7, 0, wxALL, 5 );
151 
152  wxTextCtrl *item8 = new wxTextCtrl( parent, ID_OPCODE_PORT, wxT(""), wxDefaultPosition, wxSize(200,-1), 0 );
153  item2->Add( item8, 0, wxALIGN_CENTER|wxALL, 5 );
154 
155  wxStaticText *item9 = new wxStaticText( parent, ID_LABEL_OPCODE_PORT_WIDTH, wxT("Opcode port width formula:"), wxDefaultPosition, wxDefaultSize, 0 );
156  item2->Add( item9, 0, wxALIGN_CENTER|wxALL, 5 );
157 
158  wxTextCtrl *item10 = new wxTextCtrl( parent, ID_OPCODE_PORT_WIDTH, wxT(""), wxDefaultPosition, wxSize(80,-1), 0 );
159  item2->Add( item10, 0, wxGROW|wxALL, 5 );
160 
161  item1->Add( item2, 0, wxGROW|wxALL, 5 );
162 
163  wxString strs11[] =
164  {
165  wxT("In"),
166  wxT("Out"),
167  wxT("Bidirectional")
168  };
169  wxRadioBox *item11 = new wxRadioBox( parent, ID_DIRECTION, wxT("Direction:"), wxDefaultPosition, wxDefaultSize, 3, strs11, 1, wxRA_SPECIFY_COLS );
170  item1->Add( item11, 0, wxGROW|wxALL, 5 );
171 
172  item0->Add( item1, 0, wxALIGN_CENTER|wxALL, 5 );
173 
174  wxStaticLine *item12 = new wxStaticLine( parent, ID_LINE, wxDefaultPosition, wxSize(20,-1), wxLI_HORIZONTAL );
175  item0->Add( item12, 0, wxGROW|wxALL, 5 );
176 
177  wxBoxSizer *item13 = new wxBoxSizer( wxHORIZONTAL );
178 
179  wxButton *item14 = new wxButton( parent, wxID_CANCEL, wxT("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
180  item13->Add( item14, 0, wxALIGN_CENTER|wxALL, 5 );
181 
182  wxButton *item15 = new wxButton( parent, wxID_OK, wxT("&OK"), wxDefaultPosition, wxDefaultSize, 0 );
183  item13->Add( item15, 0, wxALIGN_CENTER|wxALL, 5 );
184 
185  item0->Add( item13, 0, wxALL, 5 );
186 
187  if (set_sizer)
188  {
189  parent->SetSizer( item0 );
190  if (call_fit)
191  item0->SetSizeHints( parent );
192  }
193 
194  return item0;
195 }

◆ onOK()

void RFPortImplementationDialog::onOK ( wxCommandEvent &  event)
private

Event handler for the dialog OK-button.

Definition at line 90 of file RFPortImplementationDialog.cc.

90  {
91 
92  TransferDataFromWindow();
93 
94  name_ = name_.Trim(true).Trim(false);
95  loadPort_ = loadPort_.Trim(true).Trim(false);
96  opcodePort_ = opcodePort_.Trim(true).Trim(false);
97  opcodePortWidth_ = opcodePortWidth_.Trim(true).Trim(false);
98 
99  if (name_.IsEmpty()) {
100  wxString message = _T("Name field must not be empty.");
101  ErrorDialog dialog(this, message);
102  dialog.ShowModal();
103  return;
104  }
105 
110 
111  if (direction_ == 0) {
113  } else if (direction_ == 1) {
115  } else if (direction_ == 2) {
117  } else {
118  assert(false);
119  }
120  EndModal(wxID_OK);
121 
122 }

References assert, HDB::BIDIR, HDB::IN, HDB::OUT, and WxConversion::toString().

Here is the call graph for this function:

Member Data Documentation

◆ direction_

int RFPortImplementationDialog::direction_
private

Definition at line 80 of file RFPortImplementationDialog.hh.

◆ loadPort_

wxString RFPortImplementationDialog::loadPort_
private

Definition at line 77 of file RFPortImplementationDialog.hh.

◆ name_

wxString RFPortImplementationDialog::name_
private

Definition at line 76 of file RFPortImplementationDialog.hh.

◆ opcodePort_

wxString RFPortImplementationDialog::opcodePort_
private

Definition at line 78 of file RFPortImplementationDialog.hh.

◆ opcodePortWidth_

wxString RFPortImplementationDialog::opcodePortWidth_
private

Definition at line 79 of file RFPortImplementationDialog.hh.

◆ port_

HDB::RFPortImplementation& RFPortImplementationDialog::port_
private

FU port implementation to modify.

Definition at line 74 of file RFPortImplementationDialog.hh.


The documentation for this class was generated from the following files:
RFPortImplementationDialog::ID_NAME
@ ID_NAME
Definition: RFPortImplementationDialog.hh:59
HDB::RFPortImplementation::opcodePortWidthFormula
std::string opcodePortWidthFormula() const
Definition: RFPortImplementation.cc:132
RFPortImplementationDialog::ID_LABEL_LOAD_PORT
@ ID_LABEL_LOAD_PORT
Definition: RFPortImplementationDialog.hh:60
WxConversion::toWxString
static wxString toWxString(const std::string &source)
RFPortImplementationDialog::ID_LABEL_OPCODE_PORT
@ ID_LABEL_OPCODE_PORT
Definition: RFPortImplementationDialog.hh:62
RFPortImplementationDialog::ID_LINE
@ ID_LINE
Definition: RFPortImplementationDialog.hh:67
HDB::RFPortImplementation::direction
Direction direction() const
Definition: RFPortImplementation.cc:88
RFPortImplementationDialog::direction_
int direction_
Definition: RFPortImplementationDialog.hh:80
FindWindow
Definition: FindWindow.hh:49
RFPortImplementationDialog::ID_OPCODE_PORT
@ ID_OPCODE_PORT
Definition: RFPortImplementationDialog.hh:63
HDB::PortImplementation::setName
void setName(const std::string &name)
Definition: PortImplementation.cc:63
assert
#define assert(condition)
Definition: Application.hh:86
ErrorDialog
Definition: ErrorDialog.hh:42
RFPortImplementationDialog::ID_OPCODE_PORT_WIDTH
@ ID_OPCODE_PORT_WIDTH
Definition: RFPortImplementationDialog.hh:65
HDB::BIDIR
@ BIDIR
Bidirectional port.
Definition: HDBTypes.hh:43
RFPortImplementationDialog::opcodePort_
wxString opcodePort_
Definition: RFPortImplementationDialog.hh:78
HDB::PortImplementation::loadPort
std::string loadPort() const
Definition: PortImplementation.cc:96
RFPortImplementationDialog::ID_DIRECTION
@ ID_DIRECTION
Definition: RFPortImplementationDialog.hh:66
HDB::RFPortImplementation::setOpcodePort
void setOpcodePort(const std::string &name)
Definition: RFPortImplementation.cc:99
HDB::RFPortImplementation::setOpcodePortWidthFormula
void setOpcodePortWidthFormula(const std::string &formula)
Definition: RFPortImplementation.cc:121
HDB::PortImplementation::setLoadPort
void setLoadPort(const std::string &name)
Definition: PortImplementation.cc:85
HDB::PortImplementation::name
std::string name() const
Definition: PortImplementation.cc:74
RFPortImplementationDialog::loadPort_
wxString loadPort_
Definition: RFPortImplementationDialog.hh:77
HDB::RFPortImplementation::opcodePort
std::string opcodePort() const
Definition: RFPortImplementation.cc:110
HDB::IN
@ IN
Input port.
Definition: HDBTypes.hh:41
RFPortImplementationDialog::ID_LABEL_OPCODE_PORT_WIDTH
@ ID_LABEL_OPCODE_PORT_WIDTH
Definition: RFPortImplementationDialog.hh:64
RFPortImplementationDialog::opcodePortWidth_
wxString opcodePortWidth_
Definition: RFPortImplementationDialog.hh:79
RFPortImplementationDialog::port_
HDB::RFPortImplementation & port_
FU port implementation to modify.
Definition: RFPortImplementationDialog.hh:74
RFPortImplementationDialog::ID_LABEL_NAME
@ ID_LABEL_NAME
Definition: RFPortImplementationDialog.hh:58
RFPortImplementationDialog::createContents
wxSizer * createContents(wxWindow *parent, bool call_fit, bool set_sizer)
Creates the dialog contents.
Definition: RFPortImplementationDialog.cc:128
RFPortImplementationDialog::ID_LOAD_PORT
@ ID_LOAD_PORT
Definition: RFPortImplementationDialog.hh:61
WxConversion::toString
static std::string toString(const wxString &source)
HDB::RFPortImplementation::setDirection
void setDirection(Direction direction)
Definition: RFPortImplementation.cc:77
HDB::OUT
@ OUT
Output port.
Definition: HDBTypes.hh:42
RFPortImplementationDialog::name_
wxString name_
Definition: RFPortImplementationDialog.hh:76