41 #include <wx/dirdlg.h>
42 #include <wx/statline.h>
43 #include <wx/filedlg.h>
62 #if wxCHECK_VERSION(3, 0, 0)
63 #define wxSAVE wxFD_SAVE
64 #define wxOVERWRITE_PROMPT wxFD_OVERWRITE_PROMPT
65 #define wxOPEN wxFD_OPEN
66 #define wxFILE_MUST_EXIST wxFD_FILE_MUST_EXIST
90 const
IDF::MachineImplementation& impl) :
91 wxDialog(parent, -1, _T("Generate Processor"), wxDefaultPosition),
92 machine_(
machine), impl_(impl), bem_(NULL) {
94 createContents(
this,
true,
true);
113 std::ostringstream errorStream;
114 std::ostringstream warningStream;
117 if (
dynamic_cast<wxRadioButton*
>(
138 wxString message = _T(
"Error saving BEM:");
145 wxString message = _T(
"BEM target file not defined.");
154 wxString message = _T(
"Error: No binary encoding map loaded.");
167 wxString message = _T(
"Target directory '");
169 message.Append(_T(
"' does not exist."));
176 options.outputDirectory = targetDir;
177 options.sharedOutputDirectory = targetDir;
178 options.generateTestbench =
true;
186 std::ostringstream verboseStream;
193 errorStream, warningStream, verboseStream);
213 targetDir, testBenchDir,
"52390");
215 std::cerr <<
"Warning: Processor Generator failed to "
216 <<
"generate simulation/compilation scripts."
221 string warningMessages = warningStream.str();
222 if (warningMessages !=
"") {
227 string errorMessages = errorStream.str();
228 if (errorMessages !=
"") {
234 wxString message = _T(
"Processor was succesfully generated.");
247 wxString fileTypes = _T(
"Binary Encoding Map (.bem)|*.bem|");
249 this, _T(
"Choose a file"), _T(
"."), _T(
""), fileTypes,
250 wxSAVE | wxOVERWRITE_PROMPT);
252 if (dialog.ShowModal() == wxID_OK) {
253 wxTextCtrl* ctrl =
dynamic_cast<wxTextCtrl*
>(
255 ctrl->SetValue(dialog.GetPath());
269 this, _T(
"Choose a file"), _T(
""), _T(
""),
270 _T(
"Binary Encoding Maps (*.bem)|*.bem|All files|*"),
271 (wxOPEN | wxFILE_MUST_EXIST));
273 if (dialog.ShowModal() == wxID_OK) {
277 ctrl->SetValue(_T(
""));
285 wxString message = _T(
"Error loading binary encoding map:\n");
291 ctrl->SetValue(dialog.GetPath());
303 this, _T(
"Choose a directory"), _T(
""), wxDD_NEW_DIR_BUTTON);
305 if (dialog.ShowModal() == wxID_OK) {
307 ctrl->SetValue(dialog.GetPath());
319 const string& pluginFile,
320 const string& pluginName) {
326 for (vector<string>::const_iterator iter = pluginPaths.begin();
327 iter != pluginPaths.end(); iter++) {
337 wxString message = _T(
"Error loading IC/Decoder generator plugin:\n");
348 "create_generator_plugin_" + pluginName, creator, pluginFile);
359 wxWindow *parent,
bool call_fit,
bool set_sizer) {
361 wxBoxSizer *item0 =
new wxBoxSizer( wxVERTICAL );
363 wxBoxSizer *item1 =
new wxBoxSizer( wxVERTICAL );
366 wxStaticBox *hdl_box =
new wxStaticBox( parent, -1, wxT(
"HDL type selection:") );
367 wxStaticBoxSizer *hdl_boxsizer =
new wxStaticBoxSizer( hdl_box, wxVERTICAL );
369 wxRadioButton *vhdl_item =
new wxRadioButton( parent,
ID_VHDL, wxT(
"VHDL"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
370 vhdl_item->SetValue(
TRUE );
372 wxRadioButton *verilog_item =
new wxRadioButton( parent,
ID_VERILOG, wxT(
"Verilog"), wxDefaultPosition, wxDefaultSize, 0 );
374 hdl_boxsizer->Add( vhdl_item, 0, wxALL, 5 );
375 hdl_boxsizer->Add( verilog_item, 0, wxALL, 5 );
376 item1->Add( hdl_boxsizer, 0, wxGROW|wxALL, 5 );
379 wxStaticBox *item3 =
new wxStaticBox( parent, -1, wxT(
"Binary Encoding Map:") );
380 wxStaticBoxSizer *item2 =
new wxStaticBoxSizer( item3, wxVERTICAL );
382 wxRadioButton *item4 =
new wxRadioButton( parent,
ID_GENERATE_BEM, wxT(
"Generate new"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
383 item4->SetValue(
TRUE );
384 item2->Add( item4, 0, wxALL, 5 );
386 wxBoxSizer *item5 =
new wxBoxSizer( wxVERTICAL );
388 wxBoxSizer *item6 =
new wxBoxSizer( wxHORIZONTAL );
390 wxCheckBox *item7 =
new wxCheckBox( parent,
ID_SAVE_BEM, wxT(
"Save to file:"), wxDefaultPosition, wxDefaultSize, 0 );
391 item6->Add( item7, 0, wxLEFT, 5 );
393 item5->Add( item6, 0, wxALL, 5 );
395 wxBoxSizer *item8 =
new wxBoxSizer( wxHORIZONTAL );
397 wxTextCtrl *item9 =
new wxTextCtrl( parent,
ID_BEM_SAVE_PATH, wxT(
""), wxDefaultPosition, wxSize(300,-1), 0 );
398 item8->Add( item9, 0, wxALIGN_CENTER|wxALL, 5 );
400 wxButton *item10 =
new wxButton( parent,
ID_BROWSE_BEM_SAVE, wxT(
"Browse..."), wxDefaultPosition, wxDefaultSize, 0 );
401 item8->Add( item10, 0, wxALIGN_CENTER|wxALL, 5 );
403 item5->Add( item8, 0, wxALL, 5 );
405 item2->Add( item5, 0, wxGROW|wxALL, 5 );
407 wxRadioButton *item11 =
new wxRadioButton( parent,
ID_LOAD_BEM, wxT(
"Load from file"), wxDefaultPosition, wxDefaultSize, 0 );
408 item2->Add( item11, 0, wxALL, 5 );
410 wxBoxSizer *item12 =
new wxBoxSizer( wxHORIZONTAL );
412 wxTextCtrl *item13 =
new wxTextCtrl( parent,
ID_BEM_LOAD_PATH, wxT(
""), wxDefaultPosition, wxSize(300,-1), 0 );
413 item12->Add( item13, 0, wxALIGN_CENTER|wxALL, 5 );
415 wxButton *item14 =
new wxButton( parent,
ID_BROWSE_BEM_LOAD, wxT(
"Browse..."), wxDefaultPosition, wxDefaultSize, 0 );
416 item12->Add( item14, 0, wxALIGN_CENTER|wxALL, 5 );
418 item2->Add( item12, 0, wxALL, 5 );
420 item1->Add( item2, 0, wxGROW|wxALL, 5 );
422 item1->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 );
424 wxStaticBox *item16 =
new wxStaticBox( parent, -1, wxT(
"Target directory:") );
425 wxStaticBoxSizer *item15 =
new wxStaticBoxSizer( item16, wxVERTICAL );
427 wxBoxSizer *item17 =
new wxBoxSizer( wxHORIZONTAL );
429 wxTextCtrl *item18 =
new wxTextCtrl( parent,
ID_TARGET, wxT(
""), wxDefaultPosition, wxSize(300,-1), 0 );
430 item17->Add( item18, 0, wxALIGN_CENTER|wxALL, 5 );
432 wxButton *item19 =
new wxButton( parent,
ID_BROWSE_TARGET, wxT(
"Browse..."), wxDefaultPosition, wxDefaultSize, 0 );
433 item17->Add( item19, 0, wxALIGN_CENTER|wxALL, 5 );
435 item15->Add( item17, 0, wxALL, 5 );
437 item1->Add( item15, 0, wxGROW|wxALL, 5 );
439 wxStaticLine *item20 =
new wxStaticLine( parent,
ID_LINE, wxDefaultPosition, wxSize(20,-1), wxLI_HORIZONTAL );
440 item1->Add( item20, 0, wxGROW|wxALL, 5 );
442 wxBoxSizer *item21 =
new wxBoxSizer( wxHORIZONTAL );
444 wxButton *item22 =
new wxButton( parent, wxID_CANCEL, wxT(
"Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
445 item21->Add( item22, 0, wxALIGN_CENTER|wxALL, 5 );
447 wxButton *item23 =
new wxButton( parent, wxID_OK, wxT(
"OK"), wxDefaultPosition, wxDefaultSize, 0 );
448 item21->Add( item23, 0, wxALIGN_CENTER|wxALL, 5 );
450 item1->Add( item21, 0, wxALL, 5 );
452 item0->Add( item1, 0, wxGROW|wxALL, 5 );
456 parent->SetSizer( item0 );
458 item0->SetSizeHints( parent );