OpenASIP 2.2
Loading...
Searching...
No Matches
Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
ProcessorImplementationWindow Class Reference

#include <ProcessorImplementationWindow.hh>

Inheritance diagram for ProcessorImplementationWindow:
Inheritance graph
Collaboration diagram for ProcessorImplementationWindow:
Collaboration graph

Public Member Functions

 ProcessorImplementationWindow (wxWindow *parent, TTAMachine::Machine &machine, IDF::MachineImplementation &impl)
 
virtual ~ProcessorImplementationWindow ()
 
void setDirty (bool dirty=true)
 

Private Types

enum  {
  ID_LOAD_IDF , ID_SAVE_IDF , ID_GENERATE_PROCESSOR , ID_FU_LIST ,
  ID_IU_LIST , ID_RF_LIST , ID_AUTO_SELECT_IMPL , ID_SELECT_FU_IMPL ,
  ID_SELECT_IU_IMPL , ID_SELECT_RF_IMPL , ID_BROWSE_DECOMPRESSOR , ID_BROWSE_IC_DEC_PLUGIN ,
  ID_BROWSE_IC_DEC_HDB , ID_DECOMPRESSOR_PATH , ID_IC_DEC_PLUGIN_FILE , ID_IC_DEC_PLUGIN_NAME ,
  ID_IC_DEC_PLUGIN_DESC , ID_IC_DEC_HDB_FILE , ID_PARAMETER_LIST , ID_PARAMETER_VALUE ,
  ID_SET_VALUE , ID_NOTEBOOK , ID_GENERATE , ID_CLOSE ,
  ID_TEXT , ID_LINE
}
 

Private Member Functions

void onAutoSelectImplementations (wxCommandEvent &event)
 
void updateImplementationLists ()
 
void handleSelectRFImplementation (long item)
 
void onSelectRFImplementation (wxCommandEvent &event)
 
void onRFSelection (wxListEvent &event)
 
void onRFActivation (wxListEvent &event)
 
void updateRFList (const std::string &rfName, int index)
 
void handleSelectIUImplementation (long item)
 
void onSelectIUImplementation (wxCommandEvent &event)
 
void onIUSelection (wxListEvent &event)
 
void onIUActivation (wxListEvent &event)
 
void handleSelectFUImplementation (long item)
 
void onSelectFUImplementation (wxCommandEvent &event)
 
void onFUSelection (wxListEvent &event)
 
void onFUActivation (wxListEvent &event)
 
void updateFUList (const std::string &fuName, int index)
 
void onSetParameterValue (wxCommandEvent &event)
 
void onBrowseDecompressor (wxCommandEvent &event)
 
void onBrowseICDecPlugin (wxCommandEvent &event)
 
void onBrowseICHDB (wxCommandEvent &event)
 
void loadICDecoderPlugin (const std::string &pluginName, const std::string &pluginFile)
 
void onParameterSelection (wxListEvent &event)
 
virtual bool TransferDataToWindow ()
 
void onLoadIDF (wxCommandEvent &event)
 
void onSaveIDF (wxCommandEvent &event)
 
void onClose (wxCommandEvent &event)
 
void onGenerateProcessor (wxCommandEvent &event)
 
void doSaveIDF ()
 
void checkImplementationFiles ()
 
wxSizer * createContents (wxWindow *parent, bool call_fit, bool set_sizer)
 
wxSizer * functionUnitPage (wxWindow *parent, bool call_fit, bool set_sizer=true)
 
wxSizer * registerFilePage (wxWindow *parent, bool call_fit, bool set_sizer=true)
 
wxSizer * immediateUnitPage (wxWindow *parent, bool call_fit, bool set_sizer=true)
 
wxSizer * decompressionPage (wxWindow *parent, bool call_fit, bool set_sizer=true)
 
wxSizer * icDecoderPluginPage (wxWindow *parent, bool call_fit, bool set_sizer=true)
 

Private Attributes

TTAMachine::Machinemachine_
 Machine that is being generated.
 
IDF::MachineImplementationimpl_
 MachineImplementation object containing the implementation information.
 
wxListCtrl * fuList_
 Pointer to the FU implementation list widget.
 
wxListCtrl * iuList_
 Pointer to the IU implementation list widget.
 
wxListCtrl * rfList_
 Pointer to the RF implementation list widget.
 
wxListCtrl * parameterList_
 Pointer to the ic decoder parameter list widget.
 
PluginTools pluginTool_
 Plugintool for loading IC/Decoder plugins.
 
ProGe::ICDecoderGeneratorPluginplugin_
 IC/Decoder plugin of the current machine implementation.
 
bool dirtyData_
 

Detailed Description

Processor implementation window.

Definition at line 55 of file ProcessorImplementationWindow.hh.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private
Enumerator
ID_LOAD_IDF 
ID_SAVE_IDF 
ID_GENERATE_PROCESSOR 
ID_FU_LIST 
ID_IU_LIST 
ID_RF_LIST 
ID_AUTO_SELECT_IMPL 
ID_SELECT_FU_IMPL 
ID_SELECT_IU_IMPL 
ID_SELECT_RF_IMPL 
ID_BROWSE_DECOMPRESSOR 
ID_BROWSE_IC_DEC_PLUGIN 
ID_BROWSE_IC_DEC_HDB 
ID_DECOMPRESSOR_PATH 
ID_IC_DEC_PLUGIN_FILE 
ID_IC_DEC_PLUGIN_NAME 
ID_IC_DEC_PLUGIN_DESC 
ID_IC_DEC_HDB_FILE 
ID_PARAMETER_LIST 
ID_PARAMETER_VALUE 
ID_SET_VALUE 
ID_NOTEBOOK 
ID_GENERATE 
ID_CLOSE 
ID_TEXT 
ID_LINE 

Definition at line 137 of file ProcessorImplementationWindow.hh.

137 {
161 ID_CLOSE,
162 ID_TEXT,
163 ID_LINE
164 };

Constructor & Destructor Documentation

◆ ProcessorImplementationWindow()

ProcessorImplementationWindow::ProcessorImplementationWindow ( wxWindow *  parent,
TTAMachine::Machine machine,
IDF::MachineImplementation impl 
)

Constructor.

Parameters
parentParent window of the page.
machineProcessor architecture.
implProcessor implementation definition.

Definition at line 123 of file ProcessorImplementationWindow.cc.

125 :
126 wxDialog(parent, -1, _T("Processor Implementation"),
127 wxDefaultPosition, wxDefaultSize,
128 wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER),
129 machine_(machine), impl_(impl), plugin_(NULL), dirtyData_(false) {
130
131 createContents(this, true, true);
132 SetMinSize(wxSize(600, 500));
133
134 // Plugin name is always fixed, thus disable editing
135 dynamic_cast<wxTextCtrl*>(FindWindow(ID_IC_DEC_PLUGIN_NAME))->
136 Enable(false);
137
138 fuList_ = dynamic_cast<wxListCtrl*>(FindWindow(ID_FU_LIST));
139 rfList_ = dynamic_cast<wxListCtrl*>(FindWindow(ID_RF_LIST));
140 iuList_ = dynamic_cast<wxListCtrl*>(FindWindow(ID_IU_LIST));
141 parameterList_ = dynamic_cast<wxListCtrl*>(FindWindow(ID_PARAMETER_LIST));
142
143 // Add FU and RF list columns.
144 fuList_->InsertColumn(0, _T("FU"), wxLIST_FORMAT_LEFT, 150);
145 fuList_->InsertColumn(1, _T("ID"), wxLIST_FORMAT_LEFT, 40);
146 fuList_->InsertColumn(2, _T("HDB"), wxLIST_FORMAT_LEFT, 400);
147
148 rfList_->InsertColumn(0, _T("RF"), wxLIST_FORMAT_LEFT, 150);
149 rfList_->InsertColumn(1, _T("ID"), wxLIST_FORMAT_LEFT, 40);
150 rfList_->InsertColumn(2, _T("HDB"), wxLIST_FORMAT_LEFT, 400);
151
152 iuList_->InsertColumn(0, _T("IU"), wxLIST_FORMAT_LEFT, 150);
153 iuList_->InsertColumn(1, _T("ID"), wxLIST_FORMAT_LEFT, 40);
154 iuList_->InsertColumn(2, _T("HDB"), wxLIST_FORMAT_LEFT, 400);
155
156 parameterList_->InsertColumn(0, _T("Name"), wxLIST_FORMAT_LEFT, 150);
157 parameterList_->InsertColumn(1, _T("Value"), wxLIST_FORMAT_LEFT, 100);
158 parameterList_->InsertColumn(
159 2, _T("Description"), wxLIST_FORMAT_LEFT, 300);
160
161 // Disable conditional buttons by default.
162 FindWindow(ID_SELECT_RF_IMPL)->Disable();
163 FindWindow(ID_SELECT_IU_IMPL)->Disable();
164 FindWindow(ID_SELECT_FU_IMPL)->Disable();
165 FindWindow(ID_SET_VALUE)->Disable();
166
167 // Load default plugin
168 std::string pluginFile = Environment::defaultICDecoderPlugin();
169 std::string pluginName = FileSystem::fileNameBody(pluginFile);
170 assert(pluginName.length() > 6);
171 pluginName = pluginName.substr(0, pluginName.length() - 6);
172
173 loadICDecoderPlugin(pluginName, pluginFile);
174
175}
#define assert(condition)
TTAMachine::Machine * machine
the architecture definition of the estimated processor
static std::string defaultICDecoderPlugin()
static std::string fileNameBody(const std::string &fileName)
wxListCtrl * iuList_
Pointer to the IU implementation list widget.
TTAMachine::Machine & machine_
Machine that is being generated.
IDF::MachineImplementation & impl_
MachineImplementation object containing the implementation information.
wxListCtrl * fuList_
Pointer to the FU implementation list widget.
wxListCtrl * rfList_
Pointer to the RF implementation list widget.
ProGe::ICDecoderGeneratorPlugin * plugin_
IC/Decoder plugin of the current machine implementation.
wxListCtrl * parameterList_
Pointer to the ic decoder parameter list widget.
wxSizer * createContents(wxWindow *parent, bool call_fit, bool set_sizer)
void loadICDecoderPlugin(const std::string &pluginName, const std::string &pluginFile)

