33 #include <wx/valgen.h>
34 #include <wx/statline.h>
44 #if wxCHECK_VERSION(3, 0, 0)
45 #define wxOPEN wxFD_OPEN
46 #define wxFILE_MUST_EXIST wxFD_FILE_MUST_EXIST
60 ("asic_130nm_1.5V.hdb");
73 wxDialog(parent, -1, _T("Auto Select Implementations"), wxDefaultPosition),
77 createContents(
this,
true,
true);
79 hdbChoice_ =
dynamic_cast<wxChoice*
>(
FindWindow(ID_HDB_CHOICE));
80 cboxRF_ =
dynamic_cast<wxCheckBox*
>(
FindWindow(ID_RF));
81 cboxIU_ =
dynamic_cast<wxCheckBox*
>(
FindWindow(ID_IU));
82 cboxFU_ =
dynamic_cast<wxCheckBox*
>(
FindWindow(ID_FU));
85 cboxRF_->SetValue(
true);
86 cboxIU_->SetValue(
true);
87 cboxFU_->SetValue(
true);
92 for (
int i = 0; i < registry.
hdbCount(); i++) {
93 hdbs_.insert(registry.
hdbPath(i));
96 std::set<TCEString>::iterator iter = hdbs_.begin();
97 bool defaultHDBFound =
false;
99 for (; iter != hdbs_.end(); iter++) {
103 selection = hdbChoice_->GetCount() - 1;
104 defaultHDBFound =
true;
107 hdbChoice_->SetSelection(selection);
124 this, _T(
"Choose a HDB file containing the implementation"),
125 _T(
""), _T(
""), _T(
"HDBs|*.hdb|All files|*.*"),
126 (wxOPEN | wxFILE_MUST_EXIST));
128 if (dialog.ShowModal() == wxID_OK) {
129 std::string hdb = std::string(dialog.GetPath().mb_str());
132 int item = hdbChoice_->FindString(wxHDB);
133 if (item == wxNOT_FOUND) {
134 item = hdbChoice_->Append(wxHDB);
136 hdbChoice_->Select(item);
163 if (!cboxRF_->GetValue() && !cboxIU_->GetValue() && !cboxFU_->GetValue()) {
172 wxString message = _T(
"Error: path ");
174 message.append(_T(
" could not be found!\n"));
182 HDBManager& hdb = HDBRegistry::instance().hdb(path);
184 if (cboxRF_->GetValue()) {
185 findRFImplementations(hdb);
187 if (cboxIU_->GetValue()) {
188 findIUImplementations(hdb);
190 if (cboxFU_->GetValue()) {
191 findFUImplementations(hdb);
194 wxString message = _T(
"");
201 unsigned int rfCount =
static_cast<unsigned int>(foundRF_.size());
202 unsigned int iuCount =
static_cast<unsigned int>(foundIU_.size());
203 unsigned int fuCount =
static_cast<unsigned int>(foundFU_.size());
206 wxString message = _T(
"");
208 message.append(_T(
" implementations were found for "));
209 if (cboxRF_->GetValue()) {
210 message.append(_T(
"RF ("));
212 message.append(_T(
")"));
214 if (cboxIU_->GetValue()) {
215 if (cboxRF_->GetValue()) {
216 message.append(_T(
" / "));
218 message.append(_T(
"IU ("));
220 message.append(_T(
")"));
222 if (cboxFU_->GetValue()) {
223 if (cboxIU_->GetValue() || cboxRF_->GetValue()) {
224 message.append(_T(
" / "));
226 message.append(_T(
"FU ("));
228 message.append(_T(
")"));
230 message.append(_T(
" units that have no implementations yet.\n\n"));
233 if ((rfCount+iuCount+fuCount) == 0) {
239 message.append(_T(
"Press Yes to integrate found implementations into"));
240 message.append(_T(
" the empty units.\n"));
244 if (dialog.ShowModal() != wxID_YES) {
252 std::map<const RFImplementationLocation*, HdbIdPair>::iterator itRF;
253 for (itRF = foundRF_.begin(); itRF != foundRF_.end(); ++itRF) {
259 impl_.addRFImplementation(rf);
265 std::map<const RFImplementationLocation*, HdbIdPair>::iterator itIU;
266 for (itIU = foundIU_.begin(); itIU != foundIU_.end(); ++itIU) {
272 impl_.addIUImplementation(iu);
278 std::map<const FUImplementationLocation*, HdbIdPair>::iterator itFU;
279 for (itFU = foundFU_.begin(); itFU != foundFU_.end(); ++itFU) {
285 impl_.addFUImplementation(fu);
292 wxCommandEvent
dummy;
310 std::map<const RFImplementationLocation*, CostEstimates*> rfImpls;
311 std::map<const RFImplementationLocation*, CostEstimates*>::iterator it;
314 int rfCount = machine_.registerFileNavigator().count();
315 for (
int i = 0; i < rfCount; ++i) {
316 Component* comp = machine_.registerFileNavigator().item(i);
320 if (rf != NULL && !impl_.hasRFImplementation(rf->
name())) {
323 it = rfImpls.begin();
326 if (rfImpls.size() > 0 && it->first != NULL) {
330 locationInfo.
id = location->
id();
333 std::pair<const RFImplementationLocation*, HdbIdPair>(
334 location, locationInfo));
356 std::map<const RFImplementationLocation*, CostEstimates*> iuImpls;
357 std::map<const RFImplementationLocation*, CostEstimates*>::iterator it;
360 int iuCount = machine_.immediateUnitNavigator().count();
361 for (
int i = 0; i < iuCount; ++i) {
362 Component* comp = machine_.immediateUnitNavigator().item(i);
366 if (iu != NULL && !impl_.hasIUImplementation(iu->
name())) {
369 it = iuImpls.begin();
372 if (iuImpls.size() > 0 && it->first != NULL) {
376 locationInfo.
id = location->
id();
379 std::pair<const RFImplementationLocation*, HdbIdPair>(
380 location, locationInfo));
402 std::map<const FUImplementationLocation*, CostEstimates*> fuImpls;
403 std::map<const FUImplementationLocation*, CostEstimates*>::iterator it;
406 int fuCount = machine_.functionUnitNavigator().count();
407 for (
int i = 0; i < fuCount; ++i) {
408 Component* comp = machine_.functionUnitNavigator().item(i);
412 if (fu != NULL && !impl_.hasFUImplementation(fu->
name())) {
415 it = fuImpls.begin();
418 if (fuImpls.size() > 0 && it->first != NULL) {
422 locationInfo.
id = location->
id();
425 std::pair<const FUImplementationLocation*, HdbIdPair>(
426 location, locationInfo));
443 wxFlexGridSizer *item0 =
new wxFlexGridSizer( 1, 0, 0 );
444 item0->AddGrowableCol( 0 );
445 item0->AddGrowableRow( 1 );
447 wxBoxSizer *item1 =
new wxBoxSizer( wxHORIZONTAL );
449 wxStaticText *itemText =
new wxStaticText( parent, ID_TEXT, wxT(
"HDB file:"), wxDefaultPosition, wxDefaultSize, 0 );
450 item1->Add( itemText, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
452 wxString *strs2 = (wxString*) NULL;
453 wxChoice *item2 =
new wxChoice( parent, ID_HDB_CHOICE, wxDefaultPosition, wxSize(250,-1), 0, strs2, 0 );
454 item1->Add( item2, 0, wxALIGN_CENTER|wxALL, 5 );
456 wxButton *item3 =
new wxButton( parent, ID_BROWSE, wxT(
"Browse..."), wxDefaultPosition, wxDefaultSize, 0 );
457 item1->Add( item3, 0, wxALIGN_CENTER|wxALL, 5 );
459 wxButton *buttonFind =
new wxButton( parent, ID_FIND, wxT(
"Find"), wxDefaultPosition, wxDefaultSize, 0 );
460 item1->Add( buttonFind, 0, wxALIGN_CENTER|wxALL, 5 );
462 item0->Add( item1, 0, wxALIGN_CENTER|wxALL, 5 );
464 wxBoxSizer *cboxSizer =
new wxBoxSizer( wxHORIZONTAL );
466 wxStaticText *cboxText =
new wxStaticText( parent, ID_TEXT, wxT(
"Do selections for:"), wxDefaultPosition, wxDefaultSize, 0 );
467 cboxSizer->Add( cboxText, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
469 wxCheckBox *cboxRF =
new wxCheckBox( parent, ID_RF, wxT(
"Register Files"), wxDefaultPosition, wxDefaultSize, 0 );
470 cboxSizer->Add( cboxRF, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
472 wxCheckBox *cboxIU =
new wxCheckBox( parent, ID_IU, wxT(
"Immediate Units"), wxDefaultPosition, wxDefaultSize, 0 );
473 cboxSizer->Add( cboxIU, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
475 wxCheckBox *cboxFU =
new wxCheckBox( parent, ID_FU, wxT(
"Function Units"), wxDefaultPosition, wxDefaultSize, 0 );
476 cboxSizer->Add( cboxFU, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
478 item0->Add( cboxSizer, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
480 wxStaticLine *item5 =
new wxStaticLine( parent, ID_LINE, wxDefaultPosition, wxSize(20,-1), wxLI_HORIZONTAL );
481 item0->Add( item5, 0, wxGROW|wxALL, 5 );
483 wxBoxSizer *item6 =
new wxBoxSizer( wxHORIZONTAL );
485 wxButton *closeButton =
new wxButton( parent, ID_CLOSE, wxT(
"Close"), wxDefaultPosition, wxDefaultSize, 0 );
486 item6->Add( closeButton, 0, wxALIGN_CENTER|wxALL, 5 );
488 item0->Add( item6, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
493 parent->SetSizer( item0 );
495 item0->SetSizeHints( parent );