OpenASIP 2.2
|
#include <OperationDialog.hh>
Public Member Functions | |
OperationDialog (wxWindow *parent, TTAMachine::HWOperation *operation) | |
~OperationDialog () | |
Private Types | |
enum | { ID_NAME = 10000 , ID_LABEL_NAME , ID_BIND_LIST , ID_LABEL_PORT , ID_PORT , ID_LABEL_NUMBER , ID_ADD_OPERAND , ID_DELETE_OPERAND , ID_HELP , ID_LINE , ID_LABEL_OPERAND , ID_NUMBER , ID_RESOURCE_GRID , ID_OPERAND_GRID , ID_LABEL_RESOURCE_NAME , ID_RESOURCE_NAME , ID_ADD_RESOURCE , ID_DELETE_RESOURCE , ID_DELETE_RESOURCE_CYCLE , ID_MENU_FOO , ID_MENU_BAR , ID_LABEL_LATENCY , ID_LATENCY } |
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. | |
wxString | name_ |
Name of the operation. | |
wxString | resourceName_ |
Name of resource to be added. | |
wxListCtrl * | bindList_ |
Bind list widget. | |
wxSpinCtrl * | numberControl_ |
Spin button control for the bind operand. | |
wxGrid * | resourceGrid_ |
Resource list widget. | |
wxGrid * | usageGrid_ |
Operand usage grid widget. | |
wxChoice * | portChoice_ |
Choice widget for the port to bind. | |
wxStaticBoxSizer * | resourceSizer_ |
Static boxsizer for the resource grid widgets. | |
wxStaticBoxSizer * | operandSizer_ |
Static boxsizer for the operand list widgets. | |
wxStaticBoxSizer * | usageSizer_ |
Static boxsizer for the operand usage grid widgets. | |
std::list< std::string > | newResources_ |
List of unused resources. | |
std::set< int > | operands_ |
List of unused operands. | |
wxStaticText * | latencyText_ |
Static text control displaying the operation latency. | |
Static Private Attributes | |
static const int | GRID_COLUMN_WIDTH = 25 |
Width of the resource and operand usage grid columns. | |
static const wxString | USE_MARK = _T("X") |
Grid marker for resource use. | |
static const wxString | READ_MARK = _T("R") |
Grid marker for a read. | |
static const wxString | WRITE_MARK = _T("W") |
Grid marker for a write. | |
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 1088 of file OperationDialog.cc.
References ID_ADD_OPERAND, ID_ADD_RESOURCE, ID_BIND_LIST, ID_DELETE_OPERAND, ID_DELETE_RESOURCE, ID_HELP, ID_LABEL_LATENCY, ID_LABEL_NAME, ID_LABEL_OPERAND, ID_LABEL_PORT, ID_LABEL_RESOURCE_NAME, ID_LATENCY, ID_LINE, ID_NAME, ID_NUMBER, ID_OPERAND_GRID, ID_PORT, ID_RESOURCE_GRID, ID_RESOURCE_NAME, operandSizer_, resourceSizer_, and usageSizer_.
|
private |
Initializes the dialog widgets and some class variables.
Definition at line 128 of file OperationDialog.cc.
References bindList_, ID_BIND_LIST, ID_DELETE_OPERAND, ID_DELETE_RESOURCE, ID_LATENCY, ID_NAME, ID_NUMBER, ID_OPERAND_GRID, ID_PORT, ID_RESOURCE_GRID, ID_RESOURCE_NAME, latencyText_, name_, numberControl_, portChoice_, resourceGrid_, resourceName_, and usageGrid_.
|
private |
Handles the Add bind button event.
Adds a bind to the operation according to the number and port selection widgets.
Definition at line 749 of file OperationDialog.cc.
References ProDeTextGenerator::instance(), ProDeTextGenerator::MSG_ERROR_OPERAND_NUM_RESERVED, numberControl_, operands_, Texts::TextGenerator::text(), WxConversion::toWxString(), and updateOperandList().
|
private |
Handles the Add resource button event.
Opens pipeline resource dialog for adding a new resource to the operation.
Definition at line 943 of file OperationDialog.cc.
References ProDeTextGenerator::COMP_A_RESOURCE, ProDeTextGenerator::COMP_FUNCTION_UNIT, ProDeTextGenerator::COMP_RESOURCE, ContainerTools::containsValue(), TTAMachine::FunctionUnit::hasPipelineElement(), ID_RESOURCE_NAME, ProDeTextGenerator::instance(), MachineTester::isValidComponentName(), ProDeTextGenerator::MSG_ERROR_ILLEGAL_NAME, ProDeTextGenerator::MSG_ERROR_SAME_NAME, newResources_, operation_, TTAMachine::HWOperation::parentUnit(), resourceName_, Texts::TextGenerator::text(), WxConversion::toString(), WxConversion::toWxString(), and updateResourceGrid().
|
private |
Event handler for the operand port binding choicer.
Definition at line 837 of file OperationDialog.cc.
References bindList_, TTAMachine::HWOperation::bindPort(), WidgetTools::lcStringSelection(), operation_, TTAMachine::FunctionUnit::operationPort(), TTAMachine::HWOperation::parentUnit(), TTAMachine::HWOperation::port(), portChoice_, Conversion::toInt(), WxConversion::toString(), TTAMachine::HWOperation::unbindPort(), and updateOperandList().
|
private |
Removes the selected bind from the operation.
Definition at line 781 of file OperationDialog.cc.
References bindList_, ContainerTools::containsValue(), ProDeTextGenerator::instance(), TTAMachine::ExecutionPipeline::latency(), WidgetTools::lcStringSelection(), ProDeTextGenerator::MSG_CONFIRM_OPERAND_DELETION, ProDeTextGenerator::MSG_ERROR_PIPELINE_START, operands_, operation_, TTAMachine::HWOperation::pipeline(), TTAMachine::HWOperation::port(), TTAMachine::ExecutionPipeline::readOperands(), TTAMachine::ExecutionPipeline::removeOperandUse(), ContainerTools::removeValueIfExists(), Texts::TextGenerator::text(), Conversion::toInt(), WxConversion::toWxString(), TTAMachine::HWOperation::unbindPort(), updateOperandList(), and TTAMachine::ExecutionPipeline::writtenOperands().
|
private |
Handles the delete resource button event.
Deletes the selected resource usage from the operation.
Definition at line 988 of file OperationDialog.cc.
References ProDeTextGenerator::instance(), ProDeTextGenerator::MSG_ERROR_PIPELINE_START, newResources_, operation_, TTAMachine::HWOperation::pipeline(), TTAMachine::ExecutionPipeline::removeResourceUse(), ContainerTools::removeValueIfExists(), selectedResource(), Texts::TextGenerator::text(), WxConversion::toWxString(), and updateResourceGrid().
|
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 531 of file OperationDialog.cc.
References ID_OPERAND_GRID, ID_RESOURCE_GRID, onOperandLClick(), and onResourceLClick().
|
private |
Handles the right mouse button event in both grids.
event | The mouse event to handle. |
Definition at line 545 of file OperationDialog.cc.
References ID_RESOURCE_GRID, and resourceGrid_.
|
private |
Checks whether name field is empty and disables OK button of the dialog if it is.
Definition at line 718 of file OperationDialog.cc.
References assert, ID_ADD_RESOURCE, name_, and resourceName_.
|
private |
Handles the OK-button event.
Updates the operation and closes the dialog.
Definition at line 1022 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, name_, operation_, TTAMachine::HWOperation::setName(), Texts::TextGenerator::text(), WxConversion::toString(), WxConversion::toWxString(), and warnOnResourcesWithoutUsages().
|
private |
Handles left mouse button clicks in the operand usage grid.
event | The mouse event to handle. |
Definition at line 617 of file OperationDialog.cc.
References TTAMachine::ExecutionPipeline::addPortRead(), TTAMachine::ExecutionPipeline::addPortWrite(), assert, ContainerTools::containsValue(), ProDeTextGenerator::instance(), ProDeTextGenerator::MSG_ERROR_PIPELINE_START, operands_, operation_, TTAMachine::HWOperation::pipeline(), TTAMachine::ExecutionPipeline::readOperands(), TTAMachine::ExecutionPipeline::removeOperandUse(), Texts::TextGenerator::text(), WxConversion::toWxString(), updateResourceGrid(), updateUsageGrid(), usageGrid_, and TTAMachine::ExecutionPipeline::writtenOperands().
Referenced by onGridLClick().
|
private |
Handles the bind list item selection events.
Enables and disables the delete bind button according to the selection.
Definition at line 864 of file OperationDialog.cc.
References bindList_, ID_DELETE_OPERAND, ID_PORT, TTAMachine::HWOperation::io(), TTAMachine::HWOperation::isBound(), WidgetTools::lcStringSelection(), TTAMachine::Port::name(), operation_, TTAMachine::FunctionUnit::operationPort(), TTAMachine::HWOperation::parentUnit(), portChoice_, Conversion::toInt(), and WxConversion::toWxString().
Referenced by updateOperandList().
|
private |
Handles left mouse button cliks in the resource grid.
event | The mouse event to handle. |
Definition at line 558 of file OperationDialog.cc.
References TTAMachine::ExecutionPipeline::addResourceUse(), TTAMachine::FunctionUnit::hasPipelineElement(), ProDeTextGenerator::instance(), TTAMachine::ExecutionPipeline::isResourceUsed(), ProDeTextGenerator::MSG_ERROR_PIPELINE_START, newResources_, operation_, TTAMachine::HWOperation::parentUnit(), TTAMachine::HWOperation::pipeline(), TTAMachine::ExecutionPipeline::removeResourceUse(), ContainerTools::removeValueIfExists(), resourceGrid_, selectedResource(), Texts::TextGenerator::text(), WxConversion::toString(), WxConversion::toWxString(), and updateResourceGrid().
Referenced by onGridLClick().
|
private |
Handles the resource list item selection events.
Enables and disables the edit and delete resource buttons according to the selection.
Definition at line 906 of file OperationDialog.cc.
References ID_DELETE_RESOURCE, resourceGrid_, and updateUsageGrid().
|
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 511 of file OperationDialog.cc.
References operands_.
Referenced by setOperandType(), and updateUsageGrid().
|
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 922 of file OperationDialog.cc.
References resourceGrid_, and WxConversion::toString().
Referenced by onDeleteResource(), and onResourceLClick().
|
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 458 of file OperationDialog.cc.
References assert, operandRow(), READ_MARK, WxConversion::toWxString(), usageGrid_, and WRITE_MARK.
Referenced by updateUsageGrid().
|
private |
Sets texts for widgets.
Definition at line 165 of file OperationDialog.cc.
References ID_ADD_OPERAND, ID_ADD_RESOURCE, ID_BIND_LIST, ID_DELETE_OPERAND, ID_DELETE_RESOURCE, ID_HELP, ID_LABEL_NAME, ID_LABEL_OPERAND, ID_LABEL_PORT, ID_LABEL_RESOURCE_NAME, GUITextGenerator::instance(), ProDeTextGenerator::instance(), operandSizer_, resourceSizer_, 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, ProDeTextGenerator::TXT_OPERATION_USAGE_BOX, and usageSizer_.
|
private |
Transfers data from the operation object to the dialog widgets.
Definition at line 238 of file OperationDialog.cc.
References TTAMachine::HWOperation::name(), name_, operation_, WxConversion::toWxString(), updateOperandList(), updateResourceGrid(), and updateUsageGrid().
|
private |
Updates the latency information static text widget.
Definition at line 1072 of file OperationDialog.cc.
References TTAMachine::HWOperation::latency(), latencyText_, operation_, and WxConversion::toWxString().
Referenced by updateResourceGrid(), and updateUsageGrid().
|
private |
Updates the operand bind list.
Definition at line 251 of file OperationDialog.cc.
References bindList_, dummy, TTAMachine::HWOperation::io(), TTAMachine::HWOperation::isBound(), TTAMachine::ExecutionPipeline::latency(), TTAMachine::Port::name(), onOperandSelection(), operands_, operation_, TTAMachine::FunctionUnit::operationPort(), TTAMachine::HWOperation::parentUnit(), TTAMachine::HWOperation::pipeline(), TTAMachine::HWOperation::port(), portChoice_, TTAMachine::ExecutionPipeline::readOperands(), WxConversion::toWxString(), updateUsageGrid(), and TTAMachine::ExecutionPipeline::writtenOperands().
Referenced by onAddOperand(), onBindOperand(), onDeleteOperand(), and TransferDataToWindow().
|
private |
Updates the list of pipeline resources.
Definition at line 307 of file OperationDialog.cc.
References GRID_COLUMN_WIDTH, TTAMachine::ExecutionPipeline::isResourceUsed(), TTAMachine::ExecutionPipeline::latency(), TTAMachine::PipelineElement::name(), newResources_, operation_, TTAMachine::HWOperation::parentUnit(), TTAMachine::HWOperation::pipeline(), TTAMachine::FunctionUnit::pipelineElement(), TTAMachine::FunctionUnit::pipelineElementCount(), resourceGrid_, WxConversion::toWxString(), updateLatency(), and USE_MARK.
Referenced by onAddResource(), onDeleteResource(), onOperandLClick(), onResourceLClick(), and TransferDataToWindow().
|
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 388 of file OperationDialog.cc.
References assert, GRID_COLUMN_WIDTH, TTAMachine::ExecutionPipeline::latency(), operandRow(), operands_, operation_, TTAMachine::HWOperation::pipeline(), READ_MARK, TTAMachine::ExecutionPipeline::readOperands(), setOperandType(), WxConversion::toWxString(), updateLatency(), usageGrid_, WRITE_MARK, and TTAMachine::ExecutionPipeline::writtenOperands().
Referenced by onOperandLClick(), onResourceSelection(), TransferDataToWindow(), and updateOperandList().
|
private |
Warns if pipeline resources without usages exist
Definition at line 477 of file OperationDialog.cc.
References ProDeTextGenerator::instance(), TTAMachine::ExecutionPipeline::isResourceUsed(), TTAMachine::ExecutionPipeline::latency(), ProDeTextGenerator::MSG_WARN_RES_WITHOUT_USAGES, newResources_, operation_, TTAMachine::HWOperation::pipeline(), Texts::TextGenerator::text(), and WxConversion::toWxString().
Referenced by onOK().
|
private |
Bind list widget.
Definition at line 93 of file OperationDialog.hh.
Referenced by initialize(), onBindOperand(), onDeleteOperand(), onOperandSelection(), and updateOperandList().
|
staticprivate |
Width of the resource and operand usage grid columns.
Definition at line 119 of file OperationDialog.hh.
Referenced by updateResourceGrid(), and updateUsageGrid().
|
private |
Static text control displaying the operation latency.
Definition at line 116 of file OperationDialog.hh.
Referenced by initialize(), and updateLatency().
|
private |
Name of the operation.
Definition at line 89 of file OperationDialog.hh.
Referenced by initialize(), onName(), onOK(), and TransferDataToWindow().
|
private |
List of unused resources.
Definition at line 110 of file OperationDialog.hh.
Referenced by onAddResource(), onDeleteResource(), onResourceLClick(), updateResourceGrid(), and warnOnResourcesWithoutUsages().
|
private |
Spin button control for the bind operand.
Definition at line 95 of file OperationDialog.hh.
Referenced by initialize(), and onAddOperand().
|
private |
List of unused operands.
Definition at line 113 of file OperationDialog.hh.
Referenced by onAddOperand(), onDeleteOperand(), onOperandLClick(), operandRow(), updateOperandList(), and updateUsageGrid().
|
private |
Static boxsizer for the operand list widgets.
Definition at line 105 of file OperationDialog.hh.
Referenced by createContents(), and setTexts().
|
private |
Operation to edit.
Definition at line 87 of file OperationDialog.hh.
Referenced by onAddResource(), onBindOperand(), onDeleteOperand(), onDeleteResource(), onOK(), onOperandLClick(), onOperandSelection(), onResourceLClick(), TransferDataToWindow(), updateLatency(), updateOperandList(), updateResourceGrid(), updateUsageGrid(), and warnOnResourcesWithoutUsages().
|
private |
Choice widget for the port to bind.
Definition at line 101 of file OperationDialog.hh.
Referenced by initialize(), onBindOperand(), onOperandSelection(), and updateOperandList().
|
staticprivate |
Grid marker for a read.
Definition at line 123 of file OperationDialog.hh.
Referenced by setOperandType(), and updateUsageGrid().
|
private |
Resource list widget.
Definition at line 97 of file OperationDialog.hh.
Referenced by initialize(), onGridRClick(), onResourceLClick(), onResourceSelection(), selectedResource(), and updateResourceGrid().
|
private |
Name of resource to be added.
Definition at line 91 of file OperationDialog.hh.
Referenced by initialize(), onAddResource(), and onName().
|
private |
Static boxsizer for the resource grid widgets.
Definition at line 103 of file OperationDialog.hh.
Referenced by createContents(), and setTexts().
|
private |
Operand usage grid widget.
Definition at line 99 of file OperationDialog.hh.
Referenced by initialize(), onOperandLClick(), setOperandType(), and updateUsageGrid().
|
private |
Static boxsizer for the operand usage grid widgets.
Definition at line 107 of file OperationDialog.hh.
Referenced by createContents(), and setTexts().
|
staticprivate |
Grid marker for resource use.
Definition at line 121 of file OperationDialog.hh.
Referenced by updateResourceGrid().
|
staticprivate |
Grid marker for a write.
Definition at line 125 of file OperationDialog.hh.
Referenced by setOperandType(), and updateUsageGrid().