References assert, Environment::defaultICDecoderPlugin(), and FileSystem::fileNameBody().

Here is the call graph for this function:

◆ ~ProcessorImplementationWindow()

ProcessorImplementationWindow::~ProcessorImplementationWindow ( )
virtual

Destructor.

Definition at line 181 of file ProcessorImplementationWindow.cc.

181 {
182}

Member Function Documentation

◆ checkImplementationFiles()

void ProcessorImplementationWindow::checkImplementationFiles ( )
private

Checks if every file path defined in IDF is correct.

If one or more file paths are invalid, warning dialog is shown to user.

Definition at line 993 of file ProcessorImplementationWindow.cc.

993 {
994 size_t missingFileCount;
995 size_t alternativesCount;
996
997 // check implementation files, and try to fix paths for unresolved files
998 if (impl_.checkImplFiles(missingFileCount, alternativesCount)) {
999 // if all the files were located, exit method
1000 return;
1001 }
1002
1003 // every file was not found, get missing files and possible alternatives
1004 wxString missFileCountStr = WxConversion::toWxString(
1005 static_cast<int>(missingFileCount));
1006 wxString altFileCountStr = WxConversion::toWxString(
1007 static_cast<int>(alternativesCount));
1008
1009 // form message for the dialog
1010 wxString message = missFileCountStr;
1011 message.Append(_T(" file(s) defined in IDF couldn't be located from"));
1012 message.Append(_T(" absolute paths or under working directory.\n"));
1013 message.Append(_T("\n"));
1014
1015 if (alternativesCount > 0) {
1016 message.Append(altFileCountStr);
1017 message.Append(_T(" of them were replaced with file(s) found under"));
1018 message.Append(_T(" the default search paths."));
1019 } else {
1020 message.Append(_T("Any alternative file paths couldn't be"));
1021 message.Append(_T(" located for the missing files."));
1022 }
1023
1024 WarningDialog warningDialog(this, message);
1025 warningDialog.ShowModal();
1026}
bool checkImplFiles(size_t &missingFiles, size_t &alternativeFiles)
static wxString toWxString(const std::string &source)

References IDF::MachineImplementation::checkImplFiles(), impl_, and WxConversion::toWxString().

Referenced by onLoadIDF().

Here is the call graph for this function:

◆ createContents()

wxSizer * ProcessorImplementationWindow::createContents ( wxWindow *  parent,
bool  call_fit,
bool  set_sizer 
)
private

Creates the dialog widgets.

Code geenrated by wxDesigner. Do not modify manually.

Parameters
parentParent window of the created widget hierarchy.
call_fitFit parent window size.
set_sizerSet the created top level sizer as the parent win contents.

Definition at line 1039 of file ProcessorImplementationWindow.cc.

1040{
1041 wxFlexGridSizer *item0 = new wxFlexGridSizer( 1, 0, 0 );
1042 item0->AddGrowableCol( 0 );
1043 item0->AddGrowableRow( 0 );
1044
1045 wxNotebook *item2 = new wxNotebook( parent, ID_NOTEBOOK, wxDefaultPosition, wxDefaultSize, 0 );
1046#if !wxCHECK_VERSION(2,5,2)
1047 wxNotebookSizer *item1 = new wxNotebookSizer( item2 );
1048#else
1049 wxWindow *item1 = item2;
1050#endif
1051
1052 wxPanel *item3 = new wxPanel( item2, -1 );
1054 item2->AddPage( item3, wxT("Register Files") );
1055
1056 wxPanel *item4 = new wxPanel( item2, -1 );
1058 item2->AddPage( item4, wxT("Immediate Units") );
1059
1060 wxPanel *item5 = new wxPanel( item2, -1 );
1062 item2->AddPage( item5, wxT("Function Units") );
1063
1064 wxPanel *item6 = new wxPanel( item2, -1 );
1066 item2->AddPage( item6, wxT("Instruction Compression") );
1067
1068 wxPanel *item7 = new wxPanel( item2, -1 );
1070 item2->AddPage( item7, wxT("IC / Decoder Plugin") );
1071
1072 item0->Add( item1, 0, wxFIXED_MINSIZE|wxGROW|wxALL, 5 );
1073
1074 wxStaticLine *item8 = new wxStaticLine( parent, ID_LINE, wxDefaultPosition, wxSize(200,-1), wxLI_HORIZONTAL );
1075 item0->Add( item8, 0, wxFIXED_MINSIZE|wxGROW|wxALL, 5 );
1076
1077 wxGridSizer *item9 = new wxGridSizer( 2, 0, 0 );
1078
1079 wxBoxSizer *item10 = new wxBoxSizer( wxHORIZONTAL );
1080
1081 wxButton *item11 = new wxButton( parent, ID_LOAD_IDF, wxT("Load IDF..."), wxDefaultPosition, wxDefaultSize, 0 );
1082 item10->Add( item11, 0, wxFIXED_MINSIZE|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
1083
1084 wxButton *item12 = new wxButton( parent, ID_SAVE_IDF, wxT("Save IDF..."), wxDefaultPosition, wxDefaultSize, 0 );
1085 item10->Add( item12, 0, wxFIXED_MINSIZE|wxALIGN_CENTER|wxALL, 5 );
1086
1087 wxButton *item13 = new wxButton( parent, ID_GENERATE, wxT("Generate Processor"), wxDefaultPosition, wxDefaultSize, 0 );
1088 item10->Add( item13, 0, wxFIXED_MINSIZE|wxALIGN_CENTER|wxALL, 5 );
1089
1090 item9->Add( item10, 0, wxFIXED_MINSIZE|wxALIGN_CENTER_VERTICAL, 5 );
1091
1092 wxBoxSizer *item14 = new wxBoxSizer( wxHORIZONTAL );
1093
1094 wxButton *item15 = new wxButton( parent, ID_CLOSE, wxT("Close"), wxDefaultPosition, wxDefaultSize, 0 );
1095 item14->Add( item15, 0, wxFIXED_MINSIZE|wxALIGN_CENTER|wxALL, 5 );
1096
1097 item9->Add( item14, 0, wxFIXED_MINSIZE|wxALIGN_CENTER_VERTICAL, 5 );
1098
1099 item0->Add( item9, 0, wxFIXED_MINSIZE|wxGROW|wxALL, 5 );
1100
1101 if (set_sizer)
1102 {
1103 parent->SetSizer( item0 );
1104 if (call_fit)
1105 item0->SetSizeHints( parent );
1106 }
1107
1108 return item0;
1109}
const string FALSE
Value used for false in attribute and element values.
wxSizer * registerFilePage(wxWindow *parent, bool call_fit, bool set_sizer=true)
wxSizer * immediateUnitPage(wxWindow *parent, bool call_fit, bool set_sizer=true)
wxSizer * functionUnitPage(wxWindow *parent, bool call_fit, bool set_sizer=true)
wxSizer * icDecoderPluginPage(wxWindow *parent, bool call_fit, bool set_sizer=true)
wxSizer * decompressionPage(wxWindow *parent, bool call_fit, bool set_sizer=true)

References decompressionPage(), FALSE, functionUnitPage(), icDecoderPluginPage(), ID_CLOSE, ID_GENERATE, ID_LINE, ID_LOAD_IDF, ID_NOTEBOOK, ID_SAVE_IDF, immediateUnitPage(), and registerFilePage().

Here is the call graph for this function:

◆ decompressionPage()

wxSizer * ProcessorImplementationWindow::decompressionPage ( wxWindow *  parent,
bool  call_fit,
bool  set_sizer = true 
)
private

Definition at line 1167 of file ProcessorImplementationWindow.cc.

1168{
1169 wxFlexGridSizer *item0 = new wxFlexGridSizer( 1, 0, 0 );
1170 item0->AddGrowableCol( 0 );
1171
1172 item0->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 );
1173
1174 wxStaticBox *item2 = new wxStaticBox( parent, -1, wxT("Instruction Decompressor:") );
1175 wxStaticBoxSizer *item1 = new wxStaticBoxSizer( item2, wxVERTICAL );
1176
1177 wxFlexGridSizer *item3 = new wxFlexGridSizer( 2, 0, 0 );
1178
1179 wxStaticText *item4 = new wxStaticText( parent, ID_TEXT, wxT("Decompressor block file:"), wxDefaultPosition, wxDefaultSize, 0 );
1180 item3->Add( item4, 0, wxALL, 5 );
1181
1182 item3->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 );
1183
1184 wxTextCtrl *item5 = new wxTextCtrl( parent, ID_DECOMPRESSOR_PATH, wxT(""), wxDefaultPosition, wxSize(250,-1), wxTE_READONLY );
1185 item3->Add( item5, 0, wxALIGN_CENTER|wxALL, 5 );
1186
1187 wxButton *item6 = new wxButton( parent, ID_BROWSE_DECOMPRESSOR, wxT("Browse..."), wxDefaultPosition, wxDefaultSize, 0 );
1188 item3->Add( item6, 0, wxALIGN_CENTER|wxALL, 5 );
1189
1190 item1->Add( item3, 0, wxGROW|wxALL, 5 );
1191
1192 item0->Add( item1, 0, wxGROW|wxALL, 5 );
1193
1194 item0->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 );
1195
1196 if (set_sizer)
1197 {
1198 parent->SetSizer( item0 );
1199 if (call_fit)
1200 item0->SetSizeHints( parent );
1201 }
1202
1203 return item0;
1204}

