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

#include <FUPortImplementationDialog.hh>

Inheritance diagram for FUPortImplementationDialog:
Inheritance graph
Collaboration diagram for FUPortImplementationDialog:
Collaboration graph

Public Member Functions

 FUPortImplementationDialog (wxWindow *parent, wxWindowID id, HDB::FUPortImplementation &implementation, const TTAMachine::BaseFUPort &architecture)
 
virtual ~FUPortImplementationDialog ()
 
virtual bool TransferDataToWindow ()
 

Private Types

enum  {
  ID_LABEL_NAME = 10000 , ID_NAME , ID_LABEL_ARCHITECTURE_PORT , ID_ARCHITECTURE_PORT_NAME ,
  ID_LABEL_WIDTH , ID_WIDTH , ID_LOAD_PORT_LABEL , ID_LOAD_PORT ,
  ID_GUARD_PORT_LABEL , ID_GUARD_PORT , ID_OPERAND_LIST , 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::FUPortImplementationimplementation_
 FU port implementation to modify.
 
const TTAMachine::BaseFUPortarchitecture_
 Architecture of the modified port.
 
wxString name_
 Name of the port.
 
wxString loadPortName_
 Name of the load port.
 
wxString guardPortName_
 Name of the guard port.
 
wxString widthFormula_
 Width formula string.
 
wxListCtrl * operandList_
 List widget for the operand bindings.
 

Detailed Description

Dialog for editing FU port implementations.

Definition at line 49 of file FUPortImplementationDialog.hh.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private

Enumerated IDs for dialog widgets.

Enumerator
ID_LABEL_NAME 
ID_NAME 
ID_LABEL_ARCHITECTURE_PORT 
ID_ARCHITECTURE_PORT_NAME 
ID_LABEL_WIDTH 
ID_WIDTH 
ID_LOAD_PORT_LABEL 
ID_LOAD_PORT 
ID_GUARD_PORT_LABEL 
ID_GUARD_PORT 
ID_OPERAND_LIST 
ID_LINE 

Definition at line 63 of file FUPortImplementationDialog.hh.

Constructor & Destructor Documentation

◆ FUPortImplementationDialog()

FUPortImplementationDialog::FUPortImplementationDialog ( wxWindow *  parent,
wxWindowID  id,
HDB::FUPortImplementation implementation,
const TTAMachine::BaseFUPort architecture 
)

The Constructor.

Parameters
parentParent window of the dialog.
idWindow identifier for the dialog window.
implementationFU port implementation to modify.
architecthreArchitecture of the modified port.

Definition at line 61 of file FUPortImplementationDialog.cc.

63 :
64 wxDialog(parent, id, _T("Function Unit Port Implementation"),
65 wxDefaultPosition),
67
68 createContents(this, true, true);
69
70 operandList_ = dynamic_cast<wxListCtrl*>(FindWindow(ID_OPERAND_LIST));
71 assert(operandList_ != NULL);
72 operandList_->InsertColumn(
73 0, _T("Operation"), wxLIST_FORMAT_LEFT, 140);
74
75 operandList_->InsertColumn(
76 1, _T("R/W"), wxLIST_FORMAT_LEFT, 60);
77
78 operandList_->InsertColumn(
79 2, _T("io"), wxLIST_FORMAT_LEFT, 60);
80
84
87
90
91 FindWindow(ID_NAME)->SetValidator(wxTextValidator(wxFILTER_ASCII, &name_));
92 FindWindow(ID_LOAD_PORT)->SetValidator(
93 wxTextValidator(wxFILTER_ASCII, &loadPortName_));
94 FindWindow(ID_GUARD_PORT)->SetValidator(
95 wxTextValidator(wxFILTER_ASCII, &guardPortName_));
96 FindWindow(ID_WIDTH)->SetValidator(
97 wxTextValidator(wxFILTER_ASCII, &widthFormula_));
98
99 dynamic_cast<wxStaticText*>(FindWindow(ID_ARCHITECTURE_PORT_NAME))->
101
103}
#define assert(condition)
IDF::MachineImplementation * implementation
the implementation definition of the estimated processor
wxSizer * createContents(wxWindow *parent, bool call_fit, bool set_sizer)
Creates the dialog contents.
wxListCtrl * operandList_
List widget for the operand bindings.
wxString widthFormula_
Width formula string.
const TTAMachine::BaseFUPort & architecture_
Architecture of the modified port.
HDB::FUPortImplementation & implementation_
FU port implementation to modify.
wxString guardPortName_
Name of the guard port.
wxString loadPortName_
Name of the load port.
std::string architecturePort() const
std::string loadPort() const
static wxString toWxString(const std::string &source)

