OpenASIP
2.0
|
#include <OperationDialog.hh>
Public Member Functions | |
OperationDialog (wxWindow *parent, TTAMachine::HWOperation *operation) | |
~OperationDialog () | |
Private Member Functions | |
wxSizer * | createContents (wxWindow *parent, bool call_fit, bool set_sizer) |
bool | TransferDataToWindow () |
void | initialize () |
void | setTexts () |
void | updateOperandList () |
void | updateResourceGrid () |
void | updateUsageGrid () |
void | updateLatency () |
void | setOperandType (int operand, bool read) |
void | warnOnResourcesWithoutUsages () |
void | onAddOperand (wxCommandEvent &event) |
void | onDeleteOperand (wxCommandEvent &event) |
void | onBindOperand (wxCommandEvent &event) |
void | onAddResource (wxCommandEvent &event) |
void | onDeleteResource (wxCommandEvent &event) |
void | onOK (wxCommandEvent &event) |
void | onName (wxCommandEvent &event) |
void | onOperandSelection (wxListEvent &event) |
void | onResourceSelection (wxGridRangeSelectEvent &event) |
void | onResourceLClick (wxGridEvent &event) |
void | onOperandLClick (wxGridEvent &event) |
void | onGridLClick (wxGridEvent &event) |
void | onGridRClick (wxGridEvent &event) |
std::string | selectedResource () |
int | operandRow (int operand) |
Private Attributes | |
TTAMachine::HWOperation * | operation_ |
Operation to edit. More... | |
wxString | name_ |
Name of the operation. More... | |
wxString | resourceName_ |
Name of resource to be added. More... | |
wxListCtrl * | bindList_ |
Bind list widget. More... | |
wxSpinCtrl * | numberControl_ |
Spin button control for the bind operand. More... | |
wxGrid * | resourceGrid_ |
Resource list widget. More... | |
wxGrid * | usageGrid_ |
Operand usage grid widget. More... | |
wxChoice * | portChoice_ |
Choice widget for the port to bind. More... | |
wxStaticBoxSizer * | resourceSizer_ |
Static boxsizer for the resource grid widgets. More... | |
wxStaticBoxSizer * | operandSizer_ |
Static boxsizer for the operand list widgets. More... | |
wxStaticBoxSizer * | usageSizer_ |
Static boxsizer for the operand usage grid widgets. More... | |
std::list< std::string > | newResources_ |
List of unused resources. More... | |
std::set< int > | operands_ |
List of unused operands. More... | |
wxStaticText * | latencyText_ |
Static text control displaying the operation latency. More... | |
Static Private Attributes | |
static const int | GRID_COLUMN_WIDTH = 25 |
Width of the resource and operand usage grid columns. More... | |
static const wxString | USE_MARK = _T("X") |
Grid marker for resource use. More... | |
static const wxString | READ_MARK = _T("R") |
Grid marker for a read. More... | |
static const wxString | WRITE_MARK = _T("W") |
Grid marker for a write. More... | |
Dialog for editing HWOperation properties.
Definition at line 49 of file OperationDialog.hh.
|
private |
Definition at line 128 of file OperationDialog.hh.
OperationDialog::OperationDialog | ( | wxWindow * | parent, |
TTAMachine::HWOperation * | operation | ||
) |
The Constructor.
parent | Parent window of the dialog. |
operation | Operation to modify. |
Definition at line 100 of file OperationDialog.cc.
OperationDialog::~OperationDialog | ( | ) |
|
private |
Creates the dialog contents.
This function was generated by wxDesigner.
parent | The dialog window. |
call_fit | If true, fits the contents inside the dialog. |
set_sizer | If true, sets the main sizer as dialog contents. |
Definition at line 1093 of file OperationDialog.cc.
|
private |
Initializes the dialog widgets and some class variables.
Definition at line 128 of file OperationDialog.cc.
References ProDeConstants::BLACK_COLOR, and ProDeConstants::WHITE_COLOR.
|
private |
Handles the Add bind button event.
Adds a bind to the operation according to the number and port selection widgets.
Definition at line 754 of file OperationDialog.cc.
References ProDeTextGenerator::instance(), ProDeTextGenerator::MSG_ERROR_OPERAND_NUM_RESERVED, Texts::TextGenerator::text(), and WxConversion::toWxString().
|
private |
Handles the Add resource button event.
Opens pipeline resource dialog for adding a new resource to the operation.
Definition at line 948 of file OperationDialog.cc.
References ProDeTextGenerator::COMP_A_RESOURCE, ProDeTextGenerator::COMP_FUNCTION_UNIT, ProDeTextGenerator::COMP_RESOURCE, ContainerTools::containsValue(), ProDeTextGenerator::instance(), MachineTester::isValidComponentName(), ProDeTextGenerator::MSG_ERROR_ILLEGAL_NAME, ProDeTextGenerator::MSG_ERROR_SAME_NAME, Texts::TextGenerator::text(), WxConversion::toString(), and WxConversion::toWxString().
|
private |
Event handler for the operand port binding choicer.
Definition at line 842 of file OperationDialog.cc.
References WidgetTools::lcStringSelection(), TTAMachine::FunctionUnit::operationPort(), TTAMachine::BaseFUPort::parentUnit(), Conversion::toInt(), and WxConversion::toString().
|
private |
Removes the selected bind from the operation.
Definition at line 786 of file OperationDialog.cc.
References ContainerTools::containsValue(), ProDeTextGenerator::instance(), TTAMachine::ExecutionPipeline::latency(), WidgetTools::lcStringSelection(), ProDeTextGenerator::MSG_CONFIRM_OPERAND_DELETION, ProDeTextGenerator::MSG_ERROR_PIPELINE_START, TTAMachine::ExecutionPipeline::readOperands(), TTAMachine::ExecutionPipeline::removeOperandUse(), ContainerTools::removeValueIfExists(), Texts::TextGenerator::text(), Conversion::toInt(), WxConversion::toWxString(), and TTAMachine::ExecutionPipeline::writtenOperands().
|
private |
Handles the delete resource button event.
Deletes the selected resource usage from the operation.
Definition at line 993 of file OperationDialog.cc.
References ProDeTextGenerator::instance(), ProDeTextGenerator::MSG_ERROR_PIPELINE_START, ContainerTools::removeValueIfExists(), Texts::TextGenerator::text(), and WxConversion::toWxString().
|
private |
Handles the left mouse button event in both grids.
The event is passed to the grid specific handler.
event | The mouse event to handle. |
Definition at line 536 of file OperationDialog.cc.
|
private |
Handles the right mouse button event in both grids.
event | The mouse event to handle. |
Definition at line 550 of file OperationDialog.cc.
|
private |
Checks whether name field is empty and disables OK button of the dialog if it is.
Definition at line 723 of file OperationDialog.cc.
References assert.
|
private |
Handles the OK-button event.
Updates the operation and closes the dialog.
Definition at line 1027 of file OperationDialog.cc.
References ProDeTextGenerator::COMP_AN_OPERATION, ProDeTextGenerator::COMP_MACHINE, ProDeTextGenerator::COMP_OPERATION, ProDeTextGenerator::instance(), MachineTester::isValidComponentName(), ProDeTextGenerator::MSG_ERROR_ILLEGAL_NAME, ProDeTextGenerator::MSG_ERROR_SAME_NAME, Texts::TextGenerator::text(), WxConversion::toString(), and WxConversion::toWxString().
|
private |
Handles left mouse button clicks in the operand usage grid.
event | The mouse event to handle. |
Definition at line 622 of file OperationDialog.cc.
References TTAMachine::ExecutionPipeline::addPortRead(), TTAMachine::ExecutionPipeline::addPortWrite(), assert, ContainerTools::containsValue(), ProDeTextGenerator::instance(), ProDeTextGenerator::MSG_ERROR_PIPELINE_START, TTAMachine::ExecutionPipeline::readOperands(), TTAMachine::ExecutionPipeline::removeOperandUse(), Texts::TextGenerator::text(), WxConversion::toWxString(), and TTAMachine::ExecutionPipeline::writtenOperands().
|
private |
Handles the bind list item selection events.
Enables and disables the delete bind button according to the selection.
Definition at line 869 of file OperationDialog.cc.
References WidgetTools::lcStringSelection(), TTAMachine::Port::name(), TTAMachine::FunctionUnit::operationPort(), TTAMachine::BaseFUPort::parentUnit(), Conversion::toInt(), and WxConversion::toWxString().
|
private |
Handles left mouse button cliks in the resource grid.
event | The mouse event to handle. |
Definition at line 563 of file OperationDialog.cc.
References TTAMachine::ExecutionPipeline::addResourceUse(), ProDeTextGenerator::instance(), ProDeTextGenerator::MSG_ERROR_PIPELINE_START, TTAMachine::ExecutionPipeline::removeResourceUse(), ContainerTools::removeValueIfExists(), Texts::TextGenerator::text(), WxConversion::toString(), and WxConversion::toWxString().
|
private |
Handles the resource list item selection events.
Enables and disables the edit and delete resource buttons according to the selection.
Definition at line 911 of file OperationDialog.cc.
|
private |
Returns row nubmer of the operand in the resource usage grid.
Returns -1 if the operand is not found.
Operand | to search. |
Definition at line 516 of file OperationDialog.cc.
|
private |
Returns name of the resource selected in the resource grid.
If a resource is not selected, an empty string is returned.
Definition at line 927 of file OperationDialog.cc.
References WxConversion::toString().
|
private |
Sets operand row label read/write flag.
operand | Operand to set the label to. |
read | True if operand is read, false if written. |
Definition at line 463 of file OperationDialog.cc.
References assert, and WxConversion::toWxString().
|
private |
Sets texts for widgets.
Definition at line 170 of file OperationDialog.cc.
References GUITextGenerator::instance(), ProDeTextGenerator::instance(), WidgetTools::setLabel(), WidgetTools::setWidgetLabel(), Texts::TextGenerator::text(), WxConversion::toWxString(), GUITextGenerator::TXT_BUTTON_ADD, GUITextGenerator::TXT_BUTTON_CANCEL, GUITextGenerator::TXT_BUTTON_DELETE, GUITextGenerator::TXT_BUTTON_HELP, GUITextGenerator::TXT_BUTTON_OK, ProDeTextGenerator::TXT_COLUMN_OPERAND, ProDeTextGenerator::TXT_COLUMN_PORT, ProDeTextGenerator::TXT_LABEL_NAME, ProDeTextGenerator::TXT_LABEL_OPERAND, ProDeTextGenerator::TXT_LABEL_PORT, ProDeTextGenerator::TXT_OPERATION_DIALOG_TITLE, ProDeTextGenerator::TXT_OPERATION_OPERANDS_BOX, ProDeTextGenerator::TXT_OPERATION_RESOURCES_BOX, and ProDeTextGenerator::TXT_OPERATION_USAGE_BOX.
|
private |
Transfers data from the operation object to the dialog widgets.
Definition at line 243 of file OperationDialog.cc.
References WxConversion::toWxString().
|
private |
Updates the latency information static text widget.
Definition at line 1077 of file OperationDialog.cc.
References WxConversion::toWxString().
|
private |
Updates the operand bind list.
Definition at line 256 of file OperationDialog.cc.
References dummy, TTAMachine::ExecutionPipeline::latency(), TTAMachine::FunctionUnit::operationPort(), TTAMachine::BaseFUPort::parentUnit(), TTAMachine::ExecutionPipeline::readOperands(), WxConversion::toWxString(), and TTAMachine::ExecutionPipeline::writtenOperands().
|
private |
Updates the list of pipeline resources.
Definition at line 312 of file OperationDialog.cc.
References TTAMachine::ExecutionPipeline::isResourceUsed(), TTAMachine::ExecutionPipeline::latency(), TTAMachine::PipelineElement::name(), TTAMachine::FunctionUnit::pipelineElement(), TTAMachine::FunctionUnit::pipelineElementCount(), and WxConversion::toWxString().
|
private |
Updates the operand usage grid.
If a resource is selected in the resource grid, the grid is enabled for editing and it displays the operand usage only for the selected resource. If a resource isn't selected, the grid will be disabled, and it displays summary of the operand use for all resources.
Definition at line 393 of file OperationDialog.cc.
References assert, TTAMachine::ExecutionPipeline::latency(), TTAMachine::ExecutionPipeline::readOperands(), WxConversion::toWxString(), and TTAMachine::ExecutionPipeline::writtenOperands().
|
private |
Warns if pipeline resources without usages exist
Definition at line 482 of file OperationDialog.cc.
References ProDeTextGenerator::instance(), TTAMachine::ExecutionPipeline::isResourceUsed(), TTAMachine::ExecutionPipeline::latency(), ProDeTextGenerator::MSG_WARN_RES_WITHOUT_USAGES, Texts::TextGenerator::text(), and WxConversion::toWxString().
|
private |
Bind list widget.
Definition at line 93 of file OperationDialog.hh.
|
staticprivate |
Width of the resource and operand usage grid columns.
Definition at line 119 of file OperationDialog.hh.
|
private |
Static text control displaying the operation latency.
Definition at line 116 of file OperationDialog.hh.
|
private |
Name of the operation.
Definition at line 89 of file OperationDialog.hh.
|
private |
List of unused resources.
Definition at line 110 of file OperationDialog.hh.
|
private |
Spin button control for the bind operand.
Definition at line 95 of file OperationDialog.hh.
|
private |
List of unused operands.
Definition at line 113 of file OperationDialog.hh.
|
private |
Static boxsizer for the operand list widgets.
Definition at line 105 of file OperationDialog.hh.
|
private |
Operation to edit.
Definition at line 87 of file OperationDialog.hh.
|
private |
Choice widget for the port to bind.
Definition at line 101 of file OperationDialog.hh.
|
staticprivate |
Grid marker for a read.
Definition at line 123 of file OperationDialog.hh.
|
private |
Resource list widget.
Definition at line 97 of file OperationDialog.hh.
|
private |
Name of resource to be added.
Definition at line 91 of file OperationDialog.hh.
|
private |
Static boxsizer for the resource grid widgets.
Definition at line 103 of file OperationDialog.hh.
|
private |
Operand usage grid widget.
Definition at line 99 of file OperationDialog.hh.
|
private |
Static boxsizer for the operand usage grid widgets.
Definition at line 107 of file OperationDialog.hh.
|
staticprivate |
Grid marker for resource use.
Definition at line 121 of file OperationDialog.hh.
|
staticprivate |
Grid marker for a write.
Definition at line 125 of file OperationDialog.hh.