References ID_BROWSE_DECOMPRESSOR, ID_DECOMPRESSOR_PATH, and ID_TEXT.

Referenced by createContents().

◆ doSaveIDF()

void ProcessorImplementationWindow::doSaveIDF ( )
private

Definition at line 719 of file ProcessorImplementationWindow.cc.

719 {
720 wxString message = _T("Save implementation.");
721 wxString defaultDir = _T(".");
722
723 wxDocument* doc = wxGetApp().docManager()->GetCurrentDocument();
724 wxString defaultFile;
725 if (doc != NULL) {
726 defaultFile = doc->GetFilename();
727 defaultFile.erase(defaultFile.rfind('.'));
728 defaultFile += _T(".idf");
729
730 // set default save location to same where the .adf file is
731 string absolutePathToADF = FileSystem::absolutePathOf(
732 WxConversion::toString(defaultFile));
733 defaultDir = WxConversion::toWxString(
734 FileSystem::directoryOfPath(absolutePathToADF));
735 defaultFile = WxConversion::toWxString(
737 } else {
738 defaultFile = _T(".idf");
739 }
740
741 wxString fileTypes = _T("Implementation Definition File (.idf)|*.idf");
742
743 wxFileDialog dialog(
744 this, message, defaultDir, defaultFile, fileTypes,
745 wxSAVE | wxOVERWRITE_PROMPT);
746
747 if (dialog.ShowModal() == wxID_OK) {
748 string path = WxConversion::toString(dialog.GetPath());
749 try {
750 // Make local and default file paths relative.
751 std::vector<string> searchPaths;
752 searchPaths.push_back(FileSystem::currentWorkingDir());
753 std::vector<string> hdbSearchPaths = Environment::hdbPaths();
754 impl_.makeImplFilesRelative(searchPaths);
755
756 IDFSerializer serializer;
757 serializer.setDestinationFile(path);
759 setDirty(false);
760 } catch (Exception& e) {
761 wxString message = _T("Error writing '");
762 message.Append(WxConversion::toWxString(path));
763 message.Append(_T("':"));
764 message.Append(WxConversion::toWxString(e.errorMessage()));
765 ErrorDialog dialog(this, message);
766 dialog.ShowModal();
767 }
768 }
769}
static std::vector< std::string > hdbPaths(bool libraryPathsOnly=false)
std::string errorMessage() const
Definition Exception.cc:123
static std::string absolutePathOf(const std::string &pathName)
static std::string fileOfPath(const std::string pathName)
static std::string directoryOfPath(const std::string fileName)
Definition FileSystem.cc:79
static std::string currentWorkingDir()
void writeMachineImplementation(const MachineImplementation &implementation)
void makeImplFilesRelative(const std::vector< std::string > &sPaths)
static std::string toString(const wxString &source)
void setDestinationFile(const std::string &fileName)

References FileSystem::absolutePathOf(), FileSystem::currentWorkingDir(), FileSystem::directoryOfPath(), Exception::errorMessage(), FileSystem::fileOfPath(), Environment::hdbPaths(), impl_, IDF::MachineImplementation::makeImplFilesRelative(), XMLSerializer::setDestinationFile(), setDirty(), WxConversion::toString(), WxConversion::toWxString(), and IDF::IDFSerializer::writeMachineImplementation().

Referenced by onClose(), and onSaveIDF().

Here is the call graph for this function:

◆ functionUnitPage()

wxSizer * ProcessorImplementationWindow::functionUnitPage ( wxWindow *  parent,
bool  call_fit,
bool  set_sizer = true 
)
private

Definition at line 1139 of file ProcessorImplementationWindow.cc.

1140{
1141 wxFlexGridSizer *item0 = new wxFlexGridSizer( 1, 0, 0 );
1142 item0->AddGrowableCol( 0 );
1143 item0->AddGrowableRow( 0 );
1144
1145 wxListCtrl *item1 = new wxListCtrl( parent, ID_FU_LIST, wxDefaultPosition, wxDefaultSize, wxLC_REPORT|wxLC_SINGLE_SEL|wxSUNKEN_BORDER );
1146 item0->Add( item1, 0, wxGROW|wxALL, 5 );
1147
1148 wxBoxSizer *buttonSizer = new wxBoxSizer( wxHORIZONTAL );
1149 wxButton *autoSelButton = new wxButton( parent, ID_AUTO_SELECT_IMPL, wxT("Auto Select Implementations"), wxDefaultPosition, wxDefaultSize, 0 );
1150 buttonSizer->Add( autoSelButton, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
1151
1152 wxButton *item2 = new wxButton( parent, ID_SELECT_FU_IMPL, wxT("Select implementation..."), wxDefaultPosition, wxDefaultSize, 0 );
1153 buttonSizer->Add( item2, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
1154
1155 item0->Add( buttonSizer, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
1156
1157 if (set_sizer)
1158 {
1159 parent->SetSizer( item0 );
1160 if (call_fit)
1161 item0->SetSizeHints( parent );
1162 }
1163
1164 return item0;
1165}

References ID_AUTO_SELECT_IMPL, ID_FU_LIST, and ID_SELECT_FU_IMPL.

Referenced by createContents().

◆ handleSelectFUImplementation()

void ProcessorImplementationWindow::handleSelectFUImplementation ( long  item)
private

Handle calling of the implementation selection dialog and it's return value

Definition at line 508 of file ProcessorImplementationWindow.cc.

508 {
509
510 const FunctionUnit& fu = *machine_.functionUnitNavigator().item(item);
511
512 if (impl_.hasFUImplementation(fu.name())) {
514 this, fu, impl_.fuImplementation(fu.name()));
515
516 if (dialog.ShowModal() == wxID_OK) {
517 setDirty();
518 updateFUList(fu.name(), item);
519 }
520 } else {
522 new FUImplementationLocation("", -1, fu.name());
523
524 BlockImplementationDialog dialog(this, fu, *location);
525 if (dialog.ShowModal() == wxID_OK) {
526 impl_.addFUImplementation(location);
527 setDirty();
528 updateFUList(fu.name(), item);
529 } else {
530 delete location;
531 }
532 }
533}
FUImplementationLocation & fuImplementation(const std::string &fu) const
void addFUImplementation(FUImplementationLocation *implementation)
bool hasFUImplementation(const std::string &unitName) const
void updateFUList(const std::string &fuName, int index)
virtual TCEString name() const
ComponentType * item(int index) const
virtual FunctionUnitNavigator functionUnitNavigator() const
Definition Machine.cc:380
UnitImplementationLocation FUImplementationLocation

References IDF::MachineImplementation::addFUImplementation(), IDF::MachineImplementation::fuImplementation(), TTAMachine::Machine::functionUnitNavigator(), IDF::MachineImplementation::hasFUImplementation(), impl_, TTAMachine::Machine::Navigator< ComponentType >::item(), machine_, TTAMachine::Component::name(), setDirty(), and updateFUList().

Referenced by onFUActivation(), and onSelectFUImplementation().

Here is the call graph for this function:

◆ handleSelectIUImplementation()

void ProcessorImplementationWindow::handleSelectIUImplementation ( long  item)
private

Definition at line 434 of file ProcessorImplementationWindow.cc.

434 {
435
437 if (impl_.hasIUImplementation(iu.name())) {
439 this, iu, impl_.iuImplementation(iu.name()));
440
441 if (dialog.ShowModal() == wxID_OK) {
442 setDirty();
443 }
444 } else {
446 new RFImplementationLocation("", -1, iu.name());
447
448 BlockImplementationDialog dialog(this, iu, *location);
449 if (dialog.ShowModal() == wxID_OK) {
450 impl_.addIUImplementation(location);
451 setDirty();
452 } else {
453 delete location;
454 }
455 }
457}
void addIUImplementation(RFImplementationLocation *implementation)
RFImplementationLocation & iuImplementation(const std::string &iu) const
bool hasIUImplementation(const std::string &unitName) const
virtual ImmediateUnitNavigator immediateUnitNavigator() const
Definition Machine.cc:416
UnitImplementationLocation RFImplementationLocation

References IDF::MachineImplementation::addIUImplementation(), IDF::MachineImplementation::hasIUImplementation(), TTAMachine::Machine::immediateUnitNavigator(), impl_, TTAMachine::Machine::Navigator< ComponentType >::item(), IDF::MachineImplementation::iuImplementation(), machine_, TTAMachine::Component::name(), setDirty(), and TransferDataToWindow().

Referenced by onIUActivation(), and onSelectIUImplementation().

Here is the call graph for this function:

◆ handleSelectRFImplementation()

void ProcessorImplementationWindow::handleSelectRFImplementation ( long  item)
private

Call the dialog to select RF implementation and handle the return values of the dialog.

Definition at line 381 of file ProcessorImplementationWindow.cc.

381 {
382
383 const RegisterFile& rf = *machine_.registerFileNavigator().item(item);
384 if (impl_.hasRFImplementation(rf.name())) {
386 this, rf, impl_.rfImplementation(rf.name()));
387
388 if (dialog.ShowModal() == wxID_OK) {
389 setDirty();
390 updateRFList(rf.name(), item);
391 }
392 } else {
394 new RFImplementationLocation("", -1, rf.name());
395
396 BlockImplementationDialog dialog(this, rf, *location);
397 if (dialog.ShowModal() == wxID_OK) {
398 impl_.addRFImplementation(location);
399 setDirty();
400 updateRFList(rf.name(), item);
401 } else {
402 delete location;
403 }
404 }
405}
void addRFImplementation(RFImplementationLocation *implementation)
RFImplementationLocation & rfImplementation(const std::string &rf) const
bool hasRFImplementation(const std::string &unitName) const
void updateRFList(const std::string &rfName, int index)
virtual RegisterFileNavigator registerFileNavigator() const
Definition Machine.cc:450

References IDF::MachineImplementation::addRFImplementation(), IDF::MachineImplementation::hasRFImplementation(), impl_, TTAMachine::Machine::Navigator< ComponentType >::item(), machine_, TTAMachine::Component::name(), TTAMachine::Machine::registerFileNavigator(), IDF::MachineImplementation::rfImplementation(), setDirty(), and updateRFList().

Referenced by onRFActivation(), and onSelectRFImplementation().

Here is the call graph for this function:

◆ icDecoderPluginPage()

wxSizer * ProcessorImplementationWindow::icDecoderPluginPage ( wxWindow *  parent,
bool  call_fit,
bool  set_sizer = true 
)
private

Definition at line 1206 of file ProcessorImplementationWindow.cc.

1207{
1208 wxFlexGridSizer *item0 = new wxFlexGridSizer( 1, 0, 0 );
1209 item0->AddGrowableCol( 0 );
1210 item0->AddGrowableRow( 0 );
1211
1212 wxFlexGridSizer *item1 = new wxFlexGridSizer( 1, 0, 0 );
1213 item1->AddGrowableCol( 0 );
1214 item1->AddGrowableRow( 1 );
1215
1216 wxFlexGridSizer *item2 = new wxFlexGridSizer( 3, 0, 0 );
1217
1218 wxStaticText *item3 = new wxStaticText( parent, ID_TEXT, wxT("Plugin file:"), wxDefaultPosition, wxDefaultSize, 0 );
1219 item2->Add( item3, 0, wxALL, 5 );
1220
1221 wxTextCtrl *item4 = new wxTextCtrl( parent, ID_IC_DEC_PLUGIN_FILE, wxT(""), wxDefaultPosition, wxSize(80,-1), wxTE_READONLY );
1222 item2->Add( item4, 0, wxGROW|wxALL, 5 );
1223
1224 wxButton *item5 = new wxButton( parent, ID_BROWSE_IC_DEC_PLUGIN, wxT("Browse..."), wxDefaultPosition, wxDefaultSize, 0 );
1225 item2->Add( item5, 0, wxALIGN_CENTER|wxALL, 5 );
1226
1227 wxStaticText *item6 = new wxStaticText( parent, ID_TEXT, wxT("HDB file:"), wxDefaultPosition, wxDefaultSize, 0 );
1228 item2->Add( item6, 0, wxALL, 5 );
1229
1230 wxTextCtrl *item7 = new wxTextCtrl( parent, ID_IC_DEC_HDB_FILE, wxT(""), wxDefaultPosition, wxSize(80,-1), 0 );
1231 item2->Add( item7, 0, wxGROW|wxALL, 5 );
1232
1233 wxButton *item8 = new wxButton( parent, ID_BROWSE_IC_DEC_HDB, wxT("Browse..."), wxDefaultPosition, wxDefaultSize, 0 );
1234 item2->Add( item8, 0, wxALIGN_CENTER|wxALL, 5 );
1235
1236 wxStaticText *item9 = new wxStaticText( parent, ID_TEXT, wxT("Plugin name:"), wxDefaultPosition, wxDefaultSize, 0 );
1237 item2->Add( item9, 0, wxALL, 5 );
1238
1239 wxTextCtrl *item10 = new wxTextCtrl( parent, ID_IC_DEC_PLUGIN_NAME, wxT(""), wxDefaultPosition, wxSize(80,-1), wxTE_READONLY );
1240 item2->Add( item10, 0, wxGROW|wxALL, 5 );
1241
1242 item2->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 );
1243
1244 wxStaticText *item11 = new wxStaticText( parent, ID_TEXT, wxT("Description:"), wxDefaultPosition, wxDefaultSize, 0 );
1245 item2->Add( item11, 0, wxALL, 5 );
1246
1247 wxTextCtrl *item12 = new wxTextCtrl( parent, ID_IC_DEC_PLUGIN_DESC, wxT(""), wxDefaultPosition, wxSize(320,80), wxTE_MULTILINE|wxTE_READONLY );
1248 item2->Add( item12, 0, wxGROW|wxALL, 5 );
1249
1250 item1->Add( item2, 0, wxFIXED_MINSIZE|wxGROW|wxALL, 5 );
1251
1252 wxFlexGridSizer *item13 = new wxFlexGridSizer( 1, 0, 0 );
1253 item13->AddGrowableCol( 0 );
1254 item13->AddGrowableRow( 1 );
1255
1256 wxStaticText *item14 = new wxStaticText( parent, ID_TEXT, wxT("Plugin parameters:"), wxDefaultPosition, wxDefaultSize, 0 );
1257 item13->Add( item14, 0, wxALL, 5 );
1258
1259 wxListCtrl *item15 = new wxListCtrl( parent, ID_PARAMETER_LIST, wxDefaultPosition, wxDefaultSize, wxLC_REPORT|wxLC_SINGLE_SEL|wxSUNKEN_BORDER );
1260 item13->Add( item15, 0, wxGROW|wxALL, 5 );
1261
1262 wxBoxSizer *item16 = new wxBoxSizer( wxHORIZONTAL );
1263
1264 wxStaticText *item17 = new wxStaticText( parent, ID_TEXT, wxT("New value:"), wxDefaultPosition, wxDefaultSize, 0 );
1265 item16->Add( item17, 0, wxALIGN_CENTER|wxALL, 5 );
1266
1267 wxTextCtrl *item18 = new wxTextCtrl( parent, ID_PARAMETER_VALUE, wxT(""), wxDefaultPosition, wxSize(200,-1), 0 );
1268 item16->Add( item18, 0, wxALIGN_CENTER|wxALL, 5 );
1269
1270 wxButton *item19 = new wxButton( parent, ID_SET_VALUE, wxT("Set"), wxDefaultPosition, wxDefaultSize, 0 );
1271 item16->Add( item19, 0, wxALIGN_CENTER|wxALL, 5 );
1272
1273 item13->Add( item16, 0, wxALIGN_CENTER, 5 );
1274
1275 item1->Add( item13, 0, wxFIXED_MINSIZE|wxGROW|wxALL, 5 );
1276
1277 item0->Add( item1, 0, wxGROW|wxALL, 5 );
1278
1279 if (set_sizer)
1280 {
1281 parent->SetSizer( item0 );
1282 if (call_fit)
1283 item0->SetSizeHints( parent );
1284 }
1285
1286 return item0;
1287}

