33 #include <wx/statline.h>
34 #include <wx/valgen.h>
35 #include <wx/listctrl.h>
64 wxDialog(parent,
id, _T("Function
Unit Port Implementation"),
68 createContents(
this,
true,
true);
70 operandList_ =
dynamic_cast<wxListCtrl*
>(
FindWindow(ID_OPERAND_LIST));
71 assert(operandList_ != NULL);
72 operandList_->InsertColumn(
73 0, _T(
"Operation"), wxLIST_FORMAT_LEFT, 140);
75 operandList_->InsertColumn(
76 1, _T(
"R/W"), wxLIST_FORMAT_LEFT, 60);
78 operandList_->InsertColumn(
79 2, _T(
"io"), wxLIST_FORMAT_LEFT, 60);
83 implementation_.loadPort());
86 implementation_.guardPort());
89 implementation_.widthFormula());
91 FindWindow(ID_NAME)->SetValidator(wxTextValidator(wxFILTER_ASCII, &name_));
93 wxTextValidator(wxFILTER_ASCII, &loadPortName_));
95 wxTextValidator(wxFILTER_ASCII, &guardPortName_));
97 wxTextValidator(wxFILTER_ASCII, &widthFormula_));
99 dynamic_cast<wxStaticText*
>(
FindWindow(ID_ARCHITECTURE_PORT_NAME))->
102 TransferDataToWindow();
120 operandList_->DeleteAllItems();
122 const FUPort* fuPort =
dynamic_cast<const FUPort*
>(&architecture_);
127 if (fuPort != NULL && operation->
isBound(*fuPort)) {
130 bool written =
false;
131 for (
int cycle = 0; cycle < operation->
latency(); cycle++) {
145 operandList_->InsertItem(
148 operandList_->SetItem(item, 1, rw);
150 operandList_->SetItem(
157 return wxDialog::TransferDataToWindow();
166 TransferDataFromWindow();
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);
173 if (name_.IsEmpty()) {
174 wxString message = _T(
"Name field must not be empty.");
180 if (widthFormula_.IsEmpty()) {
181 wxString message = _T(
"Width formula field must not be empty.");
200 wxWindow *parent,
bool call_fit,
bool set_sizer) {
202 wxBoxSizer *item0 =
new wxBoxSizer( wxVERTICAL );
204 wxBoxSizer *item1 =
new wxBoxSizer( wxVERTICAL );
206 wxFlexGridSizer *item2 =
new wxFlexGridSizer( 2, 0, 0 );
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 );
211 wxStaticText *item4 =
new wxStaticText( parent, ID_ARCHITECTURE_PORT_NAME, wxT(
""), wxDefaultPosition, wxDefaultSize, 0 );
212 item2->Add( item4, 0, wxGROW|wxALL, 5 );
214 wxStaticText *item5 =
new wxStaticText( parent, ID_LABEL_NAME, wxT(
"Name:"), wxDefaultPosition, wxDefaultSize, 0 );
215 item2->Add( item5, 0, wxALIGN_RIGHT|wxALL, 5 );
217 wxTextCtrl *item6 =
new wxTextCtrl( parent, ID_NAME, wxT(
""), wxDefaultPosition, wxSize(200,-1), 0 );
218 item2->Add( item6, 0, wxALIGN_CENTER|wxALL, 5 );
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 );
223 wxTextCtrl *item8 =
new wxTextCtrl( parent, ID_LOAD_PORT, wxT(
""), wxDefaultPosition, wxSize(80,-1), 0 );
224 item2->Add( item8, 0, wxGROW|wxALL, 5 );
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 );
229 wxTextCtrl *item10 =
new wxTextCtrl( parent, ID_GUARD_PORT, wxT(
""), wxDefaultPosition, wxSize(200,-1), 0 );
230 item2->Add( item10, 0, wxALIGN_CENTER|wxALL, 5 );
232 wxStaticText *item11 =
new wxStaticText( parent, ID_LABEL_WIDTH, wxT(
"Width formula:"), wxDefaultPosition, wxDefaultSize, 0 );
233 item2->Add( item11, 0, wxALIGN_CENTER|wxALL, 5 );
235 wxTextCtrl *item12 =
new wxTextCtrl( parent, ID_WIDTH, wxT(
""), wxDefaultPosition, wxSize(80,-1), 0 );
236 item2->Add( item12, 0, wxGROW|wxALL, 5 );
238 item1->Add( item2, 0, wxALIGN_CENTER|wxALL, 5 );
240 wxStaticBox *item14 =
new wxStaticBox( parent, -1, wxT(
"Operand bindings:") );
241 wxStaticBoxSizer *item13 =
new wxStaticBoxSizer( item14, wxVERTICAL );
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 );
246 item1->Add( item13, 0, wxGROW|wxALL, 5 );
248 item0->Add( item1, 0, wxALIGN_CENTER|wxALL, 5 );
250 wxStaticLine *item16 =
new wxStaticLine( parent, ID_LINE, wxDefaultPosition, wxSize(20,-1), wxLI_HORIZONTAL );
251 item0->Add( item16, 0, wxGROW|wxALL, 5 );
253 wxBoxSizer *item17 =
new wxBoxSizer( wxHORIZONTAL );
255 wxButton *item18 =
new wxButton( parent, wxID_CANCEL, wxT(
"&Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
256 item17->Add( item18, 0, wxALIGN_CENTER, 5 );
258 wxButton *item19 =
new wxButton( parent, wxID_OK, wxT(
"&OK"), wxDefaultPosition, wxDefaultSize, 0 );
259 item17->Add( item19, 0, wxALIGN_CENTER|wxALL, 5 );
261 item0->Add( item17, 0, wxALL, 5 );
265 parent->SetSizer( item0 );
267 item0->SetSizeHints( parent );