OpenASIP 2.2
Loading...
Searching...
No Matches
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.
 

Private Attributes

HDB::RFPortImplementationport_
 FU port implementation to modify.
 
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}
std::string loadPort() const
std::string opcodePortWidthFormula() const
wxSizer * createContents(wxWindow *parent, bool call_fit, bool set_sizer)
Creates the dialog contents.
HDB::RFPortImplementation & port_
FU port implementation to modify.
static wxString toWxString(const std::string &source)

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}

References ID_DIRECTION, ID_LABEL_LOAD_PORT, ID_LABEL_NAME, ID_LABEL_OPCODE_PORT, ID_LABEL_OPCODE_PORT_WIDTH, ID_LINE, ID_LOAD_PORT, ID_NAME, ID_OPCODE_PORT, and ID_OPCODE_PORT_WIDTH.

◆ 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}
#define assert(condition)
void setLoadPort(const std::string &name)
void setName(const std::string &name)
void setOpcodePortWidthFormula(const std::string &formula)
void setDirection(Direction direction)
void setOpcodePort(const std::string &name)
static std::string toString(const wxString &source)
@ OUT
Output port.
Definition HDBTypes.hh:42
@ BIDIR
Bidirectional port.
Definition HDBTypes.hh:43
@ IN
Input port.
Definition HDBTypes.hh:41

References assert, HDB::BIDIR, direction_, HDB::IN, loadPort_, name_, opcodePort_, opcodePortWidth_, HDB::OUT, port_, HDB::RFPortImplementation::setDirection(), HDB::PortImplementation::setLoadPort(), HDB::PortImplementation::setName(), HDB::RFPortImplementation::setOpcodePort(), HDB::RFPortImplementation::setOpcodePortWidthFormula(), 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.

Referenced by onOK().

◆ loadPort_

wxString RFPortImplementationDialog::loadPort_
private

Definition at line 77 of file RFPortImplementationDialog.hh.

Referenced by onOK().

◆ name_

wxString RFPortImplementationDialog::name_
private

Definition at line 76 of file RFPortImplementationDialog.hh.

Referenced by onOK().

◆ opcodePort_

wxString RFPortImplementationDialog::opcodePort_
private

Definition at line 78 of file RFPortImplementationDialog.hh.

Referenced by onOK().

◆ opcodePortWidth_

wxString RFPortImplementationDialog::opcodePortWidth_
private

Definition at line 79 of file RFPortImplementationDialog.hh.

Referenced by onOK().

◆ port_

HDB::RFPortImplementation& RFPortImplementationDialog::port_
private

FU port implementation to modify.

Definition at line 74 of file RFPortImplementationDialog.hh.

Referenced by onOK().


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