References ID_BROWSE_IC_DEC_HDB, ID_BROWSE_IC_DEC_PLUGIN, ID_IC_DEC_HDB_FILE, ID_IC_DEC_PLUGIN_DESC, ID_IC_DEC_PLUGIN_FILE, ID_IC_DEC_PLUGIN_NAME, ID_PARAMETER_LIST, ID_PARAMETER_VALUE, ID_SET_VALUE, and ID_TEXT.

Referenced by createContents().

◆ immediateUnitPage()

wxSizer * ProcessorImplementationWindow::immediateUnitPage ( wxWindow *  parent,
bool  call_fit,
bool  set_sizer = true 
)
private

Definition at line 1289 of file ProcessorImplementationWindow.cc.

1290{
1291 wxFlexGridSizer *item0 = new wxFlexGridSizer( 1, 0, 0 );
1292 item0->AddGrowableCol( 0 );
1293 item0->AddGrowableRow( 0 );
1294
1295 wxListCtrl *item1 = new wxListCtrl( parent, ID_IU_LIST, wxDefaultPosition, wxDefaultSize, wxLC_REPORT|wxLC_SINGLE_SEL|wxSUNKEN_BORDER );
1296 item0->Add( item1, 0, wxGROW|wxALL, 5 );
1297
1298 wxBoxSizer *buttonSizer = new wxBoxSizer( wxHORIZONTAL );
1299 wxButton *autoSelButton = new wxButton( parent, ID_AUTO_SELECT_IMPL, wxT("Auto Select Implementations"), wxDefaultPosition, wxDefaultSize, 0 );
1300 buttonSizer->Add( autoSelButton, 0, wxALL, 5 );
1301
1302 wxButton *item2 = new wxButton( parent, ID_SELECT_IU_IMPL, wxT("Select implementation..."), wxDefaultPosition, wxDefaultSize, 0 );
1303 buttonSizer->Add( item2, 0, wxALL, 5 );
1304
1305 item0->Add( buttonSizer, 0, wxALL, 5 );
1306
1307 if (set_sizer)
1308 {
1309 parent->SetSizer( item0 );
1310 if (call_fit)
1311 item0->SetSizeHints( parent );
1312 }
1313
1314 return item0;
1315}

