35 #include <boost/format.hpp>
36 #include <wx/statline.h>
37 #include <wx/listctrl.h>
39 #include <wx/textctrl.h>
40 #include <wx/imaglist.h>
41 #include <wx/srchctrl.h>
63 #if !wxCHECK_VERSION(3, 0, 0)
90 int sortColumn = (int)sortData;
92 if (sortColumn == 0) {
94 }
else if (sortColumn == 1) {
96 }
else if (sortColumn == 3) {
98 }
else if (sortColumn == 4) {
110 int sortColumn = (int)sortData;
112 if (sortColumn == 0) {
114 }
else if (sortColumn == 1) {
116 }
else if (sortColumn == 3) {
118 }
else if (sortColumn == 4) {
135 parent, -1, _T(
"HDB Function Units"),
136 wxDefaultPosition, wxDefaultSize,
137 wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER),
139 filterTimer_(this, ID_FILTER_TIMER),
140 sortColumn_(1), sortASC_(true) {
147 list_->InsertColumn(0, _T(
"Latency"), wxLIST_FORMAT_LEFT, wxLIST_AUTOSIZE);
149 1, _T(
"Operations"), wxLIST_FORMAT_LEFT, wxLIST_AUTOSIZE);
150 list_->InsertColumn(2, _T(
"Impls"), wxLIST_FORMAT_LEFT, wxLIST_AUTOSIZE);
151 list_->InsertColumn(3, _T(
"HDB ID"), wxLIST_FORMAT_LEFT, wxLIST_AUTOSIZE);
152 list_->InsertColumn(4, _T(
"HDB"), wxLIST_FORMAT_LEFT, wxLIST_AUTOSIZE);
157 wxImageList* imageList =
new wxImageList(13, 17);
158 imageList->Add(wxIcon(
160 imageList->Add(wxIcon(
162 list_->SetImageList(imageList, wxIMAGE_LIST_SMALL);
184 list_->DeleteAllItems();
188 std::istringstream rawFilterRules(tmp.c_str());
191 while (rawFilterRules >> keyword) {
199 for (
int i = 0; i < registry.
hdbCount(); i++) {
206 message.Append(_T(
"\n"));
212 wxString message = _T(
"No HDBs found in HDB search paths.");
217 list_->SetColumnWidth(1, 200);
218 list_->SetColumnWidth(4, wxLIST_AUTOSIZE);
219 return wxDialog::TransferDataToWindow();
232 std::set<RowID>::iterator iter = fuArchIDs.begin();
234 std::string path = manager.
fileName();
238 for (; iter != fuArchIDs.end(); iter++) {
248 std::pair<int, FUArchitecture*>(
list_->GetItemCount(), arch));
252 list_->InsertItem(0, _T(
""));
259 operations.Append(_T(
", "));
263 operations.Append(_T(
"("));
266 operations.Append(_T(
")"));
276 if (maxLatency != minLatency) {
277 latency.Append(_T(
".."));
281 list_->SetItem(0, 0, latency);
283 list_->SetItem(0, 1, operations);
290 lid->
id =
list_->GetItemCount() - 1;
291 list_->SetItemData(0, (
long)lid);
309 const std::string hdbFilePath,
311 const std::vector<std::string>& filterList) {
313 if (filterList.empty()) {
324 archStr += oper.
name()
329 for (
auto& c : archStr) c = tolower(c);
331 for (
const string& keyword : filterList) {
332 if (keyword.size() > 0 && keyword.front() ==
'!') {
333 if (keyword.size() < 2) {
335 }
else if (archStr.find(keyword.substr(1)) != std::string::npos ||
336 hdbFilePath.find(keyword.substr(1)) != std::string::npos) {
339 }
else if (archStr.find(keyword) == std::string::npos &&
340 hdbFilePath.find(keyword) == std::string::npos) {
375 if (
list_->GetSelectedItemCount() == 1) {
390 item =
list_->GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
391 if ( item == -1 )
return;
407 wxString message = _T(
"Error while adding function unit:\n");
419 for (
int p = 0; p < fu->
portCount(); p++) {
428 for (
int cycle = 0; cycle < operation->
latency(); cycle++) {
429 if (pipeline->
isPortRead(*port, cycle)) read =
true;
435 std::string portName =
"";
450 portName = portName +
"t";
459 if (i > 0) name +=
"_";
464 std::string fuName = name;
497 wxWindow *parent,
bool call_fit,
bool set_sizer) {
499 wxFlexGridSizer *item0 =
new wxFlexGridSizer( 1, 0, 0 );
500 item0->AddGrowableCol( 0 );
501 item0->AddGrowableRow( 0 );
503 wxListCtrl *item1 =
new wxListCtrl( parent,
ID_LIST, wxDefaultPosition, wxSize(160,120), wxLC_REPORT|wxSUNKEN_BORDER );
504 item0->Add( item1, 0, wxGROW|wxALL, 5 );
509 wxT(
"Filter operations or HDBs. '!PATTERN' to exclude."));
512 wxButton *item2 =
new wxButton( parent,
ID_ADD, wxT(
"&Add"), wxDefaultPosition, wxDefaultSize, 0 );
513 item0->Add( item2, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
515 wxStaticLine *item3 =
new wxStaticLine( parent,
ID_LINE, wxDefaultPosition, wxSize(20,-1), wxLI_HORIZONTAL );
516 item0->Add( item3, 0, wxGROW|wxALL, 5 );
518 wxButton *item4 =
new wxButton( parent,
ID_CLOSE, wxT(
"&Close"), wxDefaultPosition, wxDefaultSize, 0 );
519 item0->Add( item4, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
522 parent->SetSizer( item0 );
524 item0->SetSizeHints( parent );
538 int clickedColumn =
event.GetColumn();
567 item.SetMask(wxLIST_MASK_IMAGE);
568 item.SetImage(image);
569 list_->SetColumn(col, item);