66 : wxDialog(NULL, -1, "Add
Operation Implementation", wxDefaultPosition,
67 wxSize(700, 900), wxRESIZE_BORDER) {
68 wxBoxSizer* vbox =
new wxBoxSizer(wxVERTICAL);
69 wxBoxSizer* hbox1 =
new wxBoxSizer(wxHORIZONTAL);
71 wxButton* okButton =
new wxButton(
72 this, wxID_OK, wxT(
"Ok"), wxDefaultPosition, wxSize(70, 30));
73 wxButton* closeButton =
new wxButton(
74 this, wxID_CANCEL, wxT(
"Cancel"), wxDefaultPosition, wxSize(70, 30));
76 wxButton* addVHDLVariableButton =
77 new wxButton(
this, BUTTON_ADD_VHDL_VAR, wxT(
"Add"));
78 wxButton* addVerilogVariableButton =
79 new wxButton(
this, BUTTON_ADD_VERILOG_VAR, wxT(
"Add"));
81 wxButton* addButton =
new wxButton(
this, wxID_ADD, wxT(
""));
82 wxButton* delButton =
new wxButton(
this, wxID_DELETE, wxT(
""));
84 hbox1->Add(okButton, 1);
85 hbox1->Add(closeButton, 1, wxLEFT, 5);
87 wxFlexGridSizer* flex1 =
new wxFlexGridSizer(13, 2, 9, 25);
89 wxStaticText* title1 =
new wxStaticText(
this, -1, wxT(
"Name"));
90 wxStaticText* title2 =
91 new wxStaticText(
this, -1, wxT(
"VHDL Op Implementation file"));
92 wxStaticText* title3 =
93 new wxStaticText(
this, -1, wxT(
"Verilog Op Implementation file"));
94 wxStaticText* title21 =
95 new wxStaticText(
this, -1, wxT(
"VHDL Post-Op Implementation file"));
96 wxStaticText* title31 =
97 new wxStaticText(
this, -1, wxT(
"Verilog Post-Op Implementation file"));
98 wxStaticText* title_vhdl_init =
99 new wxStaticText(
this, -1, wxT(
"VHDL Initial Implementation file"));
100 wxStaticText* title_vlog_init =
101 new wxStaticText(
this, -1, wxT(
"Verilog Initial Implementation file"));
102 wxStaticText* title41 =
103 new wxStaticText(
this, -1, wxT(
"Optional IPXACT bus definition file"));
104 wxStaticText* title4 =
105 new wxStaticText(
this, -1, wxT(
"Selected resources"));
106 wxStaticText* title5 =
107 new wxStaticText(
this, -1, wxT(
"Selected resources"));
108 wxStaticText* title6 =
109 new wxStaticText(
this, -1, wxT(
"Add VHDL Variable"));
110 wxStaticText* title7 =
111 new wxStaticText(
this, -1, wxT(
"Add Verilog Variable"));
112 wxStaticText* title_latency =
new wxStaticText(
this, -1, wxT(
"Latency"));
114 nameCtrl_ =
new wxTextCtrl(
this, -1);
116 pick1_ =
new wxFilePickerCtrl(
this, BUTTON_MODEL_VHDL,
"",
117 "Select VHDL Op Implementation File",
"*.vhd;*.vhdl", wxDefaultPosition,
118 wxDefaultSize, wxFLP_OPEN | wxFLP_FILE_MUST_EXIST | wxFLP_SMALL);
119 pick2_ =
new wxFilePickerCtrl(
this, BUTTON_MODEL_VERILOG,
"",
120 "Select Verilog Op Implementation File",
"*.vh;*.v", wxDefaultPosition,
121 wxDefaultSize, wxFLP_OPEN | wxFLP_FILE_MUST_EXIST | wxFLP_SMALL);
122 pick11_ =
new wxFilePickerCtrl(
this, BUTTON_POSTMODEL_VHDL,
"",
123 "Select VHDL Post-Op Implementation File",
"*.vhd;*.vhdl", wxDefaultPosition,
124 wxDefaultSize, wxFLP_OPEN | wxFLP_FILE_MUST_EXIST | wxFLP_SMALL);
125 pick21_ =
new wxFilePickerCtrl(
this, BUTTON_POSTMODEL_VERILOG,
"",
126 "Select Verilog Post-Op Implementation File",
"*.vh;*.v", wxDefaultPosition,
127 wxDefaultSize, wxFLP_OPEN | wxFLP_FILE_MUST_EXIST | wxFLP_SMALL);
128 pick_vhdl_init_ =
new wxFilePickerCtrl(
this, BUTTON_INITIAL_VHDL,
"",
129 "Select VHDL Initial Implementation File",
"*.vhd;*.vhdl", wxDefaultPosition,
130 wxDefaultSize, wxFLP_OPEN | wxFLP_FILE_MUST_EXIST | wxFLP_SMALL);
131 pick_vlog_init_ =
new wxFilePickerCtrl(
this, BUTTON_INITIAL_VERILOG,
"",
132 "Select Verilog Initial Implementation File",
"*.vh;*.v", wxDefaultPosition,
133 wxDefaultSize, wxFLP_OPEN | wxFLP_FILE_MUST_EXIST | wxFLP_SMALL);
134 pick31_ =
new wxFilePickerCtrl(
this, BUTTON_IPXACT_ABSDEF,
"",
135 "Select IPXACT Bus Abstraction Definition File",
"*.xml", wxDefaultPosition,
136 wxDefaultSize, wxFLP_OPEN | wxFLP_FILE_MUST_EXIST | wxFLP_SMALL);
137 latencyWheel_ =
new wxSpinCtrl(
this);
140 flex1->Add(nameCtrl_, 1, wxEXPAND);
142 flex1->Add(pick1_, 1, wxEXPAND);
144 flex1->Add(pick2_, 1, wxEXPAND);
146 flex1->Add(pick11_, 1, wxEXPAND);
148 flex1->Add(pick21_, 1, wxEXPAND);
149 flex1->Add(title_vhdl_init);
150 flex1->Add(pick_vhdl_init_, 1, wxEXPAND);
151 flex1->Add(title_vlog_init);
152 flex1->Add(pick_vlog_init_, 1, wxEXPAND);
154 flex1->Add(pick31_, 1, wxEXPAND);
156 flex1->Add(addVHDLVariableButton, 1, wxEXPAND);
158 flex1->Add(addVerilogVariableButton, 1, wxEXPAND);
160 flex1->Add(addButton, 1, wxEXPAND);
162 flex1->Add(delButton, 1, wxEXPAND);
163 flex1->Add(title_latency);
164 flex1->Add(latencyWheel_, 1, wxEXPAND);
166 addedResourceList_ =
new wxListCtrl(
167 this, -1, wxDefaultPosition, wxDefaultSize, wxLC_REPORT);
168 addedResourceList_->AppendColumn(
169 "Added Resource", wxLIST_FORMAT_LEFT, 400);
170 addedResourceList_->AppendColumn(
"id", wxLIST_FORMAT_LEFT, 30);
171 addedResourceList_->AppendColumn(
"Count", wxLIST_FORMAT_LEFT, 120);
173 addedVariableList_ =
new wxListCtrl(
174 this, -1, wxDefaultPosition, wxDefaultSize, wxLC_REPORT);
175 addedVariableList_->AppendColumn(
176 "Added Variable", wxLIST_FORMAT_LEFT, 200);
177 addedVariableList_->AppendColumn(
"width", wxLIST_FORMAT_LEFT, 120);
178 addedVariableList_->AppendColumn(
"type", wxLIST_FORMAT_LEFT, 120);
179 addedVariableList_->AppendColumn(
"language", wxLIST_FORMAT_LEFT, 120);
181 availableResourceList_ =
new wxListCtrl(
182 this, -1, wxDefaultPosition, wxDefaultSize, wxLC_REPORT);
183 availableResourceList_->AppendColumn(
184 "Available Resource", wxLIST_FORMAT_LEFT, 170);
185 availableResourceList_->AppendColumn(
"id", wxLIST_FORMAT_LEFT, 30);
187 wxBoxSizer* hbox2 =
new wxBoxSizer(wxHORIZONTAL);
188 hbox2->Add(flex1, 1, wxALL | wxEXPAND, 15);
189 hbox2->Add(availableResourceList_, 1, wxALL | wxEXPAND, 15);
190 addAvailableResourcesToList();
192 vbox->Add(hbox2, 1, wxALL | wxEXPAND, 15);
193 vbox->Add(addedResourceList_, 1, wxALL | wxEXPAND, 15);
194 vbox->Add(addedVariableList_, 1, wxALL | wxEXPAND, 15);
195 vbox->Add(hbox1, 0, wxALIGN_CENTER | wxTOP | wxBOTTOM, 10);
206 std::set<RowID> resource_ids =
208 for (
const auto id : resource_ids) {
220 std::string es(path);
222 size_t i = s.rfind(
'/', s.length());
223 if (i != std::string::npos) {
224 s = s.substr(0, i + 1);
225 if (es.find(s) == 0) {
226 return es.substr(s.length());
238 if (operation.
name.length() < 1) {
240 wxT(
"Give the operation some name."), wxT(
"Error"), wxICON_ERROR);
246 wxMessageBox(wxT(
"Give the operation VHDL implementation file."),
247 wxT(
"Error"), wxICON_ERROR);
261 for (
long i = 0; i < items; ++i) {
263 std::istringstream iss(
266 std::istringstream iss2(
268 iss2 >> resource.
count;
269 operation.
resources.emplace_back(resource);
273 for (
long i = 0; i < items; ++i) {
282 if (lang ==
"VHDL") {
285 }
else if (lang ==
"Verilog") {
289 throw std::runtime_error(
"Unknown language");
294 wxGetApp().mainFrame().browser()->update();
320 item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
336 item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
346 for (
int i = 0; i < idx; ++i) {
348 std::istringstream iss(