References ID_AUTO_SELECT_IMPL, ID_IU_LIST, and ID_SELECT_IU_IMPL.

Referenced by createContents().

◆ loadICDecoderPlugin()

void ProcessorImplementationWindow::loadICDecoderPlugin ( const std::string &  pluginName,
const std::string &  pluginFile 
)
private

Loads an IC/Decoder plugin.

Parameters
pluginNameName of the plugin.
pluginFileFull path to the plugin file.

Definition at line 893 of file ProcessorImplementationWindow.cc.

895 {
896
897 if (plugin_ != NULL) {
898 delete plugin_;
899 plugin_ = NULL;
900 }
901
902 // initialize the plugin tool
903 vector<string> pluginPaths = Environment::icDecoderPluginPaths();
904 for (vector<string>::const_iterator iter = pluginPaths.begin();
905 iter != pluginPaths.end(); iter++) {
906 try {
908 } catch (const FileNotFound&) {
909 }
910 }
911
912 try {
913 pluginTool_.registerModule(pluginFile);
914 } catch (const FileNotFound&) {
915 wxString message = _T("Plugin file '");
916 message.Append(WxConversion::toWxString(pluginFile));
917 message.Append(_T("' doesn't exist"));
918 ErrorDialog dialog(this, message);
919 dialog.ShowModal();
920 return;
921 } catch (Exception& e) {
922 wxString message = _T("Error loading plugin file '");
923 message.Append(WxConversion::toWxString(pluginFile));
924 message.Append(_T("':\n"));
925 message.Append(WxConversion::toWxString(e.errorMessage()));
926 ErrorDialog dialog(this, message);
927 dialog.ShowModal();
928 return;
929 }
930
931 ICDecoderGeneratorPlugin* (*creator)(
933
934 try {
936 "create_generator_plugin_" + pluginName, creator, pluginFile);
937
938 BEMGenerator generator(machine_);
939 BinaryEncoding* bem = generator.generate();
940 plugin_ = creator(machine_, *bem);
941 delete bem;
942 } catch (Exception& e) {
943 wxString message = _T("Error loading plugin '");
944 message.Append(WxConversion::toWxString(pluginName));
945 message.Append(_T("' from '"));
946 message.Append(WxConversion::toWxString(pluginFile));
947 message.Append(_T("':\n"));
948 message.Append(WxConversion::toWxString(e.errorMessage()));
949 ErrorDialog dialog(this, message);
950 dialog.ShowModal();
951 return;
952 }
953
954 try {
955 impl_.setICDecoderPluginFile(pluginFile);
956 } catch (FileNotFound& e) {
957 }
958 impl_.setICDecoderPluginName(pluginName);
959 assert(plugin_ != NULL);
960 return;
961}
static std::vector< std::string > icDecoderPluginPaths(bool libraryPathsOnly=false)
void setICDecoderPluginFile(const std::string &file)
void setICDecoderPluginName(const std::string &name)
void importSymbol(const std::string &symbolName, T *&target, const std::string &module)
void addSearchPath(const std::string &searchPath)
void registerModule(const std::string &module)
PluginTools pluginTool_
Plugintool for loading IC/Decoder plugins.

References PluginTools::addSearchPath(), assert, Exception::errorMessage(), BEMGenerator::generate(), Environment::icDecoderPluginPaths(), impl_, PluginTools::importSymbol(), machine_, plugin_, pluginTool_, PluginTools::registerModule(), IDF::MachineImplementation::setICDecoderPluginFile(), IDF::MachineImplementation::setICDecoderPluginName(), and WxConversion::toWxString().

Referenced by onBrowseICDecPlugin(), and onLoadIDF().

Here is the call graph for this function:

◆ onAutoSelectImplementations()

void ProcessorImplementationWindow::onAutoSelectImplementations ( wxCommandEvent &  event)
private

Event handler for the automatic implementation selection button.

Definition at line 288 of file ProcessorImplementationWindow.cc.

References impl_, machine_, and updateImplementationLists().

Here is the call graph for this function:

◆ onBrowseDecompressor()

void ProcessorImplementationWindow::onBrowseDecompressor ( wxCommandEvent &  event)
private

Event handler for the decompressor block Browse... button.

Definition at line 785 of file ProcessorImplementationWindow.cc.

785 {
786 wxFileDialog dialog(
787 this, _T("Choose a file"), _T(""), _T(""),
788 _T("Decompressor block files (*.vhdl;*.vhd)|*.vhdl;*.vhd|"
789 "All files|*"),
790 (wxOPEN | wxFILE_MUST_EXIST));
791
792 if (dialog.ShowModal() == wxID_OK) {
793 setDirty(true);
794 string decompressorFile =
795 WxConversion::toString(dialog.GetPath());
796
797 impl_.setDecompressorFile(decompressorFile);
798 }
799
801}
void setDecompressorFile(const std::string &file)

References impl_, IDF::MachineImplementation::setDecompressorFile(), setDirty(), WxConversion::toString(), and TransferDataToWindow().

Here is the call graph for this function:

◆ onBrowseICDecPlugin()

void ProcessorImplementationWindow::onBrowseICDecPlugin ( wxCommandEvent &  event)
private

Event handler for the ic/decoder plugin Browse... button.

Definition at line 808 of file ProcessorImplementationWindow.cc.

808 {
809
810 wxFileDialog dialog(
811 this, _T("Choose a file"), _T(""), _T(""),
812 _T("IC/Decoder plugins (*.so)|*.so|All files|*.*"),
813 (wxOPEN | wxFILE_MUST_EXIST));
814
815 if (dialog.ShowModal() == wxID_OK) {
816 setDirty(true);
817 string pluginFile =
818 WxConversion::toString(dialog.GetPath());
819
820 // An ugly way to determine the plugin name which should be the
821 // file name minus the "Plugin.so" ending.
822 string pluginName = FileSystem::fileOfPath(pluginFile);
823 pluginName = FileSystem::fileNameBody(pluginFile);
824 if (pluginName.length() < 6 ||
825 pluginName.substr(pluginName.length() - 6) != "Plugin") {
826
827 wxString message = _T("Unable to determine plugin name.\n");
828 message.Append(_T("Plugin file must be named "));
829 message.Append(_T("'<plugin name>Plugin.so'"));
830 ErrorDialog dialog(this, message);
831 dialog.ShowModal();
832 return;
833 }
834 pluginName = pluginName.substr(0, pluginName.length() - 6);
835 loadICDecoderPlugin(pluginName, pluginFile);
837 }
838
840}