References assert, and WxConversion::toWxString().

Here is the call graph for this function:

◆ ~FUPortImplementationDialog()

FUPortImplementationDialog::~FUPortImplementationDialog ( )
virtual

The Destructor.

Definition at line 108 of file FUPortImplementationDialog.cc.

108 {
109}

Member Function Documentation

◆ createContents()

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

Creates the dialog contents.

Creates the dialog contents.

Definition at line 199 of file FUPortImplementationDialog.cc.

200 {
201
202 wxBoxSizer *item0 = new wxBoxSizer( wxVERTICAL );
203
204 wxBoxSizer *item1 = new wxBoxSizer( wxVERTICAL );
205
206 wxFlexGridSizer *item2 = new wxFlexGridSizer( 2, 0, 0 );
207
208 wxStaticText *item3 = new wxStaticText( parent, ID_LABEL_ARCHITECTURE_PORT, wxT("Architecture port:"), wxDefaultPosition, wxDefaultSize, 0 );
209 item2->Add( item3, 0, wxALIGN_RIGHT|wxALL, 5 );
210
211 wxStaticText *item4 = new wxStaticText( parent, ID_ARCHITECTURE_PORT_NAME, wxT(""), wxDefaultPosition, wxDefaultSize, 0 );
212 item2->Add( item4, 0, wxGROW|wxALL, 5 );
213
214 wxStaticText *item5 = new wxStaticText( parent, ID_LABEL_NAME, wxT("Name:"), wxDefaultPosition, wxDefaultSize, 0 );
215 item2->Add( item5, 0, wxALIGN_RIGHT|wxALL, 5 );
216
217 wxTextCtrl *item6 = new wxTextCtrl( parent, ID_NAME, wxT(""), wxDefaultPosition, wxSize(200,-1), 0 );
218 item2->Add( item6, 0, wxALIGN_CENTER|wxALL, 5 );
219
220 wxStaticText *item7 = new wxStaticText( parent, ID_LOAD_PORT_LABEL, wxT("Load port:"), wxDefaultPosition, wxDefaultSize, 0 );
221 item2->Add( item7, 0, wxALIGN_RIGHT|wxALL, 5 );
222
223 wxTextCtrl *item8 = new wxTextCtrl( parent, ID_LOAD_PORT, wxT(""), wxDefaultPosition, wxSize(80,-1), 0 );
224 item2->Add( item8, 0, wxGROW|wxALL, 5 );
225
226 wxStaticText *item9 = new wxStaticText( parent, ID_GUARD_PORT_LABEL, wxT("Guard port:"), wxDefaultPosition, wxDefaultSize, 0 );
227 item2->Add( item9, 0, wxALIGN_RIGHT|wxALL, 5 );
228
229 wxTextCtrl *item10 = new wxTextCtrl( parent, ID_GUARD_PORT, wxT(""), wxDefaultPosition, wxSize(200,-1), 0 );
230 item2->Add( item10, 0, wxALIGN_CENTER|wxALL, 5 );
231
232 wxStaticText *item11 = new wxStaticText( parent, ID_LABEL_WIDTH, wxT("Width formula:"), wxDefaultPosition, wxDefaultSize, 0 );
233 item2->Add( item11, 0, wxALIGN_CENTER|wxALL, 5 );
234
235 wxTextCtrl *item12 = new wxTextCtrl( parent, ID_WIDTH, wxT(""), wxDefaultPosition, wxSize(80,-1), 0 );
236 item2->Add( item12, 0, wxGROW|wxALL, 5 );
237
238 item1->Add( item2, 0, wxALIGN_CENTER|wxALL, 5 );
239
240 wxStaticBox *item14 = new wxStaticBox( parent, -1, wxT("Operand bindings:") );
241 wxStaticBoxSizer *item13 = new wxStaticBoxSizer( item14, wxVERTICAL );
242
243 wxListCtrl *item15 = new wxListCtrl( parent, ID_OPERAND_LIST, wxDefaultPosition, wxSize(200,120), wxLC_REPORT|wxSUNKEN_BORDER );
244 item13->Add( item15, 0, wxGROW|wxALL, 5 );
245
246 item1->Add( item13, 0, wxGROW|wxALL, 5 );
247
248 item0->Add( item1, 0, wxALIGN_CENTER|wxALL, 5 );
249
250 wxStaticLine *item16 = new wxStaticLine( parent, ID_LINE, wxDefaultPosition, wxSize(20,-1), wxLI_HORIZONTAL );
251 item0->Add( item16, 0, wxGROW|wxALL, 5 );
252
253 wxBoxSizer *item17 = new wxBoxSizer( wxHORIZONTAL );
254
255 wxButton *item18 = new wxButton( parent, wxID_CANCEL, wxT("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
256 item17->Add( item18, 0, wxALIGN_CENTER, 5 );
257
258 wxButton *item19 = new wxButton( parent, wxID_OK, wxT("&OK"), wxDefaultPosition, wxDefaultSize, 0 );
259 item17->Add( item19, 0, wxALIGN_CENTER|wxALL, 5 );
260
261 item0->Add( item17, 0, wxALL, 5 );
262
263 if (set_sizer)
264 {
265 parent->SetSizer( item0 );
266 if (call_fit)
267 item0->SetSizeHints( parent );
268 }
269
270 return item0;
271}

References ID_ARCHITECTURE_PORT_NAME, ID_GUARD_PORT, ID_GUARD_PORT_LABEL, ID_LABEL_ARCHITECTURE_PORT, ID_LABEL_NAME, ID_LABEL_WIDTH, ID_LINE, ID_LOAD_PORT, ID_LOAD_PORT_LABEL, ID_NAME, ID_OPERAND_LIST, and ID_WIDTH.

◆ onOK()

void FUPortImplementationDialog::onOK ( wxCommandEvent &  event)
private

Event handler for the dialog OK-button.

Definition at line 164 of file FUPortImplementationDialog.cc.

164 {
165
166 TransferDataFromWindow();
167
168 name_ = name_.Trim(true).Trim(false);
169 loadPortName_ = loadPortName_.Trim(true).Trim(false);
170 guardPortName_ = guardPortName_.Trim(true).Trim(false);
171 widthFormula_ = widthFormula_.Trim(true).Trim(false);
172
173 if (name_.IsEmpty()) {
174 wxString message = _T("Name field must not be empty.");
175 ErrorDialog dialog(this, message);
176 dialog.ShowModal();
177 return;
178 }
179
180 if (widthFormula_.IsEmpty()) {
181 wxString message = _T("Width formula field must not be empty.");
182 ErrorDialog dialog(this, message);
183 dialog.ShowModal();
184 return;
185 }
186
191
192 EndModal(wxID_OK);
193}
void setWidthFormula(const std::string &formula)
void setGuardPort(const std::string &name)
void setLoadPort(const std::string &name)
void setName(const std::string &name)
static std::string toString(const wxString &source)

References guardPortName_, implementation_, loadPortName_, name_, HDB::FUPortImplementation::setGuardPort(), HDB::PortImplementation::setLoadPort(), HDB::PortImplementation::setName(), HDB::FUPortImplementation::setWidthFormula(), WxConversion::toString(), and widthFormula_.

Here is the call graph for this function:

◆ TransferDataToWindow()

bool FUPortImplementationDialog::TransferDataToWindow ( )
virtual

Transfers data from the dialog attributes to the dialog widgets.

Returns
True, if the data was succesfully transferred.

Definition at line 118 of file FUPortImplementationDialog.cc.

118 {
119
120 operandList_->DeleteAllItems();
122 const FUPort* fuPort = dynamic_cast<const FUPort*>(&architecture_);
123 assert(fu != NULL);
124 int item = 0;
125 for (int i = 0; i < fu->operationCount(); i++) {
126 const HWOperation* operation = fu->operation(i);
127 if (fuPort != NULL && operation->isBound(*fuPort)) {
128 wxString rw;
129 bool read = false;
130 bool written = false;
131 for (int cycle = 0; cycle < operation->latency(); cycle++) {
132 if (operation->pipeline()->isPortRead(*fuPort, cycle)) {
133 read = true;
134 }
135 if (operation->pipeline()->isPortWritten(*fuPort, cycle)) {
136 written = true;
137 }
138 }
139 if (read) {
140 rw.Append(_T("R"));
141 }
142 if (written) {
143 rw.Append(_T("W"));
144 }
145 operandList_->InsertItem(
146 item, WxConversion::toWxString(operation->name()));
147
148 operandList_->SetItem(item, 1, rw);
149
150 operandList_->SetItem(
151 item, 2, WxConversion::toWxString(operation->io(*fuPort)));
152
153 item++;
154 }
155 }
156
157 return wxDialog::TransferDataToWindow();
158}
FunctionUnit * parentUnit() const
Definition BaseFUPort.cc:96
bool isPortWritten(const FUPort &port, int cycle) const
bool isPortRead(const FUPort &port, int cycle) const
virtual HWOperation * operation(const std::string &name) const
virtual int operationCount() const
ExecutionPipeline * pipeline() const
int io(const FUPort &port) const
const std::string & name() const
bool isBound(const FUPort &port) const

References architecture_, assert, TTAMachine::HWOperation::io(), TTAMachine::HWOperation::isBound(), TTAMachine::ExecutionPipeline::isPortRead(), TTAMachine::ExecutionPipeline::isPortWritten(), TTAMachine::HWOperation::latency(), TTAMachine::HWOperation::name(), operandList_, TTAMachine::FunctionUnit::operation(), TTAMachine::FunctionUnit::operationCount(), TTAMachine::BaseFUPort::parentUnit(), TTAMachine::HWOperation::pipeline(), and WxConversion::toWxString().

Here is the call graph for this function:

Member Data Documentation

◆ architecture_

const TTAMachine::BaseFUPort& FUPortImplementationDialog::architecture_
private

Architecture of the modified port.

Definition at line 84 of file FUPortImplementationDialog.hh.

Referenced by TransferDataToWindow().

◆ guardPortName_

wxString FUPortImplementationDialog::guardPortName_
private

Name of the guard port.

Definition at line 91 of file FUPortImplementationDialog.hh.

Referenced by onOK().

◆ implementation_

HDB::FUPortImplementation& FUPortImplementationDialog::implementation_
private

FU port implementation to modify.

Definition at line 82 of file FUPortImplementationDialog.hh.

Referenced by onOK().

◆ loadPortName_

wxString FUPortImplementationDialog::loadPortName_
private

Name of the load port.

Definition at line 89 of file FUPortImplementationDialog.hh.

Referenced by onOK().

◆ name_

wxString FUPortImplementationDialog::name_
private

Name of the port.

Definition at line 87 of file FUPortImplementationDialog.hh.

Referenced by onOK().

◆ operandList_

wxListCtrl* FUPortImplementationDialog::operandList_
private

List widget for the operand bindings.

Definition at line 96 of file FUPortImplementationDialog.hh.

Referenced by TransferDataToWindow().

◆ widthFormula_

wxString FUPortImplementationDialog::widthFormula_
private

Width formula string.

Definition at line 93 of file FUPortImplementationDialog.hh.

Referenced by onOK().


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