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

#include <ProximPortWindow.hh>

Inheritance diagram for ProximPortWindow:
Inheritance graph
Collaboration diagram for ProximPortWindow:
Collaboration graph

Public Member Functions

 ProximPortWindow (ProximMainFrame *parent, int id)
 
virtual ~ProximPortWindow ()
 
void showFunctionUnit (const std::string &name)
 
- Public Member Functions inherited from ProximUnitWindow
 ProximUnitWindow (ProximMainFrame *parent, int id)
 
virtual ~ProximUnitWindow ()
 
- Public Member Functions inherited from ProximSimulatorWindow
virtual void reset ()
 

Private Member Functions

virtual void reinitialize ()
 
virtual void update ()
 

Additional Inherited Members

- Protected Member Functions inherited from ProximSimulatorWindow
 ProximSimulatorWindow (ProximMainFrame *mainFrame, wxWindowID id=-1, wxPoint pos=wxDefaultPosition, wxSize size=wxDefaultSize, long style=wxTAB_TRAVERSAL)
 
virtual ~ProximSimulatorWindow ()
 
- Protected Attributes inherited from ProximUnitWindow
SimulatorFrontendsimulator_
 Simulator instance .
 
wxChoice * unitChoice_
 Unit choicer widget.
 
wxChoice * modeChoice_
 Value display mode choicer widget.
 
wxListCtrl * valueList_
 List widget for the values.
 
- Static Protected Attributes inherited from ProximUnitWindow
static const wxString MODE_INT = _T("Int")
 String for the mode choicer integer mode.
 
static const wxString MODE_UNSIGNED = _T("Unsigned")
 String for the mode choicer unsigned integer mode.
 
static const wxString MODE_HEX = _T("Hex")
 String for the mode choicer hexadecimal mode.
 
static const wxString MODE_BIN = _T("Binary")
 String for the mode choicer binary mode.
 

Detailed Description

Proxim subwindow which displays function unit port values.

This window listens to SimulatorEvents and updates the window contents automatically.

Definition at line 47 of file ProximPortWindow.hh.

Constructor & Destructor Documentation

◆ ProximPortWindow()

ProximPortWindow::ProximPortWindow ( ProximMainFrame parent,
int  id 
)

Constructor.

Parameters
parentParent window of the window.
idWindow identifier.

Definition at line 64 of file ProximPortWindow.cc.

65 :
66 ProximUnitWindow(parent, id) {
67
68 valueList_->InsertColumn(0, _T("Port"), wxLIST_FORMAT_LEFT, 100);
69 valueList_->InsertColumn(1, _T("Value"), wxLIST_FORMAT_RIGHT, 120);
70
74
76 }
77}
virtual void reinitialize()
wxListCtrl * valueList_
List widget for the values.
SimulatorFrontend * simulator_
Simulator instance .
bool hasSimulationEnded() const
bool isSimulationInitialized() const
bool isSimulationStopped() const

References SimulatorFrontend::hasSimulationEnded(), SimulatorFrontend::isSimulationInitialized(), SimulatorFrontend::isSimulationStopped(), reinitialize(), ProximUnitWindow::simulator_, and ProximUnitWindow::valueList_.

Here is the call graph for this function:

◆ ~ProximPortWindow()

ProximPortWindow::~ProximPortWindow ( )
virtual

Destructor.

Definition at line 83 of file ProximPortWindow.cc.

83 {
84}

Member Function Documentation

◆ reinitialize()

void ProximPortWindow::reinitialize ( )
privatevirtual

Sets the available function unit selections in the function unit choice.

Reimplemented from ProximUnitWindow.

Definition at line 91 of file ProximPortWindow.cc.

91 {
92
93 unitChoice_->Clear();
94
95 string gcuName = simulator_->machine().controlUnit()->name();
96 unitChoice_->Append(WxConversion::toWxString(gcuName));
97
100
101 for (int i = 0; i < navigator.count(); i++) {
102 string fuName = navigator.item(i)->name();
103 unitChoice_->Append(WxConversion::toWxString(fuName));
104 }
105
106 unitChoice_->SetSelection(0);
107
108 update();
109}
virtual void update()
wxChoice * unitChoice_
Unit choicer widget.
const TTAMachine::Machine & machine() const
virtual TCEString name() const
ComponentType * item(int index) const
virtual FunctionUnitNavigator functionUnitNavigator() const
Definition Machine.cc:380
virtual ControlUnit * controlUnit() const
Definition Machine.cc:345
static wxString toWxString(const std::string &source)