References IDF::MachineImplementation::clearICDecoderParameters(), FileSystem::fileNameBody(), FileSystem::fileOfPath(), impl_, loadICDecoderPlugin(), setDirty(), WxConversion::toString(), and TransferDataToWindow().

Here is the call graph for this function:

◆ onBrowseICHDB()

void ProcessorImplementationWindow::onBrowseICHDB ( wxCommandEvent &  event)
private

Event handler for the ic/ hdb Browse... button.

Definition at line 847 of file ProcessorImplementationWindow.cc.

847 {
848
849 wxFileDialog dialog(
850 this, _T("Choose a file"), _T(""), _T(""),
851 _T("HDB Files (*.hdb)|*.hdb|All files|*.*"),
852 (wxOPEN | wxFILE_MUST_EXIST));
853
854 if (dialog.ShowModal() == wxID_OK) {
855 setDirty(true);
856 string hdbFile = WxConversion::toString(dialog.GetPath());
857 impl_.setICDecoderHDB(hdbFile);
858 }
859
861}
void setICDecoderHDB(const std::string &file)

References impl_, setDirty(), IDF::MachineImplementation::setICDecoderHDB(), WxConversion::toString(), and TransferDataToWindow().

Here is the call graph for this function:

◆ onClose()

void ProcessorImplementationWindow::onClose ( wxCommandEvent &  event)
private

Event handler for the Close button.

Definition at line 697 of file ProcessorImplementationWindow.cc.

697 {
698 if (dirtyData_) {
699 wxString message = _T("Save before exit?\n");
700
701 wxMessageDialog dialog(this, message, message, wxYES|wxCANCEL|wxNO);
702 int rv = dialog.ShowModal();
703 switch(rv) {
704 case wxID_NO:
705 break;
706 case wxID_YES:
707 doSaveIDF();
708 return;
709 case wxID_CANCEL:
710 default:
711 return;
712 }
713 }
714 Close();
715}

References dirtyData_, and doSaveIDF().

Here is the call graph for this function:

◆ onFUActivation()

void ProcessorImplementationWindow::onFUActivation ( wxListEvent &  e)
private

Event handler for the FU Select implementation doubleclick.

Definition at line 557 of file ProcessorImplementationWindow.cc.

557 {
558 handleSelectFUImplementation(e.GetIndex());
559}

References handleSelectFUImplementation().

Here is the call graph for this function:

◆ onFUSelection()

void ProcessorImplementationWindow::onFUSelection ( wxListEvent &  event)
private

Event handler for the FU list selection changes.

Enables and disables the select FU implementation button.

Definition at line 595 of file ProcessorImplementationWindow.cc.

595 {
596 if (fuList_->GetSelectedItemCount() == 1) {
597 FindWindow(ID_SELECT_FU_IMPL)->Enable();
598 } else {
599 FindWindow(ID_SELECT_FU_IMPL)->Disable();
600 }
601}

References fuList_, and ID_SELECT_FU_IMPL.

◆ onGenerateProcessor()

void ProcessorImplementationWindow::onGenerateProcessor ( wxCommandEvent &  event)
private

Event handler for the Generate Processor... button.

Definition at line 967 of file ProcessorImplementationWindow.cc.

967 {
968
969 IDFValidator validator(impl_, machine_);
970 if (!validator.validate()) {
971 wxString message;
972 for (int i = 0; i < validator.errorCount(); i++) {
973 message.Append(
974 WxConversion::toWxString(validator.errorMessage(i)));
975
976 message.Append(_T("\n"));
977 }
978 ErrorDialog dialog(this, message);
979 dialog.ShowModal();
980 return;
981 }
982
984 dialog.ShowModal();
985}

References IDFValidator::errorCount(), IDFValidator::errorMessage(), impl_, machine_, WxConversion::toWxString(), and IDFValidator::validate().

Here is the call graph for this function:

◆ onIUActivation()

void ProcessorImplementationWindow::onIUActivation ( wxListEvent &  e)
private

Event handler for the IU Select implementation doubleclick.

Definition at line 481 of file ProcessorImplementationWindow.cc.

481 {
482 handleSelectIUImplementation(e.GetIndex());
483}

References handleSelectIUImplementation().

Here is the call graph for this function:

◆ onIUSelection()

void ProcessorImplementationWindow::onIUSelection ( wxListEvent &  event)
private

Event handler for the IU list selection changes.

Enables and disables the select IU implementation button.

Definition at line 581 of file ProcessorImplementationWindow.cc.

581 {
582 if (iuList_->GetSelectedItemCount() == 1) {
583 FindWindow(ID_SELECT_IU_IMPL)->Enable();
584 } else {
585 FindWindow(ID_SELECT_IU_IMPL)->Disable();
586 }
587}

References ID_SELECT_IU_IMPL, and iuList_.

◆ onLoadIDF()

void ProcessorImplementationWindow::onLoadIDF ( wxCommandEvent &  event)
private

Event handler for the Load IDF... button.

Definition at line 621 of file ProcessorImplementationWindow.cc.

621 {
622
623 wxFileDialog dialog(
624 this, _T("Choose a file"), _T(""), _T(""),
625 _T("Implemenation Definition Files files (*.idf)|*.idf|All files|*"),
626 (wxOPEN | wxFILE_MUST_EXIST));
627
628 if (dialog.ShowModal() == wxID_OK) {
629
631
632 string idfFile =
633 WxConversion::toString(dialog.GetPath());
634
635 IDFSerializer serializer;
636 serializer.setSourceFile(idfFile);
637
638 try {
639 ObjectState* newIDF = serializer.readState();
640 impl_.loadState(newIDF);
641 delete newIDF;
642 } catch (Exception& e) {
643 impl_.loadState(old);
644 wxString message = _T("Error reading idf '");
645 message.Append(WxConversion::toWxString(idfFile));
646 message.Append(_T("':\n"));
647 message.Append(WxConversion::toWxString(e.errorMessage()));
648 ErrorDialog errorDialog(this, message);
649 errorDialog.ShowModal();
650 return;
651 }
652
653 IDFValidator validator(impl_, machine_);
654 if (!validator.validate()) {
655 wxString message = _T("Warning:\n");
656 for (int i = 0; i < validator.errorCount(); i++) {
657 message.Append(
658 WxConversion::toWxString(validator.errorMessage(i)));
659
660 message.Append(_T("\n"));
661 }
662 WarningDialog warningDialog(this, message);
663 warningDialog.ShowModal();
664
665 // Remove implementations of units that doesn't exist in the
666 // architecture.
668 }
669
670 // check and possibly correct file paths defined in IDF
672
673 try {
676
680 }
681 } catch (Exception& e) {
682 wxString msg = _T("Warning: could not load IC decoder plugin!");
683 WarningDialog warningDialog(this, msg);
684 warningDialog.ShowModal();
685 }
686
688 delete old;
689 }
690}
static void removeUnknownImplementations(IDF::MachineImplementation &idf, const TTAMachine::Machine &machine)
virtual ObjectState * readState()
std::string icDecoderPluginName() const
virtual void loadState(const ObjectState *state)
std::string icDecoderPluginFile() const
virtual ObjectState * saveState() const
void setSourceFile(const std::string &fileName)

References checkImplementationFiles(), IDFValidator::errorCount(), Exception::errorMessage(), IDFValidator::errorMessage(), IDF::MachineImplementation::hasICDecoderPluginFile(), IDF::MachineImplementation::hasICDecoderPluginName(), IDF::MachineImplementation::icDecoderPluginFile(), IDF::MachineImplementation::icDecoderPluginName(), impl_, loadICDecoderPlugin(), IDF::MachineImplementation::loadState(), machine_, IDF::IDFSerializer::readState(), IDFValidator::removeUnknownImplementations(), IDF::MachineImplementation::saveState(), XMLSerializer::setSourceFile(), WxConversion::toString(), WxConversion::toWxString(), TransferDataToWindow(), and IDFValidator::validate().

Here is the call graph for this function:

◆ onParameterSelection()

void ProcessorImplementationWindow::onParameterSelection ( wxListEvent &  event)
private

Event handler for the ic/decoder parameter list selection changes.

Enables and disables the set parameter value button.

Definition at line 609 of file ProcessorImplementationWindow.cc.

609 {
610 if (parameterList_->GetSelectedItemCount() == 1) {
611 FindWindow(ID_SET_VALUE)->Enable();
612 } else {
613 FindWindow(ID_SET_VALUE)->Disable();
614 }
615}

References ID_SET_VALUE, and parameterList_.

◆ onRFActivation()

void ProcessorImplementationWindow::onRFActivation ( wxListEvent &  e)
private

Event handler for the RF Select implementation button.

Definition at line 429 of file ProcessorImplementationWindow.cc.

429 {
430 handleSelectRFImplementation(e.GetIndex());
431}

References handleSelectRFImplementation().

Here is the call graph for this function:

◆ onRFSelection()

