OpenASIP  2.0
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.

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 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 }

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.

114  {
116 }

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 }

References ProDeConstants::CMD_SNAME_VLIW_CONNECT_IC.


The documentation for this class was generated from the following files:
ILLEGAL_ROW_ID
#define ILLEGAL_ROW_ID
Definition: DSDBManager.hh:58
FileSystem::removeFileOrDirectory
static bool removeFileOrDirectory(const std::string &path)
Definition: FileSystem.cc:493
machine
TTAMachine::Machine * machine
the architecture definition of the estimated processor
Definition: EstimatorCmdLineUI.cc:59
DSDBManager::architecture
TTAMachine::Machine * architecture(RowID id) const
Definition: DSDBManager.cc:807
DesignSpaceExplorerPlugin
Definition: DesignSpaceExplorerPlugin.hh:55
RowID
int RowID
Type definition of row ID in relational databases.
Definition: DBTypes.hh:37
ProDeConstants::CMD_NAME_VLIW_CONNECT_IC
static const std::string CMD_NAME_VLIW_CONNECT_IC
Command name for the "VLIW Connect IC" command.
Definition: ProDeConstants.hh:149
Model::pushToStack
void pushToStack()
Definition: Model.cc:167
EditorCommand::EditorCommand
EditorCommand(std::string name, wxWindow *parent=NULL)
Definition: EditorCommand.cc:42
Model::notifyObservers
void notifyObservers(bool modified=true)
Definition: Model.cc:152
assert
#define assert(condition)
Definition: Application.hh:86
DSDBManager::MachineConfiguration
Definition: DSDBManager.hh:78
EditorCommand::view
wxView * view() const
Definition: EditorCommand.cc:76
Exception
Definition: Exception.hh:54
DSDBManager
Definition: DSDBManager.hh:76
DesignSpaceExplorer::loadExplorerPlugin
static DesignSpaceExplorerPlugin * loadExplorerPlugin(const std::string &pluginName, DSDBManager *dsdb=NULL)
Definition: DesignSpaceExplorer.cc:527
Model::popFromStack
void popFromStack(bool modified=false)
Definition: Model.cc:195
MDFDocument
Definition: MDFDocument.hh:51
DSDBManager::addConfiguration
RowID addConfiguration(const MachineConfiguration &conf)
Definition: DSDBManager.cc:299
DSDBManager::addArchitecture
RowID addArchitecture(const TTAMachine::Machine &mom)
Definition: DSDBManager.cc:191
DSDBManager::createNew
static DSDBManager * createNew(const std::string &file)
Definition: DSDBManager.cc:141
DesignSpaceExplorerPlugin::explore
virtual std::vector< RowID > explore(const RowID &startPointConfigurationID, const unsigned int &maxIter=0)
Definition: DesignSpaceExplorerPlugin.cc:174
Model
Definition: Model.hh:50
DesignSpaceExplorer::setDSDB
virtual void setDSDB(DSDBManager &dsdb)
Definition: DesignSpaceExplorer.cc:107
VLIWConnectICCmd::VLIWConnectICCmd
VLIWConnectICCmd()
Definition: VLIWConnectICCmd.cc:51
ProDeConstants::COMMAND_VLIW_CONNECT_IC
@ COMMAND_VLIW_CONNECT_IC
Definition: ProDeConstants.hh:455
TTAMachine::Machine::copyFromMachine
virtual void copyFromMachine(Machine &machine)
Definition: Machine.cc:890
DesignSpaceExplorer
Definition: DesignSpaceExplorer.hh:70
ProDeConstants::CMD_SNAME_VLIW_CONNECT_IC
static const std::string CMD_SNAME_VLIW_CONNECT_IC
Command name for the "VLIW Connect IC" command.
Definition: ProDeConstants.hh:245
TTAMachine::Machine
Definition: Machine.hh:73