OpenASIP 2.2
Loading...
Searching...
No Matches
Public Member Functions | List of all members
VLIWConnectICCmd Class Reference

#include <VLIWConnectICCmd.hh>

Inheritance diagram for VLIWConnectICCmd:
Inheritance graph
Collaboration diagram for VLIWConnectICCmd:
Collaboration graph

Public Member Functions

 VLIWConnectICCmd ()
 
virtual ~VLIWConnectICCmd ()
 
virtual bool Do ()
 
virtual int id () const
 
virtual VLIWConnectICCmdcreate () const
 
virtual bool isEnabled ()
 
virtual std::string shortName () const
 
- Public Member Functions inherited from EditorCommand
 EditorCommand (std::string name, wxWindow *parent=NULL)
 
virtual ~EditorCommand ()
 
void setView (wxView *view)
 
wxView * view () const
 
virtual std::string icon () const
 
- Public Member Functions inherited from GUICommand
 GUICommand (std::string name, wxWindow *parent)
 
virtual ~GUICommand ()
 
virtual bool isChecked () const
 
void setParentWindow (wxWindow *view)
 
wxWindow * parentWindow () const
 
std::string name () const
 

Detailed Description

Command for calling VLIWConnectIC explorer plugin.

Definition at line 42 of file VLIWConnectICCmd.hh.

Constructor & Destructor Documentation

◆ VLIWConnectICCmd()

VLIWConnectICCmd::VLIWConnectICCmd ( )

Definition at line 51 of file VLIWConnectICCmd.cc.

51 :
53}
static const std::string CMD_NAME_VLIW_CONNECT_IC
Command name for the "VLIW Connect IC" command.

Referenced by create().

◆ ~VLIWConnectICCmd()

VLIWConnectICCmd::~VLIWConnectICCmd ( )
virtual

Definition at line 56 of file VLIWConnectICCmd.cc.

56{}

Member Function Documentation

◆ create()

VLIWConnectICCmd * VLIWConnectICCmd::create ( ) const
virtual

Creates and returns a new instance of this command.

Implements GUICommand.

Definition at line 123 of file VLIWConnectICCmd.cc.

123 {
124 return new VLIWConnectICCmd();
125}

References VLIWConnectICCmd().

Here is the call graph for this function:

◆ Do()

bool VLIWConnectICCmd::Do ( )
virtual

Executes the command.

Returns
True, if the command was succesfully executed, false otherwise.

Implements GUICommand.

Definition at line 65 of file VLIWConnectICCmd.cc.

65 {
66
67 assert(view() != NULL);
68
69 TTAMachine::Machine* machine = dynamic_cast<MDFDocument*>(
70 view()->GetDocument())->getModel()->getMachine();
71
72 Model* model = dynamic_cast<MDFDocument*>(
73 view()->GetDocument())->getModel();
74
75 model->pushToStack();
76
77 // open up a temporary dsdb
78 const std::string dsdbFile = "tmp.dsdb";
80 DSDBManager* dsdb = DSDBManager::createNew(dsdbFile);
81 RowID archID = dsdb->addArchitecture(*machine);
82
84 RowID confID = dsdb->addConfiguration(confIn);
85
86 // load VLIWConnectIC explorer plugin
87 DesignSpaceExplorer explorer;
89 explorer.loadExplorerPlugin("VLIWConnectIC", dsdb);
90 plugin->setDSDB(*dsdb);
91
92 try {
93 std::vector<RowID> result = plugin->explore(confID, 0);
94 // store the new machine
95 TTAMachine::Machine& newMachine =
96 *dsdb->architecture(confID+result.size());
97 machine->copyFromMachine(newMachine);
98 } catch (Exception const& e) {
99 std::cerr << "Could not create VLIW Connect IC" << std::endl;
101 model->popFromStack();
102 return false;
103 }
105 model->notifyObservers();
106
107 return true;
108}
#define assert(condition)
int RowID
Type definition of row ID in relational databases.
Definition DBTypes.hh:37
#define ILLEGAL_ROW_ID
TTAMachine::Machine * machine
the architecture definition of the estimated processor
RowID addArchitecture(const TTAMachine::Machine &mom)
TTAMachine::Machine * architecture(RowID id) const
static DSDBManager * createNew(const std::string &file)
RowID addConfiguration(const MachineConfiguration &conf)
virtual std::vector< RowID > explore(const RowID &startPointConfigurationID, const unsigned int &maxIter=0)
virtual void setDSDB(DSDBManager &dsdb)
static DesignSpaceExplorerPlugin * loadExplorerPlugin(const std::string &pluginName, DSDBManager *dsdb=NULL)
wxView * view() const
static bool removeFileOrDirectory(const std::string &path)
Definition Model.hh:50
void pushToStack()
Definition Model.cc:167
void notifyObservers(bool modified=true)
Definition Model.cc:152
void popFromStack(bool modified=false)
Definition Model.cc:195
virtual void copyFromMachine(Machine &machine)
Definition Machine.cc:884

References DSDBManager::addArchitecture(), DSDBManager::addConfiguration(), DSDBManager::architecture(), assert, TTAMachine::Machine::copyFromMachine(), DSDBManager::createNew(), DesignSpaceExplorerPlugin::explore(), ILLEGAL_ROW_ID, DesignSpaceExplorer::loadExplorerPlugin(), machine, Model::notifyObservers(), Model::popFromStack(), Model::pushToStack(), FileSystem::removeFileOrDirectory(), DesignSpaceExplorer::setDSDB(), and EditorCommand::view().

Here is the call graph for this function:

◆ id()

int VLIWConnectICCmd::id ( ) const
virtual

Returns id of this command.

Implements GUICommand.

Definition at line 114 of file VLIWConnectICCmd.cc.

References ProDeConstants::COMMAND_VLIW_CONNECT_IC.

◆ isEnabled()

bool VLIWConnectICCmd::isEnabled ( )
virtual

Returns true when the command is executable, false when not.

This command is executable when a document is open.

Returns
True, if a document is open.

Reimplemented from EditorCommand.

Definition at line 145 of file VLIWConnectICCmd.cc.

145 {
146
147 wxDocManager* manager = wxGetApp().docManager();
148 wxView* view = manager->GetCurrentView();
149
150 if (view == NULL) {
151 return false;
152 }
153
154 Model* model = dynamic_cast<MDFDocument*>(
155 view->GetDocument())->getModel();
156
157 if (model == NULL) {
158 return false;
159 }
160 return true;
161}

References EditorCommand::view().

Here is the call graph for this function:

◆ shortName()

std::string VLIWConnectICCmd::shortName ( ) const
virtual

Returns short version of the command name.

Reimplemented from GUICommand.

Definition at line 132 of file VLIWConnectICCmd.cc.

132 {
134}
static const std::string CMD_SNAME_VLIW_CONNECT_IC
Command name for the "VLIW Connect IC" command.

References ProDeConstants::CMD_SNAME_VLIW_CONNECT_IC.


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