void ProcessorImplementationWindow::onRFSelection ( wxListEvent &  event)
private

Event handler for the RF list selection changes.

Enables and disables the select RF implementation button.

Definition at line 567 of file ProcessorImplementationWindow.cc.

567 {
568 if (rfList_->GetSelectedItemCount() == 1) {
569 FindWindow(ID_SELECT_RF_IMPL)->Enable();
570 } else {
571 FindWindow(ID_SELECT_RF_IMPL)->Disable();
572 }
573}

References ID_SELECT_RF_IMPL, and rfList_.

◆ onSaveIDF()

void ProcessorImplementationWindow::onSaveIDF ( wxCommandEvent &  event)
private

Event handler for the Save IDF button.

Definition at line 777 of file ProcessorImplementationWindow.cc.

777 {
778 doSaveIDF();
779}

References doSaveIDF().

Here is the call graph for this function:

◆ onSelectFUImplementation()

void ProcessorImplementationWindow::onSelectFUImplementation ( wxCommandEvent &  event)
private

Event handler for the FU Select implementation button.

Definition at line 540 of file ProcessorImplementationWindow.cc.

540 {
541 long item = -1;
542 item = fuList_->GetNextItem(
543 item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
544
545 if (item == -1) {
546 // No fu selected.
547 return;
548 }
549
551}

References fuList_, and handleSelectFUImplementation().

Here is the call graph for this function:

◆ onSelectIUImplementation()

void ProcessorImplementationWindow::onSelectIUImplementation ( wxCommandEvent &  event)
private

Event handler for the IU Select implementation button.

Definition at line 464 of file ProcessorImplementationWindow.cc.

464 {
465 long item = -1;
466 item = iuList_->GetNextItem(
467 item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
468
469 if (item == -1) {
470 // No iu selected.
471 return;
472 }
473
475}

References handleSelectIUImplementation(), and iuList_.

Here is the call graph for this function:

◆ onSelectRFImplementation()

void ProcessorImplementationWindow::onSelectRFImplementation ( wxCommandEvent &  event)
private

Event handler for the RF Select implementation button.

Definition at line 412 of file ProcessorImplementationWindow.cc.

412 {
413 long item = -1;
414 item = rfList_->GetNextItem(
415 item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
416
417 if (item == -1) {
418 // No rf selected.
419 return;
420 }
421
423}

References handleSelectRFImplementation(), and rfList_.

Here is the call graph for this function:

◆ onSetParameterValue()

void ProcessorImplementationWindow::onSetParameterValue ( wxCommandEvent &  event)
private

Event handler for the ic/decoder parameter value setting button.

Definition at line 868 of file ProcessorImplementationWindow.cc.

868 {
869
870 long item = -1;
871 item = parameterList_->GetNextItem(
872 item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
873
874 if (item < 0) return;
875
876 wxTextCtrl* valueCtrl = dynamic_cast<wxTextCtrl*>(
878
879 std::string name = plugin_->recognizedParameter(item);
880 std::string value = WxConversion::toString(valueCtrl->GetValue());
881 impl_.setICDecoderParameter(name, value);
883}
void setICDecoderParameter(const std::string &name, const std::string &value)
std::string recognizedParameter(int index) const

References ID_PARAMETER_VALUE, impl_, parameterList_, plugin_, ProGe::ICDecoderGeneratorPlugin::recognizedParameter(), IDF::MachineImplementation::setICDecoderParameter(), WxConversion::toString(), and TransferDataToWindow().

Here is the call graph for this function:

◆ registerFilePage()

wxSizer * ProcessorImplementationWindow::registerFilePage ( wxWindow *  parent,
bool  call_fit,
bool  set_sizer = true 
)
private

Definition at line 1111 of file ProcessorImplementationWindow.cc.

1112{
1113 wxFlexGridSizer *item0 = new wxFlexGridSizer( 1, 0, 0 );
1114 item0->AddGrowableCol( 0 );
1115 item0->AddGrowableRow( 0 );
1116
1117 wxListCtrl *item1 = new wxListCtrl( parent, ID_RF_LIST, wxDefaultPosition, wxDefaultSize, wxLC_REPORT|wxLC_SINGLE_SEL|wxSUNKEN_BORDER );
1118 item0->Add( item1, 0, wxGROW|wxALL, 5 );
1119
1120 wxBoxSizer *buttonSizer = new wxBoxSizer( wxHORIZONTAL );
1121 wxButton *autoSelButton = new wxButton( parent, ID_AUTO_SELECT_IMPL, wxT("Auto Select Implementations"), wxDefaultPosition, wxDefaultSize, 0 );
1122 buttonSizer->Add( autoSelButton, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
1123
1124 wxButton *item2 = new wxButton( parent, ID_SELECT_RF_IMPL, wxT("Select implementation..."), wxDefaultPosition, wxDefaultSize, 0 );
1125 buttonSizer->Add( item2, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
1126
1127 item0->Add( buttonSizer, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
1128
1129 if (set_sizer)
1130 {
1131 parent->SetSizer( item0 );
1132 if (call_fit)
1133 item0->SetSizeHints( parent );
1134 }
1135
1136 return item0;
1137}

References ID_AUTO_SELECT_IMPL, ID_RF_LIST, and ID_SELECT_RF_IMPL.

Referenced by createContents().

◆ setDirty()

void ProcessorImplementationWindow::setDirty ( bool  dirty = true)
inline

◆ TransferDataToWindow()

bool ProcessorImplementationWindow::TransferDataToWindow ( )
privatevirtual

Transfers data from the current MachineImplementation object to the dialog widgets.

Definition at line 189 of file ProcessorImplementationWindow.cc.

189 {
190
192 parameterList_->DeleteAllItems();
193
195 try {
196 dynamic_cast<wxTextCtrl*>(FindWindow(ID_IC_DEC_PLUGIN_FILE))->
198 } catch (FileNotFound& e) {
199 dynamic_cast<wxTextCtrl*>(FindWindow(ID_IC_DEC_PLUGIN_FILE))->
200 SetValue(WxConversion::toWxString("File not found"));
201 }
202 }
203
205 dynamic_cast<wxTextCtrl*>(FindWindow(ID_IC_DEC_PLUGIN_NAME))->
207 }
208
209 if (impl_.hasICDecoderHDB()) {
210 try {
211 dynamic_cast<wxTextCtrl*>(FindWindow(ID_IC_DEC_HDB_FILE))->
213 } catch (FileNotFound& e) {
214 dynamic_cast<wxTextCtrl*>(FindWindow(ID_IC_DEC_HDB_FILE))->
215 SetValue(WxConversion::toWxString("File not found"));
216 }
217 }
218
219
220 wxTextCtrl* descCtrl = dynamic_cast<wxTextCtrl*>(
222
223 // Set IC&decoder generator plugin attributes.
224 if (plugin_ != NULL) {
225
226 descCtrl->SetValue(
228
229 // IC / Decoder plugin parameters.
230 for (int i = 0; i < plugin_->recognizedParameterCount(); i++) {
231 string paramName = plugin_->recognizedParameter(i);
232 string paramValue =
234 string paramDesc = plugin_->parameterDescription(paramName);
235 parameterList_->InsertItem(i, WxConversion::toWxString(paramName));
236 parameterList_->SetItem(
237 i, 1, WxConversion::toWxString(paramValue));
238 parameterList_->SetItem(
239 i, 2, WxConversion::toWxString(paramDesc));
240 }
241 parameterList_->SetColumnWidth(2, wxLIST_AUTOSIZE);
242 } else {
243 descCtrl->SetValue(_T("\n No IC / Decoder plugin loaded."));
244 }
245
247 try {
248 dynamic_cast<wxTextCtrl*>(FindWindow(ID_DECOMPRESSOR_PATH))->
250 } catch (FileNotFound& e) {
251 wxString message =
252 _T("Unable to set decompressor block file:\n");
253
254 WarningDialog dialog(this, message);
255 dialog.ShowModal();
256 }
257 }
258
259 return true;
260}
std::string icDecoderParameterValue(const std::string &name) const
std::string parameterDescription(const std::string &paramName) const

References IDF::MachineImplementation::decompressorFile(), IDF::MachineImplementation::hasDecompressorFile(), IDF::MachineImplementation::hasICDecoderHDB(), IDF::MachineImplementation::hasICDecoderPluginFile(), IDF::MachineImplementation::hasICDecoderPluginName(), IDF::MachineImplementation::icDecoderHDB(), IDF::MachineImplementation::icDecoderParameterValue(), IDF::MachineImplementation::icDecoderPluginFile(), IDF::MachineImplementation::icDecoderPluginName(), ID_DECOMPRESSOR_PATH, ID_IC_DEC_HDB_FILE, ID_IC_DEC_PLUGIN_DESC, ID_IC_DEC_PLUGIN_FILE, ID_IC_DEC_PLUGIN_NAME, impl_, ProGe::ICDecoderGeneratorPlugin::parameterDescription(), parameterList_, plugin_, ProGe::ICDecoderGeneratorPlugin::pluginDescription(), ProGe::ICDecoderGeneratorPlugin::recognizedParameter(), ProGe::ICDecoderGeneratorPlugin::recognizedParameterCount(), WxConversion::toWxString(), and updateImplementationLists().

Referenced by handleSelectIUImplementation(), onBrowseDecompressor(), onBrowseICDecPlugin(), onBrowseICHDB(), onLoadIDF(), and onSetParameterValue().

Here is the call graph for this function:

◆ updateFUList()

void ProcessorImplementationWindow::updateFUList ( const std::string &  fuName,
int  index 
)
private

Update the list of FU implementations for single FU

Definition at line 488 of file ProcessorImplementationWindow.cc.

488 {
489 const FUImplementationLocation fuImpl =
490 impl_.fuImplementation(fuName);
491
492 string hdb;
493 int id = 0;
494 try {
495 hdb = Environment::shortHDBPath(fuImpl.hdbFile());
496 id = fuImpl.id();
497 } catch (FileNotFound& e) {
498 hdb = "Warning: " + e.errorMessage();
499 }
500
501 fuList_->SetItem(index, 1, WxConversion::toWxString(id));
502 fuList_->SetItem(index, 2, WxConversion::toWxString(hdb));
503}
static TCEString shortHDBPath(const TCEString &hdbPath)

References Exception::errorMessage(), IDF::MachineImplementation::fuImplementation(), fuList_, IDF::UnitImplementationLocation::hdbFile(), IDF::UnitImplementationLocation::id(), impl_, Environment::shortHDBPath(), and WxConversion::toWxString().

Referenced by handleSelectFUImplementation().

Here is the call graph for this function:

◆ updateImplementationLists()

void ProcessorImplementationWindow::updateImplementationLists ( )
private

Updates the list views on RF, IU and FU pages.

Definition at line 298 of file ProcessorImplementationWindow.cc.

298 {
299 fuList_->DeleteAllItems();
300 rfList_->DeleteAllItems();
301 iuList_->DeleteAllItems();
302
303 // FU implementation list.
306
307 for (int i = 0; i < fuNav.count(); i++) {
308 string fuName = fuNav.item(i)->name();
309 fuList_->InsertItem(i, WxConversion::toWxString(fuName));
310 if (impl_.hasFUImplementation(fuName)) {
311 const FUImplementationLocation fuImpl =
312 impl_.fuImplementation(fuName);
313
314 string hdb;
315 int id = 0;
316 try {
317 hdb = Environment::shortHDBPath(fuImpl.hdbFile());
318 id = fuImpl.id();
319 } catch (FileNotFound& e) {
320 hdb = "Warning: " + e.errorMessage();
321 }
322
323 fuList_->SetItem(i, 1, WxConversion::toWxString(id));
324 fuList_->SetItem(i, 2, WxConversion::toWxString(hdb));
325 }
326 }
327
328 // RF implementation list.
331
332 for (int i = 0; i < rfNav.count(); i++) {
333 string rfName = rfNav.item(i)->name();
334 rfList_->InsertItem(i, WxConversion::toWxString(rfName));
335 if (impl_.hasRFImplementation(rfName)) {
336 const RFImplementationLocation rfImpl =
337 impl_.rfImplementation(rfName);
338
339 string hdb;
340 int id = 0;
341 try {
342 hdb = Environment::shortHDBPath(rfImpl.hdbFile());
343 id = rfImpl.id();
344 } catch (FileNotFound& e) {
345 hdb = "Warning: " + e.errorMessage();
346 }
347 rfList_->SetItem(i, 1, WxConversion::toWxString(id));
348 rfList_->SetItem(i, 2, WxConversion::toWxString(hdb));
349 }
350 }
351
352 // IU implementation list.
355
356 for (int i = 0; i < iuNav.count(); i++) {
357 string iuName = iuNav.item(i)->name();
358 iuList_->InsertItem(i, WxConversion::toWxString(iuName));
359 if (impl_.hasIUImplementation(iuName)) {
360 const RFImplementationLocation iuImpl =
361 impl_.iuImplementation(iuName);
362
363 string hdb;
364 int id = 0;
365 try {
366 hdb = Environment::shortHDBPath(iuImpl.hdbFile());
367 id = iuImpl.id();
368 } catch (FileNotFound& e) {
369 hdb = "Warning: " + e.errorMessage();
370 }
371 iuList_->SetItem(i, 1, WxConversion::toWxString(id));
372 iuList_->SetItem(i, 2, WxConversion::toWxString(hdb));
373 }
374 }
375}

References TTAMachine::Machine::Navigator< ComponentType >::count(), Exception::errorMessage(), IDF::MachineImplementation::fuImplementation(), fuList_, TTAMachine::Machine::functionUnitNavigator(), IDF::MachineImplementation::hasFUImplementation(), IDF::MachineImplementation::hasIUImplementation(), IDF::MachineImplementation::hasRFImplementation(), IDF::UnitImplementationLocation::hdbFile(), IDF::UnitImplementationLocation::id(), TTAMachine::Machine::immediateUnitNavigator(), impl_, TTAMachine::Machine::Navigator< ComponentType >::item(), IDF::MachineImplementation::iuImplementation(), iuList_, machine_, TTAMachine::Machine::registerFileNavigator(), IDF::MachineImplementation::rfImplementation(), rfList_, Environment::shortHDBPath(), and WxConversion::toWxString().

Referenced by onAutoSelectImplementations(), and TransferDataToWindow().

Here is the call graph for this function:

◆ updateRFList()

void ProcessorImplementationWindow::updateRFList ( const std::string &  rfName,
int  index 
)
private

Update the list of FU implementations for single RF

Definition at line 266 of file ProcessorImplementationWindow.cc.

266 {
267 const RFImplementationLocation rfImpl =
268 impl_.rfImplementation(rfName);
269
270 string hdb;
271 int id = 0;
272 try {
273 hdb = Environment::shortHDBPath(rfImpl.hdbFile());
274 id = rfImpl.id();
275 } catch (FileNotFound& e) {
276 hdb = "Warning: " + e.errorMessage();
277 }
278 rfList_->SetItem(index, 1, WxConversion::toWxString(id));
279 rfList_->SetItem(index, 2, WxConversion::toWxString(hdb));
280}

References Exception::errorMessage(), IDF::UnitImplementationLocation::hdbFile(), IDF::UnitImplementationLocation::id(), impl_, IDF::MachineImplementation::rfImplementation(), rfList_, Environment::shortHDBPath(), and WxConversion::toWxString().

Referenced by handleSelectRFImplementation().

Here is the call graph for this function:

Member Data Documentation

◆ dirtyData_

bool ProcessorImplementationWindow::dirtyData_
private

Definition at line 166 of file ProcessorImplementationWindow.hh.

Referenced by onClose(), and setDirty().

◆ fuList_

wxListCtrl* ProcessorImplementationWindow::fuList_
private

Pointer to the FU implementation list widget.

Definition at line 123 of file ProcessorImplementationWindow.hh.

Referenced by onFUSelection(), onSelectFUImplementation(), updateFUList(), and updateImplementationLists().

◆ impl_

IDF::MachineImplementation& ProcessorImplementationWindow::impl_
private

◆ iuList_

wxListCtrl* ProcessorImplementationWindow::iuList_
private

Pointer to the IU implementation list widget.

Definition at line 125 of file ProcessorImplementationWindow.hh.

Referenced by onIUSelection(), onSelectIUImplementation(), and updateImplementationLists().

◆ machine_

TTAMachine::Machine& ProcessorImplementationWindow::machine_
private

◆ parameterList_

wxListCtrl* ProcessorImplementationWindow::parameterList_
private

Pointer to the ic decoder parameter list widget.

Definition at line 129 of file ProcessorImplementationWindow.hh.

Referenced by onParameterSelection(), onSetParameterValue(), and TransferDataToWindow().

◆ plugin_

ProGe::ICDecoderGeneratorPlugin* ProcessorImplementationWindow::plugin_
private

IC/Decoder plugin of the current machine implementation.

Definition at line 134 of file ProcessorImplementationWindow.hh.

Referenced by loadICDecoderPlugin(), onSetParameterValue(), and TransferDataToWindow().

◆ pluginTool_

PluginTools ProcessorImplementationWindow::pluginTool_
private

Plugintool for loading IC/Decoder plugins.

Definition at line 132 of file ProcessorImplementationWindow.hh.

Referenced by loadICDecoderPlugin().

◆ rfList_

wxListCtrl* ProcessorImplementationWindow::rfList_
private

Pointer to the RF implementation list widget.

Definition at line 127 of file ProcessorImplementationWindow.hh.

Referenced by onRFSelection(), onSelectRFImplementation(), updateImplementationLists(), and updateRFList().


The documentation for this class was generated from the following files: