OpenASIP
2.0
|
#include <SimulateDialog.hh>
Public Member Functions | |
SimulateDialog (wxWindow *parent, Operation *operation, const std::string &pathName, const std::string &modName) | |
virtual | ~SimulateDialog () |
std::string | formattedValue (SimValue *value) |
Static Public Attributes | |
static const wxString | DIALOG_NAME = _T("SimulateDialog") |
Name of the dialog so it can be found with wxWindow::FindWindowByName. More... | |
Private Member Functions | |
SimulateDialog (const SimulateDialog &) | |
Copying not allowed. More... | |
SimulateDialog & | operator= (const SimulateDialog &) |
Assignment not allowed. More... | |
wxSizer * | createContents (wxWindow *parent, bool call_fit, bool set_sizer) |
wxBitmap | createBitmap (unsigned int index) |
virtual bool | TransferDataToWindow () |
void | updateLists () |
void | setTexts () |
void | onSelection (wxListEvent &event) |
void | onUpdateValue (wxCommandEvent &event) |
void | onReset (wxCommandEvent &event) |
void | onTrigger (wxCommandEvent &event) |
void | onLateResult (wxCommandEvent &event) |
void | onAdvanceClock (wxCommandEvent &event) |
void | onFormatChanged (wxCommandEvent &event) |
void | showOrHideRegisters (wxCommandEvent &event) |
void | onOK (wxCommandEvent &event) |
void | onClose (wxCloseEvent &) |
void | setInputValues (std::vector< SimValue * > inputs) |
void | setOutputValues (std::vector< SimValue * > outputs) |
void | createState () |
Private Attributes | |
wxStaticBoxSizer * | inputSizer_ |
Input operand sizer. More... | |
wxStaticBoxSizer * | outputSizer_ |
Output operand sizer. More... | |
wxListCtrl * | inputList_ |
Input list. More... | |
wxListCtrl * | outputList_ |
Output list. More... | |
NumberControl * | updateValue_ |
Text control for updating input values. More... | |
wxChoice * | format_ |
Choice list of possible output formats. More... | |
Operation * | operation_ |
Bitmap for Trigger result. More... | |
std::string | pathName_ |
Path in which operation module belongs to. More... | |
std::string | modName_ |
Module in which operation belongs to. More... | |
std::vector< DataObject * > | inputs_ |
List of input values. More... | |
std::vector< DataObject * > | outputs_ |
List of output values. More... | |
unsigned int | clock_ |
Variable where the value of clock is kept. More... | |
SimulationInfoDialog * | infoDialog_ |
Dialog for showing additional information. More... | |
OperationBehaviorProxy * | behaviorProxy_ |
The behavior proxy that loads the behavior. Used to "freeze" the behavior loading for the duration of the simulation. More... | |
Static Private Attributes | |
static const std::string | FORMAT_SIGNED_INT = "signed int" |
Signed int format. More... | |
static const std::string | FORMAT_UNSIGNED_INT = "unsigned int" |
Unsigned int format. More... | |
static const std::string | FORMAT_DOUBLE = "double" |
Double format. More... | |
static const std::string | FORMAT_FLOAT = "float" |
Float format. More... | |
static const std::string | FORMAT_BINARY = "binary" |
Binary format. More... | |
static const std::string | FORMAT_HEXA_DECIMAL = "hexadecimal" |
Hexadecimal format. More... | |
Class for simulating operation behavior.
Definition at line 53 of file SimulateDialog.hh.
|
private |
Component ids.
Definition at line 109 of file SimulateDialog.hh.
SimulateDialog::SimulateDialog | ( | wxWindow * | parent, |
Operation * | operation, | ||
const std::string & | pathName, | ||
const std::string & | modName | ||
) |
Constructor.
parent | Parent window. |
operation | Operation to be simulated. |
Definition at line 98 of file SimulateDialog.cc.
References assert, OSEdInformer::EVENT_REGISTER, OSEdInformer::EVENT_RESET, OperationContainer::operationContext(), OSEdInformer::registerListener(), and WxConversion::toWxString().
|
virtual |
Destructor.
Definition at line 162 of file SimulateDialog.cc.
References Operation::behavior(), behaviorProxy_, SequenceTools::deleteAllItems(), OperationBehavior::deleteState(), DialogPosition::DIALOG_SIMULATE, inputs_, operation_, OperationContainer::operationContext(), outputs_, OperationBehaviorProxy::setAlwaysReloadBehavior(), DialogPosition::setPosition(), and OperationBehaviorProxy::uninitializeBehavior().
|
private |
Copying not allowed.
|
private |
Definition at line 693 of file SimulateDialog.cc.
|
private |
Creates the contents of the dialog.
NOTE! This function was generated by wxDesigner.
parent | Parent window. |
call_fit | If true fits the contenst inside the dialog. |
set_sizer | If true sets the main sizer as dialog contents. |
Definition at line 582 of file SimulateDialog.cc.
References ID_BUTTON_ADVANCE_LOCK, ID_BUTTON_RESET, ID_BUTTON_SHOW_HIDE_REGISTERS, ID_BUTTON_TRIGGER, ID_BUTTON_UPDATE, ID_FORMAT, ID_FORMAT_TEXT, ID_INPUT_LIST, ID_OUTPUT_LIST, ID_TEXT_CLOCK, ID_TEXT_CLOCK_VALUE, ID_VALUE, inputSizer_, NumberControl::MODE_BINARY, NumberControl::MODE_DOUBLE, NumberControl::MODE_FLOAT, NumberControl::MODE_HEXADECIMAL, NumberControl::MODE_INT, NumberControl::MODE_UNSIGNED, and outputSizer_.
|
private |
Creates the state for the operation.
Definition at line 566 of file SimulateDialog.cc.
References Operation::behavior(), OperationBehavior::createState(), operation_, and OperationContainer::operationContext().
Referenced by onAdvanceClock(), and onTrigger().
string SimulateDialog::formattedValue | ( | SimValue * | value | ) |
Formats the value of the SimValue.
value | Value to be formatted. |
Definition at line 532 of file SimulateDialog.cc.
References SimValue::doubleWordValue(), SimValue::floatWordValue(), format_, FORMAT_BINARY, FORMAT_DOUBLE, FORMAT_FLOAT, FORMAT_HEXA_DECIMAL, FORMAT_SIGNED_INT, FORMAT_UNSIGNED_INT, SimValue::sIntWordValue(), Conversion::toBinString(), Conversion::toHexString(), WxConversion::toString(), Conversion::toString(), and SimValue::uIntWordValue().
Referenced by onUpdateValue(), setInputValues(), setOutputValues(), and SimulationInfoDialog::updateList().
|
private |
Handles the event when advance clock button is pushed.
Definition at line 399 of file SimulateDialog.cc.
References Memory::advanceClock(), OperationContext::advanceClock(), clock_, createState(), OSEdInformer::EVENT_MEMORY, OSEdInformer::handleEvent(), ID_TEXT_CLOCK_VALUE, OperationContainer::memory(), OperationContainer::operationContext(), and WxConversion::toWxString().
|
private |
Handles the event when window is closed.
event | Event to be handled. |
Definition at line 485 of file SimulateDialog.cc.
References OSEdInformer::EVENT_REGISTER, OSEdInformer::EVENT_RESET, infoDialog_, and OSEdInformer::unregisterListener().
|
private |
Handles the event when intput and output format is changed.
Definition at line 413 of file SimulateDialog.cc.
References SequenceTools::deleteAllItems(), OSEdInformer::EVENT_REGISTER, OSEdInformer::handleEvent(), OperationSimulator::initializeSimValue(), inputs_, OperationSimulator::instance(), outputs_, setInputValues(), setOutputValues(), and updateLists().
|
private |
|
private |
Handles the event when OK button is pushed.
Definition at line 471 of file SimulateDialog.cc.
References OSEdInformer::EVENT_REGISTER, OSEdInformer::EVENT_RESET, infoDialog_, and OSEdInformer::unregisterListener().
|
private |
Handles the event when Reset button is pushed.
Reset sets all values to their defaults.
Definition at line 336 of file SimulateDialog.cc.
References Operation::behavior(), clock_, OperationBehavior::deleteState(), OSEdInformer::EVENT_RESET, OSEdInformer::handleEvent(), ID_TEXT_CLOCK_VALUE, inputs_, operation_, OperationContainer::operationContext(), outputs_, WxConversion::toWxString(), and updateLists().
|
private |
Handles the event when a value is selected or deselected on input list.
Definition at line 299 of file SimulateDialog.cc.
References ID_BUTTON_UPDATE, and inputList_.
Referenced by updateLists().
|
private |
Handles the event when Trigger button is pushed.
Definition at line 363 of file SimulateDialog.cc.
References createState(), SequenceTools::deleteAllItems(), OSEdInformer::EVENT_MEMORY, OSEdInformer::EVENT_REGISTER, OSEdInformer::handleEvent(), inputs_, OperationSimulator::instance(), operation_, OperationContainer::operationContext(), setOutputValues(), OperationSimulator::simulateTrigger(), WxConversion::toWxString(), and updateLists().
|
private |
Handles the event when input value is updated.
Definition at line 311 of file SimulateDialog.cc.
References NumberControl::doubleValue(), formattedValue(), inputList_, inputs_, NumberControl::intValue(), WidgetTools::lcStringSelection(), NumberControl::mode(), NumberControl::MODE_DOUBLE, Conversion::toInt(), updateLists(), and updateValue_.
|
private |
Assignment not allowed.
|
private |
Sets the input values after the format has changed.
inputs | Input values of operation. |
Definition at line 499 of file SimulateDialog.cc.
References format_, formattedValue(), inputs_, and WxConversion::toString().
Referenced by onFormatChanged().
|
private |
Sets the output values of the operation after executing a command.
outputs | Output values of operation. |
Definition at line 515 of file SimulateDialog.cc.
References formattedValue(), inputs_, and outputs_.
Referenced by onFormatChanged(), and onTrigger().
|
private |
Set texts to widgets.
Definition at line 198 of file SimulateDialog.cc.
References OSEdConstants::DEFAULT_COLUMN_WIDTH, ID_BUTTON_ADVANCE_LOCK, ID_BUTTON_RESET, ID_BUTTON_SHOW_HIDE_REGISTERS, ID_BUTTON_TRIGGER, ID_BUTTON_UPDATE, ID_FORMAT_TEXT, ID_TEXT_CLOCK, inputList_, inputSizer_, OSEdTextGenerator::instance(), GUITextGenerator::instance(), Operation::name(), operation_, outputList_, outputSizer_, WidgetTools::setLabel(), WidgetTools::setWidgetLabel(), Texts::TextGenerator::text(), WxConversion::toWxString(), OSEdTextGenerator::TXT_BOX_INPUT_VALUES, OSEdTextGenerator::TXT_BOX_OUTPUT_VALUES, OSEdTextGenerator::TXT_BUTTON_ADVANCE_LOCK, GUITextGenerator::TXT_BUTTON_OK, OSEdTextGenerator::TXT_BUTTON_RESET, OSEdTextGenerator::TXT_BUTTON_SHOW_REGISTERS, OSEdTextGenerator::TXT_BUTTON_TRIGGER, OSEdTextGenerator::TXT_BUTTON_UPDATE, OSEdTextGenerator::TXT_COLUMN_OPERAND, OSEdTextGenerator::TXT_COLUMN_VALUE, OSEdTextGenerator::TXT_LABEL_CLOCK, OSEdTextGenerator::TXT_LABEL_FORMAT, and OSEdTextGenerator::TXT_SIMULATE_DIALOG_TITLE.
|
private |
Handles the event when registers are shown or hidden.
Definition at line 446 of file SimulateDialog.cc.
References ID_BUTTON_SHOW_HIDE_REGISTERS, infoDialog_, OSEdTextGenerator::instance(), Texts::TextGenerator::text(), WxConversion::toWxString(), OSEdTextGenerator::TXT_BUTTON_HIDE_REGISTERS, and OSEdTextGenerator::TXT_BUTTON_SHOW_REGISTERS.
|
privatevirtual |
Transfers data to window.
Definition at line 189 of file SimulateDialog.cc.
References updateLists().
|
private |
Updates input and output value lists.
Definition at line 271 of file SimulateDialog.cc.
References dummy, inputList_, inputs_, onSelection(), outputList_, outputs_, and WxConversion::toWxString().
Referenced by onFormatChanged(), onReset(), onTrigger(), onUpdateValue(), and TransferDataToWindow().
|
private |
The behavior proxy that loads the behavior. Used to "freeze" the behavior loading for the duration of the simulation.
Definition at line 161 of file SimulateDialog.hh.
Referenced by ~SimulateDialog().
|
private |
Variable where the value of clock is kept.
Definition at line 156 of file SimulateDialog.hh.
Referenced by onAdvanceClock(), and onReset().
|
static |
Name of the dialog so it can be found with wxWindow::FindWindowByName.
Definition at line 66 of file SimulateDialog.hh.
Referenced by OSEdBuildAllCmd::Do(), and OSEdBuildCmd::Do().
|
private |
Choice list of possible output formats.
Definition at line 140 of file SimulateDialog.hh.
Referenced by formattedValue(), and setInputValues().
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
Hexadecimal format.
Definition at line 104 of file SimulateDialog.hh.
Referenced by formattedValue().
|
staticprivate |
|
staticprivate |
Unsigned int format.
Definition at line 96 of file SimulateDialog.hh.
Referenced by formattedValue().
|
private |
Dialog for showing additional information.
Definition at line 158 of file SimulateDialog.hh.
Referenced by onClose(), onOK(), and showOrHideRegisters().
|
private |
Input list.
Definition at line 134 of file SimulateDialog.hh.
Referenced by onSelection(), onUpdateValue(), setTexts(), and updateLists().
|
private |
List of input values.
Definition at line 152 of file SimulateDialog.hh.
Referenced by onFormatChanged(), onReset(), onTrigger(), onUpdateValue(), setInputValues(), setOutputValues(), updateLists(), and ~SimulateDialog().
|
private |
Input operand sizer.
Definition at line 130 of file SimulateDialog.hh.
Referenced by createContents(), and setTexts().
|
private |
Module in which operation belongs to.
Definition at line 150 of file SimulateDialog.hh.
|
private |
Bitmap for Trigger result.
Bitmap for Late Result result. Operation to be simulated.
Definition at line 146 of file SimulateDialog.hh.
Referenced by createState(), onReset(), onTrigger(), setTexts(), and ~SimulateDialog().
|
private |
Output list.
Definition at line 136 of file SimulateDialog.hh.
Referenced by setTexts(), and updateLists().
|
private |
List of output values.
Definition at line 154 of file SimulateDialog.hh.
Referenced by onFormatChanged(), onReset(), setOutputValues(), updateLists(), and ~SimulateDialog().
|
private |
Output operand sizer.
Definition at line 132 of file SimulateDialog.hh.
Referenced by createContents(), and setTexts().
|
private |
Path in which operation module belongs to.
Definition at line 148 of file SimulateDialog.hh.
|
private |
Text control for updating input values.
Definition at line 138 of file SimulateDialog.hh.
Referenced by onUpdateValue().