References TTAMachine::Machine::controlUnit(), TTAMachine::Machine::Navigator< ComponentType >::count(), TTAMachine::Machine::functionUnitNavigator(), TTAMachine::Machine::Navigator< ComponentType >::item(), SimulatorFrontend::machine(), TTAMachine::Component::name(), ProximUnitWindow::simulator_, WxConversion::toWxString(), ProximUnitWindow::unitChoice_, and update().

Referenced by ProximPortWindow().

Here is the call graph for this function:

◆ showFunctionUnit()

void ProximPortWindow::showFunctionUnit ( const std::string &  name)

Changes unit selection to function unit with given name.

Parameters
nameName of the function unit to select.

Definition at line 117 of file ProximPortWindow.cc.

117 {
118 unitChoice_->SetStringSelection(WxConversion::toWxString(name));
119 update();
120}

References WxConversion::toWxString(), ProximUnitWindow::unitChoice_, and update().

Referenced by ProximShowPortsCmd::Do().

Here is the call graph for this function:

◆ update()

void ProximPortWindow::update ( )
privatevirtual

Updates the value list with port values of the selected function unit.

Reimplemented from ProximUnitWindow.

Definition at line 126 of file ProximPortWindow.cc.

126 {
127
128 valueList_->DeleteAllItems();
129
130 MachineState& machState = simulator_->machineState();
133
134 int fuIndex = unitChoice_->GetSelection();
135 FunctionUnit* fu = NULL;
136
137 // FU Choice item with index 0 is the control unit.
138 if (fuIndex == 0) {
140 } else {
141 fu = navigator.item(fuIndex - 1);
142 }
143
144 // Append all ports of the function unit to the port list.
145 for (int i = 0; i < fu->portCount(); i++) {
146
147 string portName = fu->port(i)->name();
148 const PortState& state = machState.portState(portName, fu->name());
149
150 wxString value;
151
152 wxString mode = modeChoice_->GetStringSelection();
153
154 if (mode == MODE_UNSIGNED) {
156 } else if (mode == MODE_INT) {
157 int intValue = state.value().intValue();
158 value = WxConversion::toWxString(intValue);
159 } else if (mode == MODE_HEX) {
162 } else if (mode == MODE_BIN) {
163 int intValue = state.value().unsignedValue();
165 Conversion::toBinString(intValue));
166 }
167
168 valueList_->InsertItem(i, WxConversion::toWxString(portName));
169 valueList_->SetItem(i, 1, value);
170 }
171}
static std::string toBinString(int source)
Definition Conversion.cc:81
static std::string toHexString(T source, std::size_t digits=0, bool include0x=true)
PortState & portState(const std::string &portName, const std::string &fuName)
static const wxString MODE_HEX
String for the mode choicer hexadecimal mode.
static const wxString MODE_INT
String for the mode choicer integer mode.
static const wxString MODE_BIN
String for the mode choicer binary mode.
static const wxString MODE_UNSIGNED
String for the mode choicer unsigned integer mode.
wxChoice * modeChoice_
Value display mode choicer widget.
virtual const SimValue & value() const
int intValue() const
Definition SimValue.cc:895
unsigned int unsignedValue() const
Definition SimValue.cc:919
MachineState & machineState(int core=-1)
virtual BaseFUPort * port(const std::string &name) const
virtual std::string name() const
Definition Port.cc:141
virtual int portCount() const
Definition Unit.cc:135
mode
Definition tceopgen.cc:45

References TTAMachine::Machine::controlUnit(), TTAMachine::Machine::functionUnitNavigator(), SimValue::intValue(), TTAMachine::Machine::Navigator< ComponentType >::item(), SimulatorFrontend::machine(), SimulatorFrontend::machineState(), ProximUnitWindow::MODE_BIN, ProximUnitWindow::MODE_HEX, ProximUnitWindow::MODE_INT, ProximUnitWindow::MODE_UNSIGNED, ProximUnitWindow::modeChoice_, TTAMachine::Component::name(), TTAMachine::Port::name(), TTAMachine::FunctionUnit::port(), TTAMachine::Unit::portCount(), MachineState::portState(), ProximUnitWindow::simulator_, Conversion::toBinString(), Conversion::toHexString(), WxConversion::toWxString(), ProximUnitWindow::unitChoice_, SimValue::unsignedValue(), RegisterState::value(), and ProximUnitWindow::valueList_.

Referenced by reinitialize(), and showFunctionUnit().

Here is the call graph